th-typegraph-0.17: Graph of the subtype relation

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.TH.TypeGraph.Core

Contents

Description

Helper functions for dealing with record fields, type shape, type arity, primitive types, and pretty printing.

Synopsis

Documentation

unReify :: Data a => a -> a Source

Declaration shape

fType :: FieldType -> Type Source

fType' with leading foralls stripped

foldShape :: Monad m => ([(Con, [FieldType])] -> m r) -> (Con -> [FieldType] -> m r) -> ([Con] -> m r) -> (Con -> FieldType -> m r) -> [Con] -> m r Source

Given the list of constructors from a Dec, dispatch on the different levels of complexity of the type they represent - a wrapper is a single arity one constructor, an enum is several arity zero constructors, and so on.

Constructor deconstructors

Queries

typeArity :: Quasi m => Type -> m Int Source

Compute the arity of a type - the number of type parameters that must be applied to it in order to obtain a concrete type.

Pretty print without extra whitespace

pprint' :: Ppr a => a -> [Char] Source

Pretty print a Ppr value on a single line with each block of white space (newlines, tabs, etc.) converted to a single space.