
3 Jan
2009
3 Jan
'09
3:33 p.m.
On Sat, Jan 3, 2009 at 12:04 PM, Thomas Davie
Hi Colin, ...snip... These are called "pattern guards" – you can put any boolean expression in them. ...snip...
Technically, those are just called "guards." "Pattern guards" are when you also bind a pattern; it's a GHC extension. They look like this, for example: foo x | Just y <- bar x = y + 1 -- this is the pattern guard. If bar x can be matched with Just y, then y is bound and that guard path is taken. Otherwise, evaluation falls through to the next guard option. | otherwise = 0 Alex