moduleData.Derive.Is(makeIs )where{- test :: Sample isFirst :: Sample a -> Bool isFirst (First{}) = True ; isFirst _ = False isSecond :: Sample a -> Bool isSecond (Second{}) = True ; isSecond _ = False isThird :: Sample a -> Bool isThird (Third{}) = True ; isThird _ = False -}importLanguage.Haskell importData.Derive.Internal.Derivation makeIs::Derivation makeIs =derivationCustom "Is"$\(_,d )->Right$concatMap(makeIsCtor d )$dataDeclCtors d makeIsCtor::DataDecl ->CtorDecl ->[Decl()]makeIsCtor d c =ifnot$isIdent $ctorDeclName c then[]else[TypeSig()[namenam ](TyFun()(dataDeclType d )(tyCon "Bool")),FunBind()$match :[defMatch |length(dataDeclCtors d )>1]]wherenam ="is"++ctorDeclName c match =Match()(namenam )[PParen()$PRec()(qname $ctorDeclName c )[]](UnGuardedRhs()$con "True")NothingdefMatch =Match()(namenam )[PWildCard()](UnGuardedRhs()$con "False")Nothing