constraints
Constraint manipulation
http://github.com/ekmett/constraints/
| LTS Haskell 24.17: | 0.14.2@rev:1 | 
| Stackage Nightly 2025-10-31: | 0.14.2@rev:1 | 
| Latest on Hackage: | 0.14.2@rev:1 | 
constraints-0.14.2@sha256:381a53e9d5aad937644d13b5c2c4fcc3698aeba2f83945a42100c6324e0ea8e7,2384Module documentation for 0.14.2
Changes
0.14.2 [2024.05.12]
- Re-export Log2fromData.Constraint.Nat.
- Add log2Natandlog2PowtoData.Constraint.Nat.
0.14.1 [2024.04.29]
- Remove an unused dependency on the type-equalitylibrary.
0.14 [2023.10.11]
- Drop support for GHCs older than 8.6.
- The forallfunction inData.Constraint.Forallhas been renamed toforall_, since a future version of GHC will make the use offorallas an identifier an error.
- Implement Data.Constraint.ForallusingQuantifiedConstraints.
- Remove Liftinginstances forErrorTandListT, which were removed intransformers-0.6.*.
- Add a c => Boring (Dict c)instance.
- Add the Data.Constraint.Charmodule, which contains utilities for working withKnownCharconstraints. This module is only available on GHC 9.2 or later.
- Add unsafeAxiomtoData.Constraint.Unsafe.
- Add unsafeSChar,unsafeSNat, andunsafeSSymboltoData.Constraint.Unsafewhen building withbase-4.18(GHC 9.6) or later.
0.13.4 [2022.05.19]
- Correct the CPP introduced in constraints-0.13.3such that it works when building withmtl-2.3.*or later combined withtransformers < 0.6.
0.13.3 [2022.01.31]
- Allow building with transformers-0.6.*andmtl-2.3.*.
0.13.2 [2021.11.10]
- Allow building on GHC HEAD.
0.13.1 [2021.10.31]
- Allow building with GHC 9.2.
0.13 [2021.02.17]
- 
Data.Constraint.Symbolnow reexports theGHC.TypeLits.AppendSymboltype family from recent versions ofbase(or, on old versions ofbase, it defines a backwards-compatibile version ofAppendSymbol). The existing(++)type family forData.Constraint.Symbolis now a synonym forAppendSymbol.This is technically a breaking change, as (++)was previously defined like so:type family (++) :: Symbol -> Symbol -> SymbolThis meant that (++)could be partially applied. However, for compatibility with the way thatAppendSymbolis defined,(++)is now defined like so:type m ++ n = AppendSymbol m nAs a result, (++)can no longer be partially applied.
- 
Make the (++)type family inData.Constraint.Symbolbeinfixr 5.
- 
Add implied :: (a => b) -> (a :- b)toData.Constraint, which converts a quantified constraint into an entailment. This is only available when compiled with GHC 8.6 or later.
0.12 [2020.02.03]
- 
Relax the type signature for divideTimes:-dividesTimes :: (Divides a b, Divides a c) :- Divides a (b * c) +dividesTimes :: Divides a b :- Divides a (b * c)
- 
Simplify the type signature of dividesDef:-dividesDef :: forall a b. Divides a b :- ((a * Div b a) ~ b) +dividesDef :: forall a b. Divides a b :- (Mod b a ~ 0)The original type of diviesDefcan be (partially) recovered by defining it in terms of the newdividesDef:dividesDef' :: forall a b. (1 <= a, Divides a b) :- ((a * Div b a) ~ b) dividesDef' = Sub $ case (dividesDef @a @b, euclideanNat @a @b) of (Sub Dict, Sub Dict) -> Dict
0.11.2 [2019.09.06]
- Depend on the type-equalitycompatibility library so that(:~~:)may be used when compiling this library with GHC 8.0. This avoids having to redefine(:~~:)directly in the internals ofconstraintsitself.
0.11.1 [2019.08.27]
- Make Data.Constraint.Deferrable.UnsatisfiedConstrainta newtype.
0.11 [2019.05.10]
- Introduce a HasDicttype class for types that witness evidence of constraints, such asDict,(:-),Coercion,(:~:),(:~~:), andTypeRep.
- Generalize the types of withDictand(\\)to be polymorphic over anyHasDictinstance.
- Add type (⊢) = (:-).
- Fix unsafe mistakes in the statements of dividesDefandtimesDivinData.Constraint.Nat.
- Make the implementations of MinandMaxreduce on more inputs inData.Constraint.Nat.
- Add minusNatandminusZerofunctions toData.Constraint.Nat.
- Support hashable-1.3.*andsemigroups-0.19.*.
0.10.1 [2018.07.02]
- Allow building with GHC 8.6.
- Add three axioms about (+)and(-)toData.Constraint.Nat.
0.10
- Adapt to the Semigroup–MonoidProposal (introduced inbase-4.11):- Add a Semigroupinstance forDict
- Add the appropriate (:=>)instances involvingSemigroup, and change theClass () (Monoid a)instance toClass (Semigroup a) (Monoid a)whenbaseis recent enough
- Add the appropriate Lifting(2)instances involvingSemigroup
 
