Use functional dependencies.
[ghc-prim.git] / GHC / Generics.hs
index 7f5b86f..c1b962d 100644 (file)
@@ -20,6 +20,7 @@ data (:*:) a b = a :*: b
 {-# OPTIONS_GHC -XTypeSynonymInstances   #-}
 {-# OPTIONS_GHC -XTypeOperators          #-}
 {-# OPTIONS_GHC -XKindSignatures         #-}
+{-# OPTIONS_GHC -XFunctionalDependencies #-}
 
 module GHC.Generics  (
   -- * Generic representation types
@@ -45,7 +46,7 @@ module GHC.Generics  (
 -}
   ) where
   
-import {-# SOURCE #-} GHC.Types
+import {-# SOURCE #-} GHC.Types -- ([](..), Int, Char, Bool(..))
 
 --------------------------------------------------------------------------------
 -- Representation types
@@ -171,14 +172,14 @@ data Associativity =  LeftAssociative
 
 
 -- | Representable types of kind *
-class Representable0 a rep where
+class Representable0 a rep | a -> rep where
   -- | Convert from the datatype to its representation
   from0  :: a -> rep x
   -- | Convert from the representation to the datatype
   to0    :: rep x -> a
 
 -- | Representable types of kind * -> *
-class Representable1 f rep where
+class Representable1 f rep | f -> rep where
   -- | Convert from the datatype to its representation
   from1  :: f a -> rep a
   -- | Convert from the representation to the datatype