Skip to content

Commit

Permalink
♻️ Rename deriveGADT back to derive
Browse files Browse the repository at this point in the history
  • Loading branch information
lsrcz committed Jan 20, 2025
1 parent 25349f2 commit a1b2a6f
Show file tree
Hide file tree
Showing 54 changed files with 696 additions and 691 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ and this project adheres to
guards. ([#283](https://github.com/lsrcz/grisette/pull/283))
- `EvalModeConvertible` is now reflexive.
([#284](https://github.com/lsrcz/grisette/pull/284))
- \[Breaking\] Renamed `deriveGADT` to `derive`.
([#286](https://github.com/lsrcz/grisette/pull/286))

### Fixed

Expand Down
4 changes: 2 additions & 2 deletions examples/basic/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ type IntUExpr = UExpr SymInteger

type BoolUExpr = UExpr SymBool

-- The `deriveGADT` and `makeSmartCtor` functions are provided by Grisette
-- The `derive` and `makeSmartCtor` functions are provided by Grisette
-- to automatically derive some instances and construct some smart constructors
-- for the GADT.
--
-- The GADT will then be fully compatible with Grisette library. And we will see
-- their usage in the following code.
deriveGADT [''Expr] basicClasses0
derive [''Expr] basicClasses0
makeSmartCtor ''Expr

-- Here we construct some symbolic expressions.
Expand Down
60 changes: 30 additions & 30 deletions grisette.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -162,36 +162,36 @@ library
Grisette.Internal.TH.Ctor.Common
Grisette.Internal.TH.Ctor.SmartConstructor
Grisette.Internal.TH.Ctor.UnifiedConstructor
Grisette.Internal.TH.GADT.BinaryOpCommon
Grisette.Internal.TH.GADT.Common
Grisette.Internal.TH.GADT.ConvertOpCommon
Grisette.Internal.TH.GADT.DeriveAllSyms
Grisette.Internal.TH.GADT.DeriveBinary
Grisette.Internal.TH.GADT.DeriveCereal
Grisette.Internal.TH.GADT.DeriveEq
Grisette.Internal.TH.GADT.DeriveEvalSym
Grisette.Internal.TH.GADT.DeriveExtractSym
Grisette.Internal.TH.GADT.DeriveGADT
Grisette.Internal.TH.GADT.DeriveHashable
Grisette.Internal.TH.GADT.DeriveMergeable
Grisette.Internal.TH.GADT.DeriveNFData
Grisette.Internal.TH.GADT.DeriveOrd
Grisette.Internal.TH.GADT.DerivePPrint
Grisette.Internal.TH.GADT.DeriveSerial
Grisette.Internal.TH.GADT.DeriveShow
Grisette.Internal.TH.GADT.DeriveSimpleMergeable
Grisette.Internal.TH.GADT.DeriveSubstSym
Grisette.Internal.TH.GADT.DeriveSymEq
Grisette.Internal.TH.GADT.DeriveSymOrd
Grisette.Internal.TH.GADT.DeriveToCon
Grisette.Internal.TH.GADT.DeriveToSym
Grisette.Internal.TH.GADT.DeriveUnifiedSimpleMergeable
Grisette.Internal.TH.GADT.DeriveUnifiedSymEq
Grisette.Internal.TH.GADT.DeriveUnifiedSymOrd
Grisette.Internal.TH.GADT.SerializeCommon
Grisette.Internal.TH.GADT.ShowPPrintCommon
Grisette.Internal.TH.GADT.UnaryOpCommon
Grisette.Internal.TH.GADT.UnifiedOpCommon
Grisette.Internal.TH.Derivation.BinaryOpCommon
Grisette.Internal.TH.Derivation.Common
Grisette.Internal.TH.Derivation.ConvertOpCommon
Grisette.Internal.TH.Derivation.Derive
Grisette.Internal.TH.Derivation.DeriveAllSyms
Grisette.Internal.TH.Derivation.DeriveBinary
Grisette.Internal.TH.Derivation.DeriveCereal
Grisette.Internal.TH.Derivation.DeriveEq
Grisette.Internal.TH.Derivation.DeriveEvalSym
Grisette.Internal.TH.Derivation.DeriveExtractSym
Grisette.Internal.TH.Derivation.DeriveHashable
Grisette.Internal.TH.Derivation.DeriveMergeable
Grisette.Internal.TH.Derivation.DeriveNFData
Grisette.Internal.TH.Derivation.DeriveOrd
Grisette.Internal.TH.Derivation.DerivePPrint
Grisette.Internal.TH.Derivation.DeriveSerial
Grisette.Internal.TH.Derivation.DeriveShow
Grisette.Internal.TH.Derivation.DeriveSimpleMergeable
Grisette.Internal.TH.Derivation.DeriveSubstSym
Grisette.Internal.TH.Derivation.DeriveSymEq
Grisette.Internal.TH.Derivation.DeriveSymOrd
Grisette.Internal.TH.Derivation.DeriveToCon
Grisette.Internal.TH.Derivation.DeriveToSym
Grisette.Internal.TH.Derivation.DeriveUnifiedSimpleMergeable
Grisette.Internal.TH.Derivation.DeriveUnifiedSymEq
Grisette.Internal.TH.Derivation.DeriveUnifiedSymOrd
Grisette.Internal.TH.Derivation.SerializeCommon
Grisette.Internal.TH.Derivation.ShowPPrintCommon
Grisette.Internal.TH.Derivation.UnaryOpCommon
Grisette.Internal.TH.Derivation.UnifiedOpCommon
Grisette.Internal.TH.Util
Grisette.Internal.Unified.BaseConstraint
Grisette.Internal.Unified.BaseMonad
Expand Down
6 changes: 3 additions & 3 deletions src/Grisette/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -558,13 +558,13 @@ module Grisette.Core
-- deriving (Mergeable) via (Default X)
-- :}
--
-- Grisette also provide 'Grisette.deriveGADT' template haskell procedure to
-- Grisette also provide 'Grisette.derive' template haskell procedure to
-- derive all the instances for the classes that are relevant. This include
-- 'Show', 'Mergeable', 'Mergeable1', etc.
--
-- >>> :{
-- data X = X SymInteger Integer
-- deriveGADT [''X] [''Show, ''Mergeable]
-- derive [''X] [''Show, ''Mergeable]
-- :}
--
-- Having the 'Mergeable' instance allows you to use the 'Union' type to
Expand Down Expand Up @@ -595,7 +595,7 @@ module Grisette.Core
-- >>> import Control.Monad.Except
-- >>> :{
-- data Error = Fail
-- deriveGADT [''Error] allClasses0
-- derive [''Error] allClasses0
-- :}
--
-- >>> mrgIf "a" (throwError Fail) (return "x") :: ExceptT Error Union SymInteger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ import Grisette.Internal.SymPrim.SymGeneralFun (type (-~>) (SymGeneralFun))
import Grisette.Internal.SymPrim.SymInteger (SymInteger (SymInteger))
import Grisette.Internal.SymPrim.SymTabularFun (type (=~>) (SymTabularFun))
import Grisette.Internal.SymPrim.TabularFun (type (=->) (TabularFun))
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)

#define CONCRETE_EVALUATESYM(type) \
instance EvalSym type where \
Expand Down Expand Up @@ -184,15 +184,15 @@ instance (ValidFP eb sb) => EvalSym (SymFP eb sb) where
evalSym fillDefault model (SymFP t) =
SymFP $ evalTerm fillDefault model HS.empty t

deriveGADT
derive
[ ''(),
''AssertionError,
''VerificationConditions,
''NotRepresentableFPError
]
[''EvalSym]

deriveGADT
derive
[ ''Either,
''(,),
''(,,),
Expand All @@ -211,7 +211,7 @@ deriveGADT
]
[''EvalSym, ''EvalSym1, ''EvalSym2]

deriveGADT
derive
[ ''[],
''Maybe,
''Identity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ import Grisette.Internal.SymPrim.SymGeneralFun (type (-~>) (SymGeneralFun))
import Grisette.Internal.SymPrim.SymInteger (SymInteger (SymInteger))
import Grisette.Internal.SymPrim.SymTabularFun (type (=~>) (SymTabularFun))
import Grisette.Internal.SymPrim.TabularFun (type (=->) (TabularFun))
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)

-- $setup
-- >>> import Grisette.Core
Expand Down Expand Up @@ -212,15 +212,15 @@ instance (ValidFP eb fb) => ExtractSym (SymFP eb fb) where
Left HRefl -> SymbolSet <$> extractTerm HS.empty t
Right HRefl -> SymbolSet <$> extractTerm HS.empty t

deriveGADT
derive
[ ''(),
''AssertionError,
''VerificationConditions,
''NotRepresentableFPError
]
[''ExtractSym]

deriveGADT
derive
[ ''Either,
''(,),
''(,,),
Expand All @@ -239,7 +239,7 @@ deriveGADT
]
[''ExtractSym, ''ExtractSym1, ''ExtractSym2]

deriveGADT
derive
[ ''[],
''Maybe,
''Identity,
Expand Down
10 changes: 5 additions & 5 deletions src/Grisette/Internal/Internal/Impl/Core/Data/Class/Mergeable.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ import Grisette.Internal.SymPrim.SymGeneralFun (type (-~>))
import Grisette.Internal.SymPrim.SymInteger (SymInteger)
import Grisette.Internal.SymPrim.SymTabularFun (type (=~>))
import Grisette.Internal.SymPrim.TabularFun (type (=->))
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)
import Unsafe.Coerce (unsafeCoerce)

#define CONCRETE_ORD_MERGEABLE(type) \
Expand Down Expand Up @@ -276,13 +276,13 @@ instance Mergeable1 [] where
instance Mergeable () where
rootStrategy = SimpleStrategy $ \_ t _ -> t

deriveGADT
derive
[ ''Either,
''(,)
]
[''Mergeable, ''Mergeable1, ''Mergeable2]

deriveGADT
derive
[ ''(,,),
''(,,,),
''(,,,,),
Expand All @@ -299,7 +299,7 @@ deriveGADT
]
[''Mergeable, ''Mergeable1, ''Mergeable2, ''Mergeable3]

deriveGADT
derive
[ ''Maybe,
''Identity,
''Monoid.Dual,
Expand All @@ -317,7 +317,7 @@ deriveGADT
]
[''Mergeable, ''Mergeable1]

deriveGADT
derive
[ ''AssertionError,
''VerificationConditions,
''NotRepresentableFPError,
Expand Down
8 changes: 4 additions & 4 deletions src/Grisette/Internal/Internal/Impl/Core/Data/Class/PPrint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ import Grisette.Internal.SymPrim.SymGeneralFun (type (-~>) (SymGeneralFun))
import Grisette.Internal.SymPrim.SymInteger (SymInteger (SymInteger))
import Grisette.Internal.SymPrim.SymTabularFun (type (=~>) (SymTabularFun))
import Grisette.Internal.SymPrim.TabularFun (type (=->))
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)

#define FORMAT_SIMPLE(type) \
instance PPrint type where pformatPrec = viaShowsPrec showsPrec
Expand Down Expand Up @@ -208,15 +208,15 @@ FORMAT_SYM_FUN(-~>, SymGeneralFun)
instance (ValidFP eb sb) => PPrint (SymFP eb sb) where
pformat (SymFP t) = prettyPrintTerm t

deriveGADT
derive
[ ''(),
''AssertionError,
''VerificationConditions,
''NotRepresentableFPError
]
[''PPrint]

deriveGADT
derive
[ ''Either,
''(,),
''(,,),
Expand All @@ -235,7 +235,7 @@ deriveGADT
]
[''PPrint, ''PPrint1, ''PPrint2]

deriveGADT
derive
[ ''Maybe,
''Monoid.Dual,
''Monoid.First,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ import Grisette.Internal.SymPrim.SymFP (SymFP, SymFPRoundingMode)
import Grisette.Internal.SymPrim.SymGeneralFun (type (-~>))
import Grisette.Internal.SymPrim.SymInteger (SymInteger)
import Grisette.Internal.SymPrim.SymTabularFun (type (=~>))
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)

-- $setup
-- >>> import Grisette.Core
-- >>> import Grisette.SymPrim
-- >>> import Control.Monad.Identity

deriveGADT
derive
[ ''(,),
''(,,),
''(,,,),
Expand All @@ -112,7 +112,7 @@ deriveGADT
]
[''SimpleMergeable, ''SimpleMergeable1, ''SimpleMergeable2]

deriveGADT
derive
[ ''Identity,
''Monoid.Dual,
''Monoid.Sum,
Expand All @@ -121,7 +121,7 @@ deriveGADT
]
[''SimpleMergeable, ''SimpleMergeable1]

deriveGADT
derive
[''(), ''AssertionError]
[''SimpleMergeable]

Expand Down
4 changes: 2 additions & 2 deletions src/Grisette/Internal/Internal/Impl/Core/Data/Class/Solver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ import qualified Data.Serialize as Cereal
import Grisette.Internal.Internal.Decl.Core.Data.Class.PPrint (PPrint)
import Grisette.Internal.Internal.Decl.Core.Data.Class.Solver (SolvingFailure)
import Grisette.Internal.Internal.Impl.Core.Data.Class.PPrint ()
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)

-- $setup
-- >>> import Grisette
-- >>> import Grisette.Core
-- >>> import Grisette.SymPrim
-- >>> import Grisette.Backend

deriveGADT
derive
[''SolvingFailure]
[ ''Show,
''Eq,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ import Grisette.Internal.SymPrim.SymGeneralFun (type (-~>) (SymGeneralFun))
import Grisette.Internal.SymPrim.SymInteger (SymInteger (SymInteger))
import Grisette.Internal.SymPrim.SymTabularFun (type (=~>) (SymTabularFun))
import Grisette.Internal.SymPrim.TabularFun (type (=->) (TabularFun))
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)

#define CONCRETE_SUBSTITUTESYM(type) \
instance SubstSym type where \
Expand Down Expand Up @@ -181,15 +181,15 @@ SUBSTITUTE_SYM_SIMPLE(SymFPRoundingMode)
instance (ValidFP eb sb) => SubstSym (SymFP eb sb) where
substSym sym v (SymFP t) = SymFP $ substTerm sym (underlyingTerm v) HS.empty t

deriveGADT
derive
[ ''(),
''AssertionError,
''VerificationConditions,
''NotRepresentableFPError
]
[''SubstSym]

deriveGADT
derive
[ ''Either,
''(,),
''(,,),
Expand All @@ -208,7 +208,7 @@ deriveGADT
]
[''SubstSym, ''SubstSym1, ''SubstSym2]

deriveGADT
derive
[ ''[],
''Maybe,
''Identity,
Expand Down
8 changes: 4 additions & 4 deletions src/Grisette/Internal/Internal/Impl/Core/Data/Class/SymEq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ import Grisette.Internal.SymPrim.SymFP
SymFPRoundingMode (SymFPRoundingMode),
)
import Grisette.Internal.SymPrim.SymInteger (SymInteger (SymInteger))
import Grisette.Internal.TH.GADT.DeriveGADT (deriveGADT)
import Grisette.Internal.TH.Derivation.Derive (derive)

#define CONCRETE_SEQ(type) \
instance SymEq type where \
Expand Down Expand Up @@ -183,15 +183,15 @@ instance (ValidFP eb sb) => SymEq (SymFP eb sb) where
(SymFP l) .== (SymFP r) = SymBool $ pevalEqTerm l r
{-# INLINE (.==) #-}

deriveGADT
derive
[ ''(),
''AssertionError,
''VerificationConditions,
''NotRepresentableFPError
]
[''SymEq]

deriveGADT
derive
[ ''Either,
''(,),
''(,,),
Expand All @@ -210,7 +210,7 @@ deriveGADT
]
[''SymEq, ''SymEq1, ''SymEq2]

deriveGADT
derive
[ ''[],
''Maybe,
''Identity,
Expand Down
Loading

0 comments on commit a1b2a6f

Please sign in to comment.