-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Create specialized types from polymorphic ones using TH -- -- Very Alpha. Minimal Testing. Will test more this week. @package specialize-th @version 0.0.0.1 module Language.Haskell.TH.Specialize -- | 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 :: Name -> Name -> Q [Dec] -- | 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. expand_and_specialize' :: DecRenamer -> ConstrRenamer -> Name -> Name -> Q [Dec] newtype ConstructorName ConstructorName :: Name -> ConstructorName runConstructorName :: ConstructorName -> Name newtype TypeName TypeName :: Name -> TypeName runTypeName :: TypeName -> Name type DecRenamer = [Type] -> TypeName -> Result TypeName type ConstrRenamer = [Type] -> Con -> Con -- | Default Dec renamer mk_new_dec_name :: [Type] -> TypeName -> Result TypeName -- | Default Con renamer id_constr_renamer :: [Type] -> Con -> Con sub_dec_and_rename :: (Monad m, Functor m, MonadError String m) => ConstrRenamer -> Dec -> [Type] -> m Dec create_dec_from_type :: (Functor m, Monad m, MonadState [Dec] m, MonadError String m) => DecRenamer -> ConstrRenamer -> Type -> m Type find_con :: (Monad m, MonadError String m) => ConstructorName -> Dec -> m Con get_con_vars :: Con -> [Type] get_ty_vars :: Dec -> [TyVarBndr] concat_type_names :: [Type] -> String rename_dec :: (Monad m, MonadError String m) => [Type] -> Dec -> m Dec run_state' :: ErrorStateT e s m a -> s -> m (Either e a, s) -- | A result for partial functions type Result a = Either String a instance Newtype TypeName Name instance Newtype ConstructorName Name instance Show ConstructorName instance Eq ConstructorName instance Show TypeName instance Eq TypeName instance (Monad m, Error e) => Monad (ErrorStateT e s m) instance (Monad m, Error e) => MonadState s (ErrorStateT e s m) instance (Monad m, Error e) => MonadError e (ErrorStateT e s m) instance Functor m => Functor (ErrorStateT e s m) instance (Monad m, Error e) => MonadPlus (ErrorStateT e s m) instance MonadTrans (ErrorStateT String [Dec])