- Add a 
- Data.Constraint.Natnow reexports the- Divand- Modtype families from- GHC.TypeLitson- base-4.11or later
- Fix the type signature of maxCommutes
- Export the nomethod ofBottom
- Add NFDatainstances forDictand(:-)
0.9.1
- Correct an improper use of unsafeCoercein the internals ofData.Constraint.NatandData.Constraint.Symbol
- Correctly identify the mismatched types when you defer an unsatisfiable
equality constraint through Data.Constraint.Deferrable
- Re-export the (:~~:)defined inbasefromData.Constraint.Deferredwith GHC 8.2 or later
- Add several new (:=>)instances forBits,Identity,Const,Natural,IO, andWord.
- Modernize some existing Classand(:=>)instances to reflect the fact thatApplicativeis now a superclass ofMonadon recent versions ofbase.
0.9
- Changes to Data.Constraint:- Add strengthen1andstrengthen2
 
- Add 
- Changes to Data.Constraint.Deferrable:- Add a Deferrable ()instance
- The Deferrable (a ~ b)instance now shows theTypeReps ofaandbwhen a type mismatch error is thrown
- Add defer_anddeferEither_, counterparts todeferanddeferEitherwhich do not require proxy arguments
- Enable PolyKinds. This allows theDeferrable (a ~ b)instance to be polykinded on all supported versions of GHC except 7.10, where the kinds must be*due to an old GHC bug
- Introduce a heterogeneous equality type (:~~:), and use it to define aDeferrable (a ~~ b)instance on GHC 8.0 or later
 
- Add a 
- Changes to Data.Constraint.Forall:- Implement ForallFandForallTin terms ofForall
- Add ForallVandInstV(supporting a variable number of parameters)
- Add a forallcombinator
 
- Implement 
- Introduce Data.Constraint.NatandData.Constraint.Symbol, which contain utilities for working withKnownNatandKnownSymbolconstraints, respectively. These modules are only available on GHC 8.0 or later.
0.8
- GHC 8 compatibility
- transformers0.5 compatibility
- binary0.8 compatibility
- Dropped support for GHC 7.6 in favor of a nicer Bottom representation.
0.7
- Found a nicer encoding of the initial object in the category of constraints using a nullary constraint.
0.6.1
- Remove the need for closed type families from the new Forall.
0.6
- Completely redesigned Data.Constraint.Forall. The old design is unsound and can be abused to defineunsafeCoerce! The new design requires closed type families, so this module now requires GHC 7.8+
0.5.1
- Added Data.Constraint.Deferrable.
0.5
- Added Data.Constraint.Lifting.
0.4.1.3
- Acknowledge we actually need at least base 4.5
0.4.1.2
- Restore support for building on older GHCs
0.4.1.1
- Minor documentation fixes.
0.4.1
- Added mapDictandunmapDict.
- Added a lot of documentation.
0.4
- Typeableand- Data. The- Datainstance for- (:-)is a conservative approximation that avoids having to turn (:-) into a cartesian closed category. If it becomes a pain point for users, I know how to do that, and have done so in other libraries – see hask, but I’m hesitant to bring such heavy machinery to bear and it isn’t clear how to do it in a way that is compatible with those other libraries.
0.3.5
- Explicit role annotations
0.3.4.1
- Fixed build failures.
- Fixed an unused import warning on older GHCs.
0.3.4
- Added bottom
