Safe Haskell | Safe-Infered |
---|
The core types of Fixplate.
Documentation
forget :: Functor f => Attr f a -> Mu fSource
A function forgetting all the attributes from an annotated tree.
The fixed-point type.
Annotated functors.
Functor f => Functor (Ann f a) | |
Foldable f => Foldable (Ann f a) | |
Traversable f => Traversable (Ann f a) | |
(Read a, ReadF f) => ReadF (Ann f a) | |
(Show a, ShowF f) => ShowF (Ann f a) | |
(Ord a, OrdF f) => OrdF (Ann f a) | NOTE: The |
(Eq a, EqF f) => EqF (Ann f a) | NOTE: The |
"Functorised" versions of standard type classes. If you have your a structure functor, for example
Expr e = Kst Int | Var String | Add e e deriving (Eq,Ord,Read,Show,Functor,Foldable,Traversable)
you should make it an instance of these, so that the
fixed-point type Mu Expr
can be an instance of
Eq
, Ord
and Show
. Doing so is very easy:
instance EqF Expr where equalF = (==) instance OrdF Expr where compareF = compare instance ShowF Expr where showsPrecF = showsPrec
The Read
instance depends on whether we are using GHC or not.
The Haskell98 version is
instance ReadF Expr where readsPrecF = readsPrec
while the GHC version is
instance ReadF Expr where readPrecF = readPrec
class EqF f => OrdF f whereSource
(Ord a, OrdF f) => OrdF (Ann f a) | NOTE: The |
showsPrecF :: Show a => Int -> f a -> ShowSSource
A newtype wrapper around Attr f a
so that we can make Attr f
an instance of Functor, Foldable and Traversable. This is necessary
since Haskell does not allow partial application of type synonyms.