type-eq 0.2.1 → 0.3
raw patch · 4 files changed
+31/−27 lines, 4 filesdep −groupoidsdep −semigroupoids
Dependencies removed: groupoids, semigroupoids
Files
- Type/Eq.hs +19/−14
- Type/Eq/Higher.hs +2/−2
- Type/Eq/Poly.hs +1/−1
- type-eq.cabal +9/−10
Type/Eq.hs view
@@ -7,11 +7,11 @@ {-# OPTIONS_GHC -fno-warn-unused-imports #-} --- | Types and combinators for storing and manipulating type equality evidence.+-- | Types and functions for storing and manipulating type equality evidence. -- -- This module is kind-polymorphic if @PolyKinds@ are available (GHC 7.6+). ----- Notable combinators missing from this module include @applyEq@, @constructorEq@, and @sameOuterEq@.+-- Notable functions missing from this module include @applyEq@, @constructorEq@, and @sameOuterEq@. -- -- See also @"Type.Eq.Higher"@ and @"Type.Eq.Poly"@. @@ -19,11 +19,9 @@ import Control.Category (Category(..)) import Control.Applicative (Applicative) -- for haddock-#ifdef HAVE_DEPENDENCIES --import Control.Category.Product (Tensor(..))-import Data.Groupoid (Groupoid(..))-import Data.Semigroupoid (Semigroupoid(..))-#endif+--import Data.Groupoid (Groupoid(..))+--import Data.Semigroupoid (Semigroupoid(..)) import Data.Typeable hiding (cast) import Type.Eq.Unsafe import Prelude hiding ((.))@@ -31,13 +29,14 @@ -- * Full equality --- | Evidence that type @a@ is the same as type @b@.+-- | Evidence that @a@ is the same type as @b@. -- -- The @'Functor'@, @'Applicative'@, and @'Monad'@ instances of @Maybe@ -- are very useful for working with values of type @Maybe (a :~: b)@. data a :~: b where Eq :: (a ~ b) => a :~: b +-- FIXME ifdef this for 7.8 -- deriving Typeable and PolyKinds don't play well instance Typeable2 (:~:) where typeOf2 = const $ mkTyConApp tyCon []@@ -48,23 +47,22 @@ -- This function compiles with GHC 6.10, but doesn't work. withEq :: (a ~ b => r) -> (a :~: b) -> r withEq x Eq = x--- This doesn't seem to work in 6.10, so for compatibility, we're not going to use it+-- for compatibility, we're not going to use it either instance Category (:~:) where id = idEq (.) = composeEq -#ifdef HAVE_DEPENDENCIES+{- instance Semigroupoid (:~:) where o = composeEq instance Groupoid (:~:) where inv = flipEq-#endif --- would require a dependency on data-lens--- instance Tensor (:~:) where--- a *** b = idEq2 ||$|| a |$| b+instance Tensor (:~:) where+ a *** b = idEq2 ||$|| a |$| b+-} -- | Reflexivity idEq :: a :~: a@@ -123,7 +121,14 @@ -- * Testing for equality -DYNAMIC_EQ(,,:~:,a,b,)+dynamicEq :: (Typeable a, Typeable b) => Maybe (a :~: b)+dynamicEq = gcast idEq++--dynamicInnerEq :: (Typeable (f i), Typeable a) => Maybe (InnerEq i a)+--dynamicOuterEq :: (Tyepable (f i), Typeable a) => Maybe (OuterEq f a)++--data Type a where+-- Type :: Typeable a => Type a -- | Can be implemented by types storing evidence of type equalities, i.e. GADTs. --
Type/Eq/Higher.hs view
@@ -6,7 +6,7 @@ {-# OPTIONS_GHC -fno-warn-unused-imports #-} --- | Types and combinators for storing and manipulating evidence of equality between types of higher kind.+-- | Types and functions for storing and manipulating evidence of equality between types of higher kind. -- -- Available up to @* -> * -> *@. Yell if you need more. @@ -17,7 +17,7 @@ import Type.Eq.Higher.Unsafe import Unsafe.Coerce --- * Additional combinators, kind @*@+-- * Additional functions, kind @*@ -- | Type constructors are generative constructorEq :: f a :~: g b -> f ::~:: g
Type/Eq/Poly.hs view
@@ -6,7 +6,7 @@ {-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-orphans #-} --- | Kind-polymorphic combinators for manipulating type equality evidence.+-- | Kind-polymorphic functions for manipulating type equality evidence. -- -- This module is available only if @PolyKinds@ are available (GHC 7.6+).
type-eq.cabal view
@@ -1,6 +1,6 @@ name: type-eq category: Type System-version: 0.2.1+version: 0.3 author: Gábor Lehel maintainer: Gábor Lehel <illissius@gmail.com> homepage: http://github.com/glehel/type-eq@@ -12,13 +12,13 @@ build-type: Simple synopsis: Type equality evidence you can carry around description:- This package provides types and combinators to store and manipulate evidence of equality between types.+ This package provides types and functions to store and manipulate evidence of equality between types. . To take advantage of kind polymorphism when it is available but not require it, it is split into the following primary modules: .- - @/Type.Eq/@: Types and combinators which can be kind-polymorphic if @PolyKinds@ are available, but are specific to kind @*@ otherwise.+ - @/Type.Eq/@: Types and functions which can be kind-polymorphic if @PolyKinds@ are available, but are specific to kind @*@ otherwise. .- - @/Type.Eq.Higher/@: Kind-monomorphic types and combinators of higher kind, up to @* -> * -> *@.+ - @/Type.Eq.Higher/@: Kind-monomorphic types and functions of higher kind, up to @* -> * -> *@. . - @/Type.Eq.Poly/@: Combinators that require kind polymorphism. This module is only available if @PolyKinds@ are available. .@@ -73,14 +73,13 @@ -- cpp-options: -DHAVE_TYPEABLE -- other-extensions: DeriveDataTypeable --- Ran into dependency problems with 6.10 and 6.12 and didn't feel like dealing with it- if impl(ghc >= 7.0)- cpp-options: -DHAVE_DEPENDENCIES- build-depends:+-- if impl(ghc >= 7.0)+-- cpp-options: -DHAVE_DEPENDENCIES+-- build-depends: -- Semigroupoid- semigroupoids >= 1.0 && < 3.2,+-- semigroupoids >= 1.0 && < 3.1, -- Groupoid- groupoids >= 0.1 && < 3.1+-- groupoids >= 0.1 && < 3.1 -- Tensor -- data-lens >= 2.9 && < 2.11