Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
instances :: QuasiQuoter Source #
QuasiQuoter
for providing intrinsic-superclasses.
Example:
class Semigroup a where mappend :: a -> a -> a class Semigroup a => Monoid a where mempty :: a class (Monoid a) => Group a where inverse :: a -> a [instances| Num a => Group where mempty = fromInteger 0 mappend a b = a + b inverse = negate |]
will generate the appropriate instances for Semigroup
, Monoid
, and Group
:
instance Num a => Semigroup a where mappend a b = a + b instance Num a => Monoid a where mempty = fromInteger 0 instance Num a => Group a where inverse = negate