
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

On Sat, Apr 14, 2007 at 03:43:03AM +0200, Twan van Laarhoven wrote:
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?
At one point vty defined the standard colors using the following wonderfully elegant code: [black, red, green, yellow, blue, magenta, cyan, white] = map Color [0..7] Unfortunately ghc generated hideous code for this, so I had to inline it manually. So it goes. (yow, what got into me there?) I'm pretty sure I've seen this once or twice: (x,y) | someCondition = x y z | otherwise = b a r Stefan

Hi Twan,
In the interest of removing things from the standard, I found this in the Haskell 98 report (section 4.4.3.2):
Great idea to remove things, but keep your hands off extended pattern guards! I've got at least 3 instances of that in the module that is currently open on my screen. I've got loads of it everywhere, its great. If you are looking for things to remove, I'd look in the direction of n+k patterns :-) Thanks Neil

Hello Twan, Saturday, April 14, 2007, 5:43:03 AM, you wrote:
I did not even know these things existed, is there anyone who actually uses general pattern bindings?
b:kb:mb:gb:_ = iterate (1024*) 1 unfortunately, they got monotypes, so at last end i finished with simpler definitions nevertheless, i think that this feature should remain. in particular, it may be required for initialization via unsafePerformIO: (hin,hout) = unsafePerformIO $ do runProcess "sh" -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Twan van Laarhoven
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?
It is worth mentioning that such pattern bindings are not only used at the top-level - they are also valid in local definitions, where the guards may involve variables bound at an outer scope. This makes them highly useful. Regards, Malcolm
participants (5)
-
Bulat Ziganshin
-
Malcolm Wallace
-
Neil Mitchell
-
Stefan O'Rear
-
Twan van Laarhoven