[Haskell-beginners] Is there an idiom for this?