Claus Reinke wrote:
Btw, is there a list of common TF pitfalls somewhere? Some example
items so far seem to be:
1 'C a => TF a', where 'a' isn't determinable
2 'TF a' is not fully polymorphic
3 'TF a' is not a decomposable type constructor, it stands only
for itself, or for its result (in that way it is more like a defined
function application)
For 1/2, it is helpful to flatten type family applications:
- 'C a => TF a' becomes: '(C a,TF a~tfa) => tfa'
- 'TF a' becomes: 'TF a~tfa => tfa'
For 3, it is helpful to imagine the arity of type families being
marked
by braces, to distinguish type family parameters from any
constructor parameters, in case the type family reduces to a type
constructor:
- Given 'type family TF2 a :: * -> *', 'TF2 a b' becomes: '{TF2
a} ~ tfa => tfa b'
It should rather be a type-level programming FAQ:
Re 1: Ambiguous signatures are a general problem. However, they are
syntactically harder to recognise with TFs.
Re 2: Applies to GADTs as well.
Re 3: I have always been wondering whether we want special syntax for
the application of synonym families. That would make it syntactically
easier to recognise ambiguous signatures and indicarte syntactically
were decomposition is admisible.
BTW, part of the problem is that H98 is not entirely consistent with
its use of upper and lower case identifiers. Strictly speaking,
already vanilla type synonyms should have been lower case as they are
a simple form of functions on types (you cannot use decomposition on
them!) Then, synonym families could be lower-case, too.
Manuel
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe