type-sub-th-0.1.0.6: Substitute types for other types with Template Haskell

Safe HaskellSafe-Infered

Language.Haskell.TH.TypeSub

Description

Subsitute one type for another in Template Haskell Dec's, Con's and Type's. | Warning! | There are a few known issues. The types in cxt's are not subsistuted. | Additionally, the Dec's type variables are regenerated after subistution | and all explicitly kinded type variables are converted to implicitly kinded type | variables.

Synopsis

Documentation

sub_types_dec :: [Type] -> Dec -> Result DecSource

Create a new data declaration where the type variables have been subsituted with the | supplied types. Returns an error if the more types the types are provided.

sub_type_dec :: Type -> Type -> Dec -> DecSource

Substitute the a new type for an existing type in all the constructors in a Dec. | If the type to replace is missing, the function does nothing.

sub_type_con :: Type -> Type -> Con -> ConSource

Substitute the new type for the old type in the constructor

sub_type :: Type -> Type -> Type -> TypeSource

Substitute the new type for the old type in the type transform is from Uniplate

type Result a = Either String aSource

A result for partial functions