Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Haskell

Name: Anonymous 2009-10-05 12:37

How the fuck do you write a pointless concatMapM?

Name: Anonymous 2009-10-05 12:42

>>1
U MENA HASKAL

Name: Anonymous 2009-10-05 12:43

>>2
I mena haskal :(

Name: Anonymous 2009-10-05 12:56

>>1
What the fuck is concatMapM supposed to be? The type is hardly self-evident from the name.

Is liftM concat . mapM what you want?

Name: Anonymous 2009-10-05 12:57

No seriously guys.

concatMapM f xs = do
    xs'
<- mapM f xs
    return $ concat xs'

works fine,

liftM concat . mapM
and
((return . concat) =<<) . mapM
give me a wierd type signature: (Monad ((->) [a])) => (a -> [b]) -> [a] -> [b]

Name: Anonymous 2009-10-05 12:58

>>4
How is it hardly self-evident: you should be aware of the difference between map and mapM, and also that there's a concatMap function. Connect the dots.

Name: Anonymous 2009-10-05 13:08

Hay guise
(fmap join .) . mapM

Name: Anonymous 2009-10-05 13:11

>>7
Now it would be sweet if a bro could explain why >>5 doesn't work.

Name: Anonymous 2009-10-05 13:12

>>8
Disregard the thread I'm fucking stupid, it's (liftM concat .) . mapM.

Name: Anonymous 2009-10-05 14:07

>>8
The idiot in >>5 wrote that without thinking, and it happened to typecheck because importing Control.Monad enabled some additional instances.

Name: Anonymous 2009-10-05 15:37

The idiot in >>10 wrote that without thinking, and it happened to typecheck because importing Control.Monad enabled some additional instances.

Name: Anonymous 2011-02-04 16:37

Don't change these.
Name: Email:
Entire Thread Thread List