In Control.Monad, when has type
when :: Monad m => Bool -> m () -> m ()
I think this type should be generalized to
when :: Monad m => Bool -> m a -> m ()
to avoid silly "return ()" statements like in
when cond $ do
monadicComputationWhoseResultIWantToDiscard
return ()
Cheers,
Andreas
P.S.: A more systematic solution would be to change the Haskell
language by either introducing a Top type which is the supertype of
everything and use it instead of ().
Alternatively, make () the top type and interpret matching against the
empty tuple as just computing the weak head normal form and then
discarding the result. The latter is needed to preserve the current
behavior of
(\ () -> bla) (error "raised")
vs.
(\ _ -> bla) (error "not raised")
--
Andreas Abel <>< Du bist der geliebte Mensch.
Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY
andreas.a...@ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell