specialize-th-0.0.0.8: Create specialized types from polymorphic ones using TH

Safe HaskellNone

Language.Haskell.TH.Specialize

Contents

Synopsis

Main Interface

expand_and_specialize :: Name -> Name -> Q [Dec]Source

Expand all the type syn's and create specialize types for any polymorphic types. All of the new specialized declarations are returned, along with the original dec with subbed types and a new name. The first Name is the name of the Dec to create specialize instances for. The second Name, is the new name for the Dec. use mk_new_dec_name for the Dec renaming and id_constr_renamer for the constructor renaming.

expand_and_specialize' :: Maker -> DecRenamer -> ConstrRenamer -> Name -> Name -> Q [Dec]Source

Expand all the type syn's and create specialize types for any polymorphic types. All of the new specialized declarations are returned, along with the original dec with subbed types and a new name. The first Name is the name of the Dec to create specialize instances for. The second Name, is the new name for the Dec. The DecRenamer and ConstrRenamer are used to rename Dec's and Con's respectively.

Helper Types

newtype TypeName Source

Constructors

TypeName 

Fields

runTypeName :: Name
 

Renamer Interface

Stock Renamers

mk_new_dec_name :: [Type] -> TypeName -> Result TypeNameSource

Default Dec renamer

id_constr_renamer :: [Type] -> Con -> ConSource

Default Con renamer

Utils ... Pretend these are not here

run_state' :: ErrorStateT e [a1] r m a -> r -> m (Either e a, [a1])Source

type Result a = Either String a

A result for partial functions