2015-10-01 11:01 GMT+02:00 Oliver Charles <ollie(a)ocharles.org.uk>:
> [...] However, it's a lot more significant if you want to do something
> like:
>
> foo x = doSomething (case x of ...)
>
> Without pattern synonyms, you either have
>
> foo x = doSomething x'
> where x' | x == ... = ...
>
> or
>
> {-# LANGUAGE MultiWayIf #-}
>
> foo x = doSomething (if | x == ... -> ...)
>
Or simply in plain old Haskell (basically the desugaring of the
multi-way-if):
foo x = doSomething (case () of
_ | x == gl_BAR -> expr1
| x == gl_BAZ -> expr2
| otherwise -> expr3)
Compared to:
foo x = doSomething (case x of
GL_BAR -> expr1
GL_BAZ -> expr2
_ .> expr3)
it doesn't really look *that* much different IMHO, given the high price one
has to pay for a tiny improvement in readability. But that's my personal,
more conservative view of things, and I'm here to see what other people
prefer.Alas, up to now, this is not very conclusive... :-/