[Haskell-cafe] 'data' syntax - a suggestion
Thomas Conway
drtomc at gmail.com
Thu Sep 27 18:01:23 EDT 2007
On 9/28/07, David Menendez <dave at zednenem.com> wrote:
> I'm not sure there is a clash.
>
> data B k v where ...
>
> is easily distinguished from
>
> data B k v = ... where ...
Indeed.
Although Richard's proposal was simpler, I reckon it's worth
discussing whether the where clause should allow normal
type/data/newtype declarations, effectively introducing a new scope.
There are obviously some type variable quantification and name
resolution issues that should yield several conference papers.
Here are a couple of examples:
data Tree key val
= Leaf key val
| Node BST key val BST
where
type BST = Tree key val
data RelaxedTree key val
= Leaf Bal [(key,val)]
| Node Bal [(key,RelaxedTree key val)]
where
data Bal = Balanced | Unbalanced
--
Thomas Conway
drtomc at gmail.com
Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.
More information about the Haskell-Cafe
mailing list