-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Template Haskell utilities for the data-effects library. -- -- TemplateHaskell functions for deriving effect invocation functions, -- HFunctor instances, and more from the definition of effects -- with data-effects-based GADT representations. @package data-effects-th @version 0.1.2.0 module Data.Effect.TH.Internal data EffClsInfo EffClsInfo :: Name -> [TyVarBndr ()] -> Maybe (TyVarBndr ()) -> [EffConInfo] -> EffClsInfo [ecName] :: EffClsInfo -> Name [ecParamVars] :: EffClsInfo -> [TyVarBndr ()] [ecCarrier] :: EffClsInfo -> Maybe (TyVarBndr ()) [ecEffs] :: EffClsInfo -> [EffConInfo] data EffConInfo EffConInfo :: Name -> [Type] -> Type -> Type -> [TyVarBndrSpec] -> Maybe (TyVarBndr ()) -> Cxt -> EffConInfo [effName] :: EffConInfo -> Name [effParamTypes] :: EffConInfo -> [Type] [effDataType] :: EffConInfo -> Type [effResultType] :: EffConInfo -> Type [effTyVars] :: EffConInfo -> [TyVarBndrSpec] [effCarrier] :: EffConInfo -> Maybe (TyVarBndr ()) [effCxt] :: EffConInfo -> Cxt -- | An order of effect. data EffectOrder FirstOrder :: EffectOrder HigherOrder :: EffectOrder orderOf :: EffClsInfo -> EffectOrder newtype MakeEffectConf MakeEffectConf :: (EffClsInfo -> Q EffectClassConf) -> MakeEffectConf [unMakeEffectConf] :: MakeEffectConf -> EffClsInfo -> Q EffectClassConf alterEffectClassConf :: (EffectClassConf -> EffectClassConf) -> MakeEffectConf -> MakeEffectConf alterEffectConf :: (EffectConf -> EffectConf) -> MakeEffectConf -> MakeEffectConf data EffectClassConf EffectClassConf :: (Name -> EffectConf) -> Bool -> Bool -> Bool -> EffectClassConf [_confByEffect] :: EffectClassConf -> Name -> EffectConf [_doesDeriveHFunctor] :: EffectClassConf -> Bool [_doesGenerateLiftInsTypeSynonym] :: EffectClassConf -> Bool [_doesGenerateLiftInsPatternSynonyms] :: EffectClassConf -> Bool data EffectConf EffectConf :: Maybe SenderFunctionConf -> Maybe SenderFunctionConf -> Maybe SenderFunctionConf -> Bool -> EffectConf [_normalSenderGenConf] :: EffectConf -> Maybe SenderFunctionConf [_taggedSenderGenConf] :: EffectConf -> Maybe SenderFunctionConf [_keyedSenderGenConf] :: EffectConf -> Maybe SenderFunctionConf [_warnFirstOrderInSigCls] :: EffectConf -> Bool data SenderFunctionConf SenderFunctionConf :: String -> Bool -> (Maybe String -> Q (Maybe String)) -> (Int -> Maybe String -> Q (Maybe String)) -> SenderFunctionConf [_senderFnName] :: SenderFunctionConf -> String [_doesGenerateSenderFnSignature] :: SenderFunctionConf -> Bool [_senderFnDoc] :: SenderFunctionConf -> Maybe String -> Q (Maybe String) [_senderFnArgDoc] :: SenderFunctionConf -> Int -> Maybe String -> Q (Maybe String) senderFnConfs :: Traversal' EffectConf SenderFunctionConf doesGenerateLiftInsTypeSynonym :: Lens' EffectClassConf Bool doesGenerateLiftInsPatternSynonyms :: Lens' EffectClassConf Bool doesDeriveHFunctor :: Lens' EffectClassConf Bool confByEffect :: Lens' EffectClassConf (Name -> EffectConf) warnFirstOrderInSigCls :: Lens' EffectConf Bool taggedSenderGenConf :: Lens' EffectConf (Maybe SenderFunctionConf) normalSenderGenConf :: Lens' EffectConf (Maybe SenderFunctionConf) keyedSenderGenConf :: Lens' EffectConf (Maybe SenderFunctionConf) senderFnName :: Lens' SenderFunctionConf String senderFnDoc :: Lens' SenderFunctionConf (Maybe String -> Q (Maybe String)) senderFnArgDoc :: Lens' SenderFunctionConf (Int -> Maybe String -> Q (Maybe String)) doesGenerateSenderFnSignature :: Lens' SenderFunctionConf Bool deriveHFunctor :: MakeEffectConf -> MakeEffectConf noDeriveHFunctor :: MakeEffectConf -> MakeEffectConf generateLiftInsTypeSynonym :: MakeEffectConf -> MakeEffectConf noGenerateLiftInsTypeSynonym :: MakeEffectConf -> MakeEffectConf generateLiftInsPatternSynonyms :: MakeEffectConf -> MakeEffectConf noGenerateLiftInsPatternSynonyms :: MakeEffectConf -> MakeEffectConf noGenerateNormalSenderFunction :: MakeEffectConf -> MakeEffectConf noGenerateTaggedSenderFunction :: MakeEffectConf -> MakeEffectConf noGenerateKeyedSenderFunction :: MakeEffectConf -> MakeEffectConf suppressFirstOrderInSignatureClassWarning :: MakeEffectConf -> MakeEffectConf noGenerateSenderFunctionSignature :: MakeEffectConf -> MakeEffectConf genSenders :: EffectClassConf -> EffClsInfo -> Q [Dec] genNormalSender :: EffectOrder -> SenderFunctionConf -> EffConInfo -> WriterT [Dec] Q () genTaggedSender :: EffectOrder -> SenderFunctionConf -> EffConInfo -> WriterT [Dec] Q () genKeyedSender :: EffectOrder -> SenderFunctionConf -> EffConInfo -> WriterT [Dec] Q () genSender :: EffectOrder -> (Exp -> Exp) -> (Type -> Type -> Type) -> ([TyVarBndrSpec] -> [TyVarBndrSpec]) -> SenderFunctionConf -> EffConInfo -> WriterT [Dec] Q () genSenderArmor :: (Type -> Type -> Type) -> ([TyVarBndrSpec] -> [TyVarBndrSpec]) -> SenderFunctionConf -> EffConInfo -> (Type -> Q Clause) -> WriterT [Dec] Q () arrowChain :: Foldable t => t Type -> Type -> Type -- | A reified information of a datatype. data DataInfo DataInfo :: Cxt -> Name -> [TyVarBndr ()] -> [ConInfo] -> DataInfo [dataCxt] :: DataInfo -> Cxt [dataName] :: DataInfo -> Name [dataTyVars] :: DataInfo -> [TyVarBndr ()] [dataCons] :: DataInfo -> [ConInfo] data ConInfo ConInfo :: Name -> [BangType] -> Maybe Type -> [TyVarBndrSpec] -> Cxt -> ConInfo [conName] :: ConInfo -> Name [conArgs] :: ConInfo -> [BangType] [conGadtReturnType] :: ConInfo -> Maybe Type [conTyVars] :: ConInfo -> [TyVarBndrSpec] [conCxt] :: ConInfo -> Cxt reifyEffCls :: EffectOrder -> Name -> Q (Info, DataInfo, EffClsInfo) analyzeEffCls :: EffectOrder -> DataInfo -> Either Text EffClsInfo -- | Generate the pattern synonyms for instruction constructors: -- --
-- pattern LBaz ... = LiftIns (Baz ...) --genLiftInsPatternSynonyms :: EffClsInfo -> Q [Dec] -- | Generate the type synonym for an instruction class datatype: -- --
-- type (LFoobar ...) = LiftIns (Foobar ...) --genLiftInsTypeSynonym :: EffClsInfo -> Dec -- | Pures the name of a type variable. tyVarName :: TyVarBndr a -> Name -- | Converts a type variable to a type. tyVarType :: TyVarBndr a -> Type -- | Throws away all kind information from a type. unkindTypeRec :: Type -> Type unkindType :: Type -> Type -- | Throws away the kind information of a type variable. unkindTyVar :: TyVarBndr a -> TyVarBndr a -- | Checks if a name m appears somewhere in a type. occurs :: Name -> Type -> Bool -- | This function abstracts away newtype declaration, it turns -- them into data declarations. analyzeData :: Info -> Maybe DataInfo normalizeCon :: Con -> [ConInfo] normalizeNonForallCon :: Con -> [ConInfo] instance Data.Default.Class.Default Data.Effect.TH.Internal.MakeEffectConf instance Data.Default.Class.Default Data.Effect.TH.Internal.EffectClassConf instance GHC.Classes.Ord Data.Effect.TH.Internal.EffectOrder instance GHC.Classes.Eq Data.Effect.TH.Internal.EffectOrder instance GHC.Show.Show Data.Effect.TH.Internal.EffectOrder module Data.Effect.HFunctor.TH.Internal -- | Derive an instance of HFunctor for a type constructor of any -- higher-order kind taking at least two arguments. deriveHFunctor :: (Infinite (Q Type) -> Q Type) -> DataInfo -> Q [Dec] wrapLam :: (Exp -> Q Exp) -> Q Exp mapTupleE :: (Type -> Exp -> Q Exp) -> Type -> Exp -> Maybe (Q Exp) decomposeTupleT :: Type -> Maybe [Type] -- | This function provides a list (of the given length) of new names based -- on the given string. newNames :: Int -> String -> Q [Name] iter :: (Eq t, Num t, Quote m) => t -> m Exp -> m Exp -> m Exp module Data.Effect.TH makeEffect' :: MakeEffectConf -> (EffectOrder -> Info -> DataInfo -> EffClsInfo -> EffectClassConf -> Q [Dec]) -> [Name] -> [Name] -> Q [Dec] noExtTemplate :: EffectOrder -> Info -> DataInfo -> EffClsInfo -> EffectClassConf -> Q [Dec] makeEffect :: [Name] -> [Name] -> Q [Dec] makeEffectF :: [Name] -> Q [Dec] makeEffectH :: [Name] -> Q [Dec] -- | A class for types with a default value. class Default a -- | The default value for this type. def :: Default a => a -- | & is a reverse application operator. This provides -- notational convenience. Its precedence is one higher than that of the -- forward application operator $, which allows & to be -- nested in $. -- --
-- >>> 5 & (+1) & show -- "6" --(&) :: a -> (a -> b) -> b infixl 1 & -- | An order of effect. data EffectOrder FirstOrder :: EffectOrder HigherOrder :: EffectOrder orderOf :: EffClsInfo -> EffectOrder newtype MakeEffectConf MakeEffectConf :: (EffClsInfo -> Q EffectClassConf) -> MakeEffectConf [unMakeEffectConf] :: MakeEffectConf -> EffClsInfo -> Q EffectClassConf alterEffectClassConf :: (EffectClassConf -> EffectClassConf) -> MakeEffectConf -> MakeEffectConf alterEffectConf :: (EffectConf -> EffectConf) -> MakeEffectConf -> MakeEffectConf data EffectClassConf EffectClassConf :: (Name -> EffectConf) -> Bool -> Bool -> Bool -> EffectClassConf [_confByEffect] :: EffectClassConf -> Name -> EffectConf [_doesDeriveHFunctor] :: EffectClassConf -> Bool [_doesGenerateLiftInsTypeSynonym] :: EffectClassConf -> Bool [_doesGenerateLiftInsPatternSynonyms] :: EffectClassConf -> Bool confByEffect :: Lens' EffectClassConf (Name -> EffectConf) doesDeriveHFunctor :: Lens' EffectClassConf Bool doesGenerateLiftInsPatternSynonyms :: Lens' EffectClassConf Bool doesGenerateLiftInsTypeSynonym :: Lens' EffectClassConf Bool data EffectConf EffectConf :: Maybe SenderFunctionConf -> Maybe SenderFunctionConf -> Maybe SenderFunctionConf -> Bool -> EffectConf [_normalSenderGenConf] :: EffectConf -> Maybe SenderFunctionConf [_taggedSenderGenConf] :: EffectConf -> Maybe SenderFunctionConf [_keyedSenderGenConf] :: EffectConf -> Maybe SenderFunctionConf [_warnFirstOrderInSigCls] :: EffectConf -> Bool keyedSenderGenConf :: Lens' EffectConf (Maybe SenderFunctionConf) normalSenderGenConf :: Lens' EffectConf (Maybe SenderFunctionConf) taggedSenderGenConf :: Lens' EffectConf (Maybe SenderFunctionConf) warnFirstOrderInSigCls :: Lens' EffectConf Bool data SenderFunctionConf senderFnName :: Lens' SenderFunctionConf String doesGenerateSenderFnSignature :: Lens' SenderFunctionConf Bool senderFnDoc :: Lens' SenderFunctionConf (Maybe String -> Q (Maybe String)) senderFnArgDoc :: Lens' SenderFunctionConf (Int -> Maybe String -> Q (Maybe String)) senderFnConfs :: Traversal' EffectConf SenderFunctionConf -- | Derive an instance of HFunctor for a type constructor of any -- higher-order kind taking at least two arguments. deriveHFunctor :: (Infinite (Q Type) -> Q Type) -> DataInfo -> Q [Dec] noDeriveHFunctor :: MakeEffectConf -> MakeEffectConf generateLiftInsTypeSynonym :: MakeEffectConf -> MakeEffectConf noGenerateLiftInsTypeSynonym :: MakeEffectConf -> MakeEffectConf generateLiftInsPatternSynonyms :: MakeEffectConf -> MakeEffectConf noGenerateLiftInsPatternSynonyms :: MakeEffectConf -> MakeEffectConf noGenerateNormalSenderFunction :: MakeEffectConf -> MakeEffectConf noGenerateTaggedSenderFunction :: MakeEffectConf -> MakeEffectConf noGenerateKeyedSenderFunction :: MakeEffectConf -> MakeEffectConf suppressFirstOrderInSignatureClassWarning :: MakeEffectConf -> MakeEffectConf noGenerateSenderFunctionSignature :: MakeEffectConf -> MakeEffectConf module Data.Effect.Key.TH makeKeyedEffect :: [Name] -> [Name] -> Q [Dec] changeNormalSenderFnNameFormat :: MakeEffectConf -> MakeEffectConf genEffectKey :: EffectOrder -> Info -> DataInfo -> EffClsInfo -> EffectClassConf -> Q [Dec] removeLastApostrophe :: String -> Maybe String -- | This module provides TemplateHaskell functions to derive an -- instance of HFunctor. module Data.Effect.HFunctor.TH -- | Derive an instance of HFunctor for a type constructor of any -- higher-order kind taking at least two arguments. makeHFunctor :: Name -> Q [Dec] -- | Derive an instance of HFunctor for a type constructor of any -- higher-order kind taking at least two arguments. -- -- Furthermore, you can manually provide type constraints for the -- instance: -- --
-- {-# LANGUAGE BlockArguments #-}
-- import Data.List.Infinite (Infinite ((:<)))
--
-- data Example (g :: Type -> Type) h (f :: Type -> Type) (a :: Type) where
-- Example :: g (h f a) -> Example g h f a
--
-- makeHFunctor' ''Example \(g :< h :< _) -> [t| (Functor $g, HFunctor $h) |]
--
makeHFunctor' :: Name -> (Infinite (Q Type) -> Q Type) -> Q [Dec]