Note that these are pure, total functions. There is no justification for
using 'fromJust' here, merely to support monadic style.
(If the latter is preferred, then the proper choice would be
Data.Functor.Identity.runIdentity which is total and has guaranteed zero
runtime overhead.)
Anyway, cascading case expressions are clearer IMO, less noisy (e.g. no
"return $" on each line), and are generally more robust against changes in
the data type (you get a warning about incomplete patterns if constructors
are added (though I concede that this is unlikely here)).
1 patch for repository http://darcs.net/screened:
patch c553aac0b42564699190b34cc54a245e7e3c4e9e
Author: Ben Franksen <benjamin.franksen@helmholtz-berlin.de>
Date: Tue Mar 8 23:49:03 CET 2016
* cleanup in Darcs.Patch.Merge: use case instead of fromJust (do return ...)
I remember I tried to get rid of such use of "fromJust / return $"
elsewhere in Darcs but got caught by a "my brain just exploded" GHC
error, also I was unsure of the improvement on readability of the code.
In the present case I see that it *is* an improvement.
Accepted.