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 | Safe-Inferred |
Language | Haskell2010 |
Grisette.Internal.TH.DerivePredefined
Description
Documentation
derivePredefined :: Name -> Name -> Q [Dec] Source #
Derive instances for a type with the given name, with the predefined strategy.
derivePredefinedMultipleClasses :: [Name] -> Name -> Q [Dec] Source #
Derive instances for a type with the given name, with the predefined strategy.
Multiple classes can be derived at once.
derive :: Name -> [Name] -> Q [Dec] Source #
Derive specified classes for a type with the given name.
Support the same set of classes as deriveAll
.
deriveAll :: Name -> Q [Dec] Source #
Derive all classes related to Grisette for a type with the given name.
Classes that are be derived by this procedure are:
Generic
Show
Eq
Ord
Lift
NFData
Hashable
Serial
AllSyms
EvalSym
ExtractSym
PPrint
Mergeable
SymEq
SymOrd
SubstSym
ToCon
ToSym
UnifiedSymEq
UnifiedSymOrd
Ord
isn't valid for all types (symbolic-only types), so it may be necessary
to exclude it.
deriveAll
needs the following language extensions:
- DeriveAnyClass
- DeriveGeneric
- DeriveLift
- DerivingVia
- FlexibleContexts
- FlexibleInstances
- MonoLocalBinds
- MultiParamTypeClasses
- ScopedTypeVariables
- StandaloneDeriving
- TemplateHaskell
- TypeApplications
- UndecidableInstances
Deriving for a newtype may also need
- GeneralizedNewtypeDeriving
You may get warnings if you don't have the following extensions:
- TypeOperators
It also requires that the Default
data
constructor is visible.
You may get strange errors if you only import
Default
type but not the data constructor.
deriveAllExcept :: Name -> [Name] -> Q [Dec] Source #
Derive all classes related to Grisette for a type with the given name, except for the given classes.
Excluding Ord
or SymOrd
will also exclude UnifiedSymOrd
.
Excluding Eq
or SymEq
will also exclude UnifiedSymEq
.