Commit 3b55ede1 authored by nfrisby's avatar nfrisby Committed by jpm@cs.ox.ac.uk

Update output for generics

parent 8d2617a2
......@@ -8,20 +8,15 @@ import GHC.Generics (Generic)
-- We should be able to generate a generic representation for these types
data A
deriving Generic
data A deriving Generic
data B a
deriving Generic
data B a deriving Generic
data C = C0 | C1
deriving Generic
data C = C0 | C1 deriving Generic
data D a = D0 | D1 { d11 :: a, d12 :: (D a) }
deriving Generic
data D a = D0 | D1 { d11 :: a, d12 :: (D a) } deriving Generic
data (:*:) a b = a :*: b
deriving Generic
data (:*:) a b = a :*: b deriving Generic
data family F a
data instance F Int = FInt deriving Generic
data instance F Int = FInt deriving Generic
......@@ -7,18 +7,27 @@ import GHC.Generics (Generic, Generic1)
-- We should be able to generate a generic representation for these types
data A a
deriving Generic1
data A a deriving Generic1
data B a = B0 | B1
deriving Generic1
data B a = B0 | B1 deriving Generic1
data C a = C0 | C1 { c11 :: a, c12 :: (C a) }
deriving (Generic, Generic1)
data D a = D (Either Int a) deriving Generic1
data D a = D (Either Int a) deriving Generic1
data E a = E (Either Int (E a)) deriving Generic1
data E a = E (Either Int (E a)) deriving Generic1
data (:*:) a b = a :*: b
deriving (Generic, Generic1)
data F c b a = F (c, b, a) deriving Generic1
data G c b a = G [(c, c, c, c, b, a)] deriving (Generic1, Show)
data Odd a = Odd a (Even a) deriving Generic1
data Even a = NilEven | Even a (Odd a) deriving Generic1
data Odd' a = Odd' a (Even' a) deriving Generic1
data Even' a = NilEven' | Even' a (Odd' a)
data H b a = H0 | H1 (H b b) deriving Generic1
data (:*:) a b = a :*: b deriving (Generic, Generic1)
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}
module GenCanDoRep1_0 where
import GHC.Generics (Generic1(..), Rep1)
-- We should be able to generate a generic representation for these types
data B a
deriving Generic1
data C a = C0 | C1
deriving Generic1
data D a = D0 | D1 { d11 :: a, d12 :: (D a) }
deriving Generic1
data (:*:) a b = a :*: b
deriving Generic1
data E b a = E0 | E1 (E b b) deriving Generic1
data F c b a = F (c, b, a) deriving Generic1
data G c b a = G [(c, c, c, c, b, a)] deriving (Generic1, Show)
data Odd a = Odd a (Even a) deriving Generic1
data Even a = NilEven | Even a (Odd a) deriving Generic1
data Odd' a = Odd' a (Even' a) deriving Generic1
data Even' a = NilEven' | Even' a (Odd' a)
......@@ -5,7 +5,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DatatypeContexts #-}
module CannotDoRep0 where
module CannotDoRep0_0 where
import GHC.Generics hiding (P, D)
......
GenCannotDoRep0.hs:6:14: Warning:
GenCannotDoRep0_0.hs:6:14: Warning:
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
GenCannotDoRep0.hs:13:45:
GenCannotDoRep0_0.hs:13:45:
Can't make a derived instance of ‛Generic Dynamic’:
Dynamic must be a vanilla data constructor
In the data declaration for ‛Dynamic’
GenCannotDoRep0.hs:17:1:
GenCannotDoRep0_0.hs:17:1:
Can't make a derived instance of ‛Generic (P Int)’:
P must not be instantiated; try deriving `P a' instead
In the stand-alone deriving instance for ‛Generic (P Int)’
GenCannotDoRep0.hs:26:1:
GenCannotDoRep0_0.hs:26:1:
Can't make a derived instance of ‛Generic (D Char Char)’:
D must not be instantiated; try deriving `D Char b' instead
In the stand-alone deriving instance for ‛Generic (D Char Char)’
GenCannotDoRep0.hs:28:1:
GenCannotDoRep0_0.hs:28:1:
Can't make a derived instance of ‛Generic (D Int a)’:
D must not have a datatype context
In the stand-alone deriving instance for ‛Generic (D Int a)’
{-# LANGUAGE DeriveGeneric, DatatypeContexts #-}
module CannotDoRep1 where
module CannotDoRep0_1 where
import GHC.Generics
......
GenCannotDoRep1.hs:1:29: Warning:
GenCannotDoRep0_1.hs:1:29: Warning:
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
GenCannotDoRep1.hs:8:49:
GenCannotDoRep0_1.hs:8:49:
Can't make a derived instance of ‛Generic (Context a)’:
Context must not have a datatype context
In the data declaration for ‛Context’
......@@ -2,7 +2,7 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GADTs #-}
module CannotDoRep2 where
module CannotDoRep0_2 where
import GHC.Generics
......
GenCannotDoRep2.hs:13:1:
GenCannotDoRep0_2.hs:13:1:
Can't make a derived instance of ‛Generic (Term a)’:
Int must be a vanilla data constructor
In the stand-alone deriving instance for ‛Generic (Term a)’
GenCannotDoRep1_3.hs:11:33:
Can't make a derived instance of ‛Generic1 T’:
Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
Constructor ‛T’ applies a type to an argument involving the last parameter
but the applied type is not of kind * -> *
In the data declaration for ‛T’
GenCannotDoRep1_4.hs:8:34:
Can't make a derived instance of ‛Generic1 T’:
Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
Constructor ‛T’ applies a type to an argument involving the last parameter
but the applied type is not of kind * -> *
In the data declaration for ‛T’
{-# LANGUAGE DeriveGeneric #-}
module GenCannotDoRep1_5 where
import GHC.Generics
-- We do not support occurrences of the type variable except as the last
-- argument
data T a = T (a, Int) deriving Generic1
GenCannotDoRep1_5.hs:9:32:
Can't make a derived instance of ‛Generic1 T’:
Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
In the data declaration for ‛T’
GenCannotDoRep1_6.hs:9:43:
Can't make a derived instance of ‛Generic1 T’:
Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
Constructor ‛T’ applies a type to an argument involving the last parameter
but the applied type is not of kind * -> *
In the data declaration for ‛T’
......@@ -4,8 +4,6 @@ module GenCannotDoRep1_7 where
import GHC.Generics
-- We do not support contravariant occurrences of the type variable
data B a = B (a -> Int)
-- so this fails because B is not representable
data T a = T (B a) deriving Generic1
-- We do not support occurrences of the type variable except as the last
-- argument
data I a = I (a, Int) deriving Generic1
GenCannotDoRep1_7.hs:11:29:
Can't make a derived instance of ‛Generic1 T’:
must not apply type constructors that cannot be represented with `Rep1' (such as `B') to arguments that involve the last type parameter
In the data declaration for ‛T’
GenCannotDoRep1_7.hs:9:32:
Can't make a derived instance of ‛Generic1 I’:
Constructor ‛I’ applies a type to an argument involving the last parameter
but the applied type is not of kind * -> *
In the data declaration for ‛I’
GenCannotDoRep1_8.hs:12:30:
Can't make a derived instance of ‛Generic1 T’:
Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
Constructor ‛T’ applies a type to an argument involving the last parameter
but the applied type is not of kind * -> *
In the data declaration for ‛T’
{-# Language DeriveGeneric, MagicHash #-}
import GHC.Generics
import GHC.Prim
data Array a = Array (Array# a) deriving Generic1
newtype Vec a = MkVec {unVec :: Array a} deriving Generic1
T8468.hs:6:42:
Can't make a derived instance of ‛Generic1 Array’:
Array must not have unlifted or polymorphic arguments
In the data declaration for ‛Array’
{-# OPTIONS_GHC -Wall #-}
{-# Language TypeFamilies #-}
{-# Language DeriveGeneric #-}
module T8479 where
import GHC.Generics
class Blah (a :: * -> *) where
type F a :: * -> *
data Foo (f :: * -> *) a = MkFoo ((F f) a) deriving Generic1
......@@ -5,15 +5,9 @@ test('GenCanDoRep1', normal, compile, [''])
test('GenDerivOutput', normal, compile, ['-dsuppress-uniques'])
test('GenShouldFail0', normal, compile_fail, [''])
test('GenCannotDoRep0', normal, compile_fail, [''])
test('GenCannotDoRep1', normal, compile_fail, [''])
test('GenCannotDoRep2', normal, compile_fail, [''])
test('T5884', normal, compile, [''])
test('GenNewtype', normal, compile_and_run, [''])
test('GenCanDoRep1_0', normal, compile, [''])
test('GenDerivOutput1_0', normal, compile, ['-dsuppress-uniques'])
test('GenDerivOutput1_1', normal, compile, ['-dsuppress-uniques'])
test('GenCannotDoRep0_0', normal, compile_fail, [''])
test('GenCannotDoRep0_1', normal, compile_fail, [''])
test('GenCannotDoRep0_2', normal, compile_fail, [''])
test('GenShouldFail1_0', normal, compile_fail, [''])
test('GenCannotDoRep1_0', normal, compile_fail, [''])
......@@ -21,12 +15,20 @@ test('GenCannotDoRep1_1', normal, compile_fail, [''])
test('GenCannotDoRep1_2', normal, compile_fail, [''])
test('GenCannotDoRep1_3', normal, compile_fail, [''])
test('GenCannotDoRep1_4', normal, compile_fail, [''])
test('GenCannotDoRep1_5', normal, compile_fail, [''])
test('GenCannotDoRep1_6', normal, compile_fail, [''])
test('GenCannotDoRep1_7', normal, compile_fail, [''])
test('GenCannotDoRep1_8', normal, compile_fail, [''])
test('T5884', normal, compile, [''])
test('GenNewtype', normal, compile_and_run, [''])
test('GenDerivOutput1_0', normal, compile, ['-dsuppress-uniques'])
test('GenDerivOutput1_1', normal, compile, ['-dsuppress-uniques'])
test('T7878', extra_clean(['T7878A.o' ,'T7878A.hi'
,'T7878A.o-boot','T7878A.hi-boot'
,'T7878B.o' ,'T7878B.hi']),
multimod_compile, ['T7878', '-v0'])
test('T8468', normal, compile_fail, [''])
test('T8479', normal, compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment