constraints 0.1 → 0.2
raw patch · 3 files changed
+19/−4 lines, 3 filesdep +ghc-primdep +newtypedep ~base
Dependencies added: ghc-prim, newtype
Dependency ranges changed: base
Files
- Data/Constraint.hs +5/−2
- Data/Constraint/Unsafe.hs +9/−0
- constraints.cabal +5/−2
Data/Constraint.hs view
@@ -8,14 +8,16 @@ {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeOperators #-}+{-# LANGUAGE Trustworthy #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE GADTs #-}-{-# LANGUAGE Safe #-} module Data.Constraint (+ -- * Constraints+ Constraint -- * Dictionary- Dict(Dict)+ , Dict(Dict) -- * Entailment , (:-)(Sub) , (\\)@@ -33,6 +35,7 @@ import Data.Monoid import Data.Complex import Data.Ratio+import GHC.Prim (Constraint) -- | Capture a dictionary for a given constraint data Dict :: Constraint -> * where
Data/Constraint/Unsafe.hs view
@@ -10,6 +10,8 @@ module Data.Constraint.Unsafe ( evil+ , derive+ , underive -- * Sugar , applicative , alternative@@ -17,11 +19,18 @@ import Control.Applicative import Control.Monad+import Control.Newtype import Data.Constraint import Unsafe.Coerce evil :: a :- b evil = unsafeCoerce refl++derive :: Newtype n o => (o -> n) -> t o :- t n+derive _ = evil++underive :: Newtype n o => (o -> n) -> t n :- t o+underive _ = evil applicative :: forall m a. Monad m => (Applicative m => m a) -> m a applicative m = m \\ trans (evil :: Applicative (WrappedMonad m) :- Applicative m) ins
constraints.cabal view
@@ -1,6 +1,6 @@ name: constraints category: Constraints-version: 0.1+version: 0.2 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -31,7 +31,10 @@ Rank2Types, GADTs - build-depends: base >= 4.4 && < 5+ build-depends: + base >= 4.4 && < 5,+ newtype >= 0.2 && < 0.3,+ ghc-prim exposed-modules: Data.Constraint Data.Constraint.Forall