Copyright | (c) Sirui Lu 2024 |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | siruilu@cs.washington.edu |
Stability | Experimental |
Portability | GHC only |
Safe Haskell | None |
Language | Haskell2010 |
Grisette.Internal.TH.Derivation.Common
Description
Synopsis
- data CheckArgsResult = CheckArgsResult {
- constructors :: [ConstructorInfo]
- keptVars :: [(Type, Kind)]
- argVars :: [(Type, Kind)]
- checkArgs :: String -> Int -> Name -> Bool -> Int -> Q CheckArgsResult
- ctxForVar :: [Type] -> Type -> Kind -> Q (Maybe Pred)
- data EvalModeConfig
- data DeriveConfig = DeriveConfig {}
- extraEvalModeConstraint :: Name -> Name -> [(Type, Kind)] -> (Int, EvalModeConfig) -> Q [Pred]
- extraBitSizeConstraint :: Name -> Name -> [(Type, Kind)] -> Int -> Q [Pred]
- extraFpBitSizeConstraint :: Name -> Name -> [(Type, Kind)] -> (Int, Int) -> Q [Pred]
- extraExtraMergeableConstraint :: DeriveConfig -> [ConstructorInfo] -> [(Type, Kind)] -> Q [Pred]
- extraConstraint :: DeriveConfig -> Name -> Name -> [(Type, Kind)] -> [(Type, Kind)] -> [ConstructorInfo] -> Q [Pred]
- specializeResult :: [(Int, EvalModeTag)] -> CheckArgsResult -> Q CheckArgsResult
- evalModeSpecializeList :: DeriveConfig -> [(Int, EvalModeTag)]
- isVarUsedInFields :: CheckArgsResult -> Name -> Bool
- freshenCheckArgsResult :: Bool -> CheckArgsResult -> Q CheckArgsResult
Documentation
data CheckArgsResult Source #
Result of checkArgs
for a data type.
Constructors
CheckArgsResult | |
Fields
|
checkArgs :: String -> Int -> Name -> Bool -> Int -> Q CheckArgsResult Source #
Check if the number of type parameters is valid for a data type, and return new names for the type variables, split into kept and arg parts.
ctxForVar :: [Type] -> Type -> Kind -> Q (Maybe Pred) Source #
Generate a context for a variable in a GADT.
data EvalModeConfig Source #
Configuration for constraints for evaluation modes tag.
EvalModeConstraints
specifies a list of constraints for the tag, for example, we may useEvalModeBase
andEvalModeBV
to specify that the evaluation mode must support both base (boolean and data types) and bit vectors. This should be used when the data type uses bit vectors.EvalModeSpecified
specifies a that an evaluation mode tag should be specialized to a specific tag for all the instances.
Constructors
EvalModeConstraints [Name] | |
EvalModeSpecified EvalModeTag |
data DeriveConfig Source #
Configuration for deriving instances for a data type.
Constructors
DeriveConfig | |
Fields |
Instances
Monoid DeriveConfig Source # | |
Defined in Grisette.Internal.TH.Derivation.Common Methods mempty :: DeriveConfig # mappend :: DeriveConfig -> DeriveConfig -> DeriveConfig # mconcat :: [DeriveConfig] -> DeriveConfig # | |
Semigroup DeriveConfig Source # | |
Defined in Grisette.Internal.TH.Derivation.Common Methods (<>) :: DeriveConfig -> DeriveConfig -> DeriveConfig # sconcat :: NonEmpty DeriveConfig -> DeriveConfig # stimes :: Integral b => b -> DeriveConfig -> DeriveConfig # |
extraEvalModeConstraint :: Name -> Name -> [(Type, Kind)] -> (Int, EvalModeConfig) -> Q [Pred] Source #
Generate extra constraints for evaluation modes.
extraBitSizeConstraint :: Name -> Name -> [(Type, Kind)] -> Int -> Q [Pred] Source #
Generate extra constraints for bit vectors.
extraFpBitSizeConstraint :: Name -> Name -> [(Type, Kind)] -> (Int, Int) -> Q [Pred] Source #
Generate extra constraints for floating point exponents and significands.
extraExtraMergeableConstraint :: DeriveConfig -> [ConstructorInfo] -> [(Type, Kind)] -> Q [Pred] Source #
Generate extra constraints for Mergeable
instances.
extraConstraint :: DeriveConfig -> Name -> Name -> [(Type, Kind)] -> [(Type, Kind)] -> [ConstructorInfo] -> Q [Pred] Source #
Generate extra constraints for a data type.
specializeResult :: [(Int, EvalModeTag)] -> CheckArgsResult -> Q CheckArgsResult Source #
Specialize the evaluation mode tags for the CheckArgsResult
.
evalModeSpecializeList :: DeriveConfig -> [(Int, EvalModeTag)] Source #
Get all the evaluation modes to specialize in the DeriveConfig
.
isVarUsedInFields :: CheckArgsResult -> Name -> Bool Source #
Check if a variable is used in the fields of a constructor.
freshenCheckArgsResult :: Bool -> CheckArgsResult -> Q CheckArgsResult Source #
Freshen the type variables in the CheckArgsResult
.