#1968: data family + GADT: not implemented yet
------------------------------------------------+---------------------------
Reporter: Remi | Owner: chak
Type: bug | Status: new
Priority: normal | Milestone: 6.10 branch
Component: Compiler (Type checker) | Version: 6.9
Severity: normal | Resolution:
Keywords: data type family GADT choose_univs | Difficulty: Moderate (1
day)
Testcase: | Architecture: Multiple
Os: Multiple |
------------------------------------------------+---------------------------
Comment (by guest):
Ah, ok.
By varying non-instance types, I meant are the constructors allowed to
refine the types that don't index the family. However I've just
realised/remembered there isn't a distinction between the named and kind-
annotated types - my mistake.
I guess I was thinking that named variables somehow index the data family,
(as with type families) and so you could determine which instance to use,
and whether one is uniquely determined by a signature.
Just to totally clarify - of the 3 programs below, the first is a type
error and the other two are type ok and equivalent?
{{{
{-# LANGUAGE GADTs, TypeFamilies, KindSignatures #-}
data family Blah x a :: *
data instance Blah Char Int where
Char1 :: Blah Char Int
data instance Blah Char Bool where
Char2 :: Blah Char Bool
foo :: Blah Char a -> a
foo Char1 = 2
foo Char2 = False
}}}
vs
{{{
{-# LANGUAGE GADTs, TypeFamilies, KindSignatures #-}
data family Blah x :: * -> *
data instance Blah Char a where
Char1 :: Blah Char Int
Char2 :: Blah Char Bool
foo :: Blah Char a -> a
foo Char1 = 2
foo Char2 = False
}}}
vs
{{{
{-# LANGUAGE GADTs, TypeFamilies, KindSignatures #-}
data family Blah x a :: *
data instance Blah Char a where
Char1 :: Blah Char Int
Char2 :: Blah Char Bool
foo :: Blah Char a -> a
foo Char1 = 2
foo Char2 = False
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1968#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs