
On 9/27/07, jerzy.karczmarczuk@info.unicaen.fr
Thomas Conway writes:
On 9/27/07, ok
wrote: I have often found myself wishing for a small extension to the syntax of Haskell 'data' declarations. It goes like this: ['where' clause to allow locally defined names in type declarations]
Nice.
Quite a few times I've found myself declaring type synonyms for this reason, but you end up polluting the global namespace.
+1 vote.
Data with where? You haven't heard about GADTs?
I think that you haven't read the question carefully, because "where" in GADTs is simply a syntactic sugar. However, this seems to be available already with GADTs and type equality constraints: data BST key val where Empty :: BST key val Fork :: (bst ~ BST key val) => key -> val -> bst -> bst -> BST key val It's a pity you can't use bst (or a type synonym) instead of the last "BST key val". Best regards Tomasz