packages feed

dependent-sum 0.3.2.1 → 0.3.2.2

raw patch · 3 files changed

+28/−12 lines, 3 filesdep ~base

Dependency ranges changed: base

Files

dependent-sum.cabal view
@@ -1,5 +1,5 @@ name:                   dependent-sum-version:                0.3.2.1+version:                0.3.2.2 stability:              provisional  cabal-version:          >= 1.6@@ -23,6 +23,14 @@                         This package allows you to define your own                         dependent sum types by using your own \"tag\"                         types.++tested-with:            GHC == 7.0.4,+                        GHC == 7.2.2,+                        GHC == 7.4.2,+                        GHC == 7.6.3,+                        GHC == 7.8.4,+                        GHC == 7.10.1,+                        GHC == 7.11  extra-source-files:     examples/*.hs 
examples/FooGADT.hs view
@@ -1,7 +1,9 @@ {-# LANGUAGE GADTs #-}+{-# LANGUAGE MultiParamTypeClasses #-} module FooGADT where  import Data.Dependent.Sum+import Data.Functor.Identity import Data.GADT.Show import Data.GADT.Compare @@ -21,7 +23,7 @@     geq Qux Qux = Just Refl     geq _   _   = Nothing -instance EqTag Foo where+instance EqTag Foo Identity where     eqTagged Foo Foo = (==)     eqTagged Bar Bar = (==)     eqTagged Baz Baz = (==)@@ -43,7 +45,7 @@          gcompare Qux Qux = GEQ -instance OrdTag Foo where+instance OrdTag Foo Identity where     compareTagged Foo Foo = compare     compareTagged Bar Bar = compare     compareTagged Baz Baz = compare@@ -60,7 +62,7 @@ instance GShow Foo where     gshowsPrec = showsPrec -instance ShowTag Foo where+instance ShowTag Foo Identity where     showTaggedPrec Foo = showsPrec     showTaggedPrec Bar = showsPrec     showTaggedPrec Baz = showsPrec@@ -76,18 +78,23 @@         _     -> []         where (tag, rest) = splitAt 3 str -instance ReadTag Foo where+instance ReadTag Foo Identity where     readTaggedPrec Foo = readsPrec     readTaggedPrec Bar = readsPrec     readTaggedPrec Baz = readsPrec     readTaggedPrec Qux = readsPrec +foo :: Double -> DSum Foo Identity+foo x = Foo ==> x -foo x = Foo :=> x-bar x = Bar :=> x-baz x = Baz :=> x-qux x = Qux :=> x+bar :: Int -> DSum Foo Identity+bar x = Bar ==> x +baz :: String -> DSum Foo Identity+baz x = Baz ==> x++qux :: Double -> DSum Foo Identity+qux x = Qux ==> x  xs = [foo pi, bar 100, baz "hello world", qux (exp 1)] xs' = read (show xs) `asTypeOf` xs
src/Data/GADT/Compare.hs view
@@ -10,6 +10,7 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif+{-# LANGUAGE ScopedTypeVariables #-}  module Data.GADT.Compare     ( module Data.GADT.Compare@@ -56,8 +57,8 @@ instance GRead ((:=) a) where     greadsPrec p s = readsPrec p s >>= f         where-            f :: (x := x, String) -> [(forall b. (forall a. x := a -> b) -> b, String)]-            f (Refl, rest) = return (\x -> x Refl, rest)+            f :: forall x. (x := x, String) -> [(forall b. (forall a. x := a -> b) -> b, String)]+            f (Refl, rest) = return ((\x -> x Refl) :: forall b. (forall a. x := a -> b) -> b, rest)  -- |A class for type-contexts which contain enough information -- to (at least in some cases) decide the equality of types @@ -91,7 +92,7 @@ defaultNeq x y = isNothing (geq x y)  instance GEq ((:=) a) where-    geq Refl Refl = Just Refl+    geq (Refl :: a := b) (Refl :: a := c) = Just (Refl :: b := c)  -- This instance seems nice, but it's simply not right: --