The problem is that both alternatives of a case
expression need to have the same type. Since you are ignoring the return value, you can add a return ()
to the Just
case. You should then be able to use return ()
in the Nothing
case as well:
case address s of
Just newAddress -> do
...
return ()
Nothing -> return ()