th-typegraph-0.14: 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

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.

unlifted :: (IsUnlifted t, Quasi m) => t -> m Bool Source

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.