[Haskell-beginners] combine expressions in do block

Daniel Trstenjak daniel.trstenjak at gmail.com
Wed Jan 8 08:21:59 UTC 2014


Hi Renah,

On Wed, Jan 08, 2014 at 10:09:18AM +0200, Renah Scarowsky wrote:
> How can I combine these two cases together (or otherwise simplify the code)?

I don't know if I'm understanding you correctly, but something like this?

f a = do
   case g a of
      Nothing -> return ()
      Just b -> do
         h a (field1 b) (field2 b)
         i a (j a) (field1 b) (field2 b)


Greetings,
Daniel


More information about the Beginners mailing list