Copyright | (c) 2010-2011 Patrick Bahr (c) 2023 Yamada Ryo |
---|---|
License | MPL-2.0 (see the file LICENSE) |
Maintainer | ymdfield@outlook.jp |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- deriveHFunctor :: DataInfo flag -> Q [Dec]
- data DataInfo flag = DataInfo {
- dataCxt :: Cxt
- dataName :: Name
- dataTyVars :: [TyVarBndr flag]
- dataCons :: [Con]
- dataDerivings :: [DerivClause]
- abstractNewtype :: Info -> Maybe (DataInfo ())
- infoToDataD :: DataInfo () -> Dec
- normalCon :: Con -> (Name, [StrictType], Maybe Type)
- normalConExp :: Con -> Q (Name, [Type], Maybe Type)
- containsType' :: Type -> Type -> [Int]
- getBinaryFArg :: Type -> Maybe Type -> Type
- mkInstanceD :: Cxt -> Type -> [Dec] -> Dec
- newNames :: Int -> String -> Q [Name]
- iter :: (Eq t, Num t, Quote m) => t -> m Exp -> m Exp -> m Exp
- tyVarName :: TyVarBndr a -> Name
Documentation
A reified information of a datatype.
DataInfo | |
|
abstractNewtype :: Info -> Maybe (DataInfo ()) Source #
This function abstracts away newtype
declaration, it turns them into
data
declarations.
infoToDataD :: DataInfo () -> Dec Source #
Convert the reified information of the datatype to a definition.
normalCon :: Con -> (Name, [StrictType], Maybe Type) Source #
This function provides the name and the arity of the given data constructor, and if it is a GADT also its type.
getBinaryFArg :: Type -> Maybe Type -> Type Source #
Auxiliary function to extract the first argument of a binary type
application (the second argument of this function). If the second
argument is Nothing
or not of the right shape, the first argument
is returned as a default.