diff options
author | Jose Pedro Magalhaes <jpm@cs.uu.nl> | 2011-04-29 08:46:08 +0200 |
---|---|---|
committer | Jose Pedro Magalhaes <jpm@cs.uu.nl> | 2011-04-29 08:46:08 +0200 |
commit | 4c990ccacd5c78b7f91a0981ce70ee352dff155c (patch) | |
tree | 564ed41118234dd1b07ef17afa19dc3b15d674b5 /libraries/base/GHC/Int.hs | |
parent | 471bcc556c93ef2da12890bece7d526f30a9f3ed (diff) | |
download | haskell-4c990ccacd5c78b7f91a0981ce70ee352dff155c.tar.gz |
Add instances for basic types of the new generic deriving mechanism.
Diffstat (limited to 'libraries/base/GHC/Int.hs')
-rw-r--r-- | libraries/base/GHC/Int.hs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libraries/base/GHC/Int.hs b/libraries/base/GHC/Int.hs index 05d10c580b..bafa7f040f 100644 --- a/libraries/base/GHC/Int.hs +++ b/libraries/base/GHC/Int.hs @@ -1,4 +1,5 @@ -{-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, MagicHash #-} +{-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, MagicHash, + StandaloneDeriving #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | @@ -41,6 +42,8 @@ import GHC.Err import GHC.Word hiding (uncheckedShiftL64#, uncheckedShiftRL64#) import GHC.Show import GHC.Float () -- for RealFrac methods +-- For defining instances for the new generic deriving mechanism +import GHC.Generics (Arity(..), Associativity(..), Fixity(..)) ------------------------------------------------------------------------ -- type Int8 @@ -907,3 +910,26 @@ instance Ix Int64 where range (m,n) = [m..n] unsafeIndex (m,_) i = fromIntegral i - fromIntegral m inRange (m,n) i = m <= i && i <= n + +------------------------------------------------------------------------ +-- Generic deriving +------------------------------------------------------------------------ + +-- We need instances for some basic datatypes, but some of those use Int, +-- so we have to put the instances here + +deriving instance Eq Arity +deriving instance Eq Associativity +deriving instance Eq Fixity + +deriving instance Ord Arity +deriving instance Ord Associativity +deriving instance Ord Fixity + +deriving instance Read Arity +deriving instance Read Associativity +deriving instance Read Fixity + +deriving instance Show Arity +deriving instance Show Associativity +deriving instance Show Fixity |