Hello!
I've just deleted the other mails.
However, there's one interesting case where irrefutable matching
could be interesting.
It's the state monad.
A state transformer is about this:
newtype ST s a = ST { unST :: (s -> (a,s)) }
-- function from old state to result and new state
Now, there's two possibilities to define the >>= method of Monad:
instance Monad (ST s) where
(ST s1) >>= f = ST $ \state0 ->
case s1 state0 of
(result1, state1) -> unST (f result1) state1
Here, f can only be applied when the first state transformer already
has built the tuple (though, maybe, with deferred computations inside).
The other definition is:
instance Monad (ST s) where
(ST s1) >>= f = ST $ \state0 ->
case s1 state0 of
~(result1, state1) -> unST (f result1) state1
Here, f is entered before s1 builds the tuple. The tuple is only requred,
when f first accesses result1 or the second state transformer accesses
state1.
Approximately, that's about the difference between the strict and
the lazy state monad.
Regards,
Hannah.