[Haskell] Types of when and unless in Control.Monad
Henning Thielemann
lemming at henning-thielemann.de
Sun Apr 22 13:19:09 CEST 2012
moving to libraries, again ...
On Sun, 22 Apr 2012, Julian Gilbey wrote:
> On Sat, Apr 21, 2012 at 08:28:27PM -0500, Strake wrote:
>> On 21/04/2012, Andreas Abel <andreas.abel at ifi.lmu.de> wrote:
>> > to avoid silly "return ()" statements like in
>> >
>> > when cond $ do
>> > monadicComputationWhoseResultIWantToDiscard
>> > return ()
>>
>> (when cond ∘ void) monadicComputationWhoseResultIWantToDiscard
>> or
>> when cond $ () <$ monadicComputationWhoseResultIWantToDiscard
>
> How is that simpler than
>
> when cond monadicComputationWhoseResultIWantToDiscard
>
> which it would be with the suggested new type?
The original poster wanted to make it simpler, others want to let it be
safer.
More information about the Libraries
mailing list