In the following code, T1
and T2
compile fine, but T3
fails:
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
type family F a
data T1 b where
T1 :: a -> T1 (F a)
data T2 b where
T2 :: { x2 :: a } -> T2 a
data T3 b where
T3 :: { x3 :: a } -> T3 (F a)
I'm trying to understand why. T3
is just T1
but with a named record. This doesn't seem to be all that special, as one could use constructor syntax to extract it anyway.
These examples probably look silly, but in my code there is a constraint on a
, e.g. (Show a)
, so these values can be used when they're extracted.