Is it possible to bind two expressions together within a case inside a do block?

 

Given the following code running in the writer monad:

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

How can I combine these two cases together (or otherwise simplify the code)?

 

Thanks,

 

Renah Scarowsky

Suite Solutions

Create>Manage>Deploy

http://www.suite-sol.com