úÎW      non-portable experimentalsjoerd@w3future.comNone An algebra f a -> a corresponds to an instance of a of the class Class f. h In some cases, for example for tuple types, you can give an algebra generically for every signature: ; instance (Class f m, Class f n) => Algebra f (m, n) where D algebra fmn = (evaluate (fmap fst fmn), evaluate (fmap snd fmn)) The class for which f is the signature. HTranslate the operations of the signature to method calls of the class.  non-portable experimentalsjoerd@w3future.comNone+Derive a signature for an algebraic class.  For exaple:   deriveSignature ''Num ? creates the signature data type and an instance for it of the   class.  DeriveFunctor is used the generate the  instance of the signature. MThis will do nothing if there is already a signature for the class in scope. +Derive an instance for an algebraic class.  For example:  4 deriveInstance [t| (Num m, Num n) => Num (m, n) |] %To be able to derive an instance for a of class c, we need an instance of  f a,  where f is the signature of c. L will generate a signature for the class if there is no signature in scope.         non-portable experimentalsjoerd@w3future.comNoneThe  signature has this  instance: 1 instance AlgebraSignature MonoidSignature where ' type Class MonoidSignature = Monoid  evaluate Op_mempty = mempty + evaluate (Op_mappend a b) = mappend a b ) evaluate (Op_mconcat ms) = mconcat ms  !   !"        !"#$%&'algebraic-classes-0.1Data.Algebra.InternalData.Algebra.TH Data.AlgebraAlgebraalgebraAlgebraSignatureClassevaluate OperationTH functionName operationName arguments SignatureTH signatureName typeVarName operationsgetSignatureInfoderiveSignaturederiveInstancebuildSignatureDataTypesignatureInstanceMonoidSignature Op_mconcat Op_mappend Op_memptybaseGHC.BaseFunctorbuildOperation changeName mkArgListrename Data.MonoidMonoid$fAlgebraf(->) $fAlgebraf(,) $fAlgebraf()!$fAlgebraSignatureMonoidSignature