[commit: base] ghc-generics1: Derive Generic1 instances for Prelude types (1954823)
José Pedro Magalhães
jpm at cs.uu.nl
Wed Jun 6 13:00:03 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : ghc-generics1
http://hackage.haskell.org/trac/ghc/changeset/19548239d748e13338e3ef38d4e9ab0e5c58cda1
>---------------------------------------------------------------
commit 19548239d748e13338e3ef38d4e9ab0e5c58cda1
Author: Jose Pedro Magalhaes <jpm at cs.ox.ac.uk>
Date: Wed Jun 6 11:54:00 2012 +0100
Derive Generic1 instances for Prelude types
>---------------------------------------------------------------
GHC/Generics.hs | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/GHC/Generics.hs b/GHC/Generics.hs
index 2244253..41ac532 100644
--- a/GHC/Generics.hs
+++ b/GHC/Generics.hs
@@ -171,15 +171,14 @@ class Generic1 f where
to1 :: (Rep1 f) a -> f a
-------------------------------------------------------------------------
+--------------------------------------------------------------------------------
-- Derived instances
-------------------------------------------------------------------------
+--------------------------------------------------------------------------------
deriving instance Generic [a]
deriving instance Generic (Maybe a)
deriving instance Generic (Either a b)
deriving instance Generic Bool
deriving instance Generic Ordering
-
deriving instance Generic ()
deriving instance Generic ((,) a b)
deriving instance Generic ((,,) a b c)
@@ -188,6 +187,17 @@ deriving instance Generic ((,,,,) a b c d e)
deriving instance Generic ((,,,,,) a b c d e f)
deriving instance Generic ((,,,,,,) a b c d e f g)
+deriving instance Generic1 []
+-- JPM: These two currently cause the compiler to panic!
+--deriving instance Generic1 Maybe
+--deriving instance Generic1 (Either a)
+deriving instance Generic1 ((,) a)
+deriving instance Generic1 ((,,) a b)
+deriving instance Generic1 ((,,,) a b c)
+deriving instance Generic1 ((,,,,) a b c d)
+deriving instance Generic1 ((,,,,,) a b c d e)
+deriving instance Generic1 ((,,,,,,) a b c d e f)
+
--------------------------------------------------------------------------------
-- Primitive representations
--------------------------------------------------------------------------------
More information about the Cvs-libraries
mailing list