General pattern bindings

Twan van Laarhoven twanvl at gmail.com
Fri Apr 13 21:43:03 EDT 2007


In the interest of removing things from the standard, I found this in 
the Haskell 98 report (section 4.4.3.2):

 > The general form of a pattern binding is p match, where a match is the
 > same structure as for function bindings above; in other words, a
 > pattern binding is:
 >
 > p 	| g1 	= e1
 >	| g2 	= e2
 >	...
 >	| gm 	= em
 >	where { decls }

I did not even know these things existed, is there anyone who actually 
uses general pattern bindings?

If not, the question becomes whether removing these bindings would 
improve the language. It can be argued that it makes the language less 
consistent. Declarations would change from

 > decl   ->    (funlhs | pat0) rhs
 > rhs    ->    = exp [where decls]
 >        |     gdrhs [where decls]

to something like

 > decl   ->    funlhs rhs
 >        |     pat0 srhs
 > srhs   ->    = exp [where decls]
 > rhs    ->    srhs
 >        |     gdrhs [where decls]

On the other hand, we can remove most of section 4.3.2.2.

Any opinions?

Twan


More information about the Haskell-prime mailing list