[Haskell-cafe] proposal: point free case expressions

Jonathan Daugherty drcygnus at gmail.com
Thu Nov 5 12:26:04 EST 2009


> So we could write:
>
> > myFunc = anotherFunc $ case of
> >                          Left err -> print err
> >                          Right msg -> putStrLn msg
>
> A minor syntactical addition, a big win!

+1.

While we're on the topic, what do people think of a related problem,
case expressions over monadic values?  I run into this often enough
that it's a pain.  I'd like to take

  result <- act1
  case result of
    ... -> actN

and drop the bind entirely to get

  case act1 of
    ... -> actN

I know that there are many helper functions and constructs to make
this sort of thing more readable, but sometimes a case expression is a
good fit and the preceding bind just ends up being noisy.

-- 
  Jonathan Daugherty


More information about the Haskell-Cafe mailing list