grisette-0.9.0.0: Symbolic evaluation as a library
Copyright(c) Sirui Lu 2024
LicenseBSD-3-Clause (see the LICENSE file)
Maintainersiruilu@cs.washington.edu
StabilityExperimental
PortabilityGHC only
Safe HaskellSafe-Inferred
LanguageHaskell2010

Grisette.Internal.TH.DerivePredefined

Description

 
Synopsis

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:

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.