summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Either.hs
diff options
context:
space:
mode:
authorRichard Eisenberg <eir@cis.upenn.edu>2013-10-20 23:43:16 -0400
committerRichard Eisenberg <eir@seas.upenn.edu>2013-10-28 13:15:20 -0400
commiteb6725b48dae167ae8197f7b12eae9d0728fc5be (patch)
tree03f450e8b82b32b3a062bf20daa6e93a0a94deff /libraries/base/Data/Either.hs
parent64296b4d3d0602d5b85d5ce0190141ae55293c25 (diff)
downloadhaskell-eb6725b48dae167ae8197f7b12eae9d0728fc5be.tar.gz
Name changes and addition of gcastWith and (==) to Data.Type.Equality.
For more info, see http://ghc.haskell.org/trac/ghc/wiki/TypeLevelNamingIssues
Diffstat (limited to 'libraries/base/Data/Either.hs')
-rw-r--r--libraries/base/Data/Either.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/libraries/base/Data/Either.hs b/libraries/base/Data/Either.hs
index b494e265fb..c0574d5388 100644
--- a/libraries/base/Data/Either.hs
+++ b/libraries/base/Data/Either.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-}
+{-# LANGUAGE DataKinds, TypeFamilies, TypeOperators, UndecidableInstances #-}
-----------------------------------------------------------------------------
-- |
@@ -31,6 +32,7 @@ import GHC.Show
import GHC.Read
import Data.Typeable
+import Data.Type.Equality
{-
-- just for testing
@@ -103,6 +105,13 @@ isRight :: Either a b -> Bool
isRight (Left _) = False
isRight (Right _) = True
+-- instance for the == Boolean type-level equality operator
+type family EqEither a b where
+ EqEither (Left x) (Left y) = x == y
+ EqEither (Right x) (Right y) = x == y
+ EqEither a b = False
+type instance a == b = EqEither a b
+
{-
{--------------------------------------------------------------------
Testing