
----- Original Message ----
From: aditya siram
To: Haskell Café Cc: haskell@haskell.org; Marcus Sundman Sent: Tue, November 16, 2010 8:18:33 AM Subject: Re: [Haskell-cafe] Re: [Haskell] intent-typing That was a great explanation of phantom types and type-families. I'm just getting started on understand type families and I was wondering why you didn't use data families in the truth table structure: type family Join a b type instance Join Safe Safe = Safe type instance Join Safe Unsafe = Unsafe type instance Join Unsafe Safe = Unsafe type instance Join Unsafe Unsafe = Unsafe
My understanding is that since 'type' just produces a type synonym and the last three type instances are "Unsafe", they are equivalent. Wouldn't it be better to have "data instance Join Safe Unsafe ..." so that the compiler can distinguish between "Join Unsafe Safe", "Join Safe Unsafe" and "Join Unsafe Unsafe" ?
The goal is to have ++ produce an AnnotatedString Safe or an AnnotatedString Unsafe, reflecting the safety level. A data family would maintain the distinction, but then AnnotatedString (Join Unsafe Unsafe) would not be equivalent to AnnotatedString Unsafe - and what if you want to concatenate three pieces? Brandon