[Haskell-cafe] Verbosity of imperative code (was: Learning
Haskell)
J. Garrett Morris
trevion at gmail.com
Wed Dec 7 16:18:44 EST 2005
On 12/7/05, Robin Green <greenrd at greenrd.org> wrote:
> Let's say you want to write a function
>
> seqPair :: (Monad m) => (m a, m b) -> m (a, b)
>
> which returns a computation which does the left computation followed by the
> right computation (i.e. it's like the sequence function, but for pairs
> instead of lists).
In this case, I believe it is as simple as
import Control.Monad (liftM2)
seqPair = liftM2 (,)
/g
--
We have lingered in the chambers of the sea
By sea-girls wreathed with seaweed red and brown
Till human voices wake us, and we drown.
More information about the Haskell-Cafe
mailing list