
On Wed, Sep 30, 2015 at 6:38 PM Sven Panne
IMHO using pattern synonyms vs. plain old Haskell values is to a large part just bikeshedding, at least in the trivial case at hand where we talk about simple integral values. It basically boils down to the question: Is
foo x = case x of GL_BAR -> expr1 GL_BAZ -> expr2 _ -> expr3
really so much better than
foo x | x == GL_BAR = expr1 | x == GL_BAZ = expr2 | otherwise = expr3
Yes, because the first approach is an expression that you can use anywhere. Sure, there's little difference when you do it at the "top" of a function definition, as you're doing. 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 == ... -> ...)