(Apologies, I forgot to change the subject) Laszlo Nemeth <laszlo@ropas.kaist.ac.kr> writes:
* * * Ketil Malde <ketil@ii.uib.no> wrote:
There is no difference. The 'pipe-syntax' (or pattern guards) gets desugared (by the pattern matching compiler) to case statements i.e.:
runRandom = \ last max num.case (num > 1) of True -> runRandom (fst new) max (num-1) False -> snd new
But - the converse is not true, is it? I can write ... = case foo of (Foo f) -> ... (Bar b) -> ... but I can't express that as a pattern-guarded expression, can I? My impression here is that the PG syntax adds nothing, and is hardly any more readable, and less intuitive for migrators from more traditional language. Why is it there at all? Is there a (rough) guideline for when to use one or the other?
For a more detailed discussion see SPJ's book, Augustsson original paper, or M Pettersen't thesis (LNCS 1549).
Okay, I'll try to look them up. -kzm -- If I haven't seen further, it is by standing in the footprints of giants