-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Tree representations of datatypes -- -- type-tree provides TH splices for generating tree -- representations of the types contained in datatypes. This is useful -- for, for example, generating class instances for a deeply nested -- datatype. @package type-tree @version 0.2.0.0 module Language.Haskell.TypeTree.ExampleDatatypes data CondTree v c a CondNode :: a -> c -> [CondBranch v c a] -> CondTree v c a [condTreeData] :: CondTree v c a -> a [condTreeConstraints] :: CondTree v c a -> c [condTreeComponents] :: CondTree v c a -> [CondBranch v c a] data CondBranch v c a CondBranch :: Condition v -> CondTree v c a -> Maybe (CondTree v c a) -> CondBranch v c a [condBranchCondition] :: CondBranch v c a -> Condition v [condBranchIfTrue] :: CondBranch v c a -> CondTree v c a [condBranchIfFalse] :: CondBranch v c a -> Maybe (CondTree v c a) data Condition c Var :: c -> Condition c Lit :: Bool -> Condition c CAnd :: (Condition c) -> (Condition c) -> Condition c module Language.Haskell.TypeTree data ReifyOpts ReifyOpts :: Set Name -> Bool -> Bool -> ReifyOpts -- | If a name in this set is encountered, stop recursing. [stop] :: ReifyOpts -> Set Name -- | Expand primitive type constructors (i.e. IntInt#)? [prim] :: ReifyOpts -> Bool -- | If True, type synonyms are present in the resulting -- Forest; if False, a synonym will be expanded and its RHS -- will appear in the out-list instead. [synonyms] :: ReifyOpts -> Bool -- |
--   defaultOpts = ReifyOpts
--     { stop = S.fromList []
--     , prim = False
--     , synonyms = False
--     }
--   
defaultOpts :: ReifyOpts -- | Build a Forest of constructor names contained in the given -- type. ttReifyOpts :: IsDatatype a => ReifyOpts -> a -> Q (Forest Leaf) -- | ttReifyOpts with default options. ttReify :: IsDatatype a => a -> Q (Forest Leaf) -- | Embed the produced Forest as an expression. ttLitOpts :: IsDatatype a => ReifyOpts -> a -> ExpQ -- | ttLitOpts with default options. ttLit :: IsDatatype a => a -> ExpQ -- | Produce a string representation of the forest generated by -- $(ttReifyOpts opts ''SomeName). Useful for debugging -- purposes. ttDescribeOpts :: IsDatatype a => ReifyOpts -> a -> ExpQ -- | ttDescribeOpts with default options. ttDescribe :: IsDatatype a => a -> ExpQ -- | ttConnCompOpts is useful for the usecase which I had in mind -- when I originally wrote this package, namely: -- -- Given some datatype, I need a topologically sorted list of all -- types contained in that datatype for which an instance of some class -- must be defined if I wish to define an instance for that datatype (and -- likewise for each subtype, etc.) -- -- Here's an example using CondTree, which is a useful datatype -- for an example, as it's both mutually recursive and refers to other -- recursive types. -- --
--   >>> :m +Language.Haskell.TypeTree.ExampleDatatypes
--   
--   >>> mapM_ print $(ttConnComp ''CondTree)
--   AcyclicSCC ([] :: * -> *,[])
--   AcyclicSCC (Bool :: *,[])
--   AcyclicSCC (Condition :: * -> *,[Bool :: *])
--   AcyclicSCC (Maybe :: * -> *,[])
--   CyclicSCC [(CondBranch :: * -> * -> * -> *,[Condition :: * -> *,CondTree :: * -> * -> * -> *,Maybe :: * -> *]),(CondTree :: * -> * -> * -> *,[[] :: * -> *,CondBranch :: * -> * -> * -> *])]
--   
ttConnCompOpts :: IsDatatype a => ReifyOpts -> a -> ExpQ -- | ttConnCompOpts with default opts ttConnComp :: IsDatatype a => a -> ExpQ data Leaf -- | TypeL name arr represents the type constructor name, -- which has arity arr. TypeL :: Name -> Arity -> Leaf -- | Recursive field. Recursive :: Leaf -> Leaf class IsDatatype a -- | Produce a list of constructor names asDatatype :: IsDatatype a => a -> Q [Name]