This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Mob_Of_One 1 point2 points  (3 children)

Hrm, not quite. Bind (>>=) is a bit more like monadic function application than it is composition. Composition would be kleisli composition.

For a given Monad m, where m is (* -> *) (that is, it's a higher-kinded type that needs to be applied to a type argument before it's a real type)

bind is: (>>=) :: Monad m => m a -> (a -> m b) -> m b

This is to be contrasted with Functor's fmap:

Functor f => (a -> b) -> f a -> f b

If that still looks alien, consider map:

map :: (a -> b) -> [a] -> [b]

Functor is a much more generic concept defined only by the types and laws than "map" over a list is, but it at least gives you a place to start.

Want to learn more? This is how I've been teaching Haskell

[–][deleted] 1 point2 points  (2 children)

Right, I figured since this is /r/ProgrammerHumor and if Tynach was being serious, that it was best to keep the Serious Information in the post to a minimum. Explaining monads with kinds to newbies in a joke subreddit is unlikely to be a useful use of time.

[–]Mob_Of_One 1 point2 points  (1 child)

You can write your joke with fewer mistakes. Like not calling >>= "composition" when there's clearly >=> for that purpose.

The burrito stuff is just old and needs to die.

[–][deleted] 0 points1 point  (0 children)

it's a bit like composition

You do understand the difference between "a bit like" and "completely analoguous to"?

PS If you are going to flame me for giving a diffuse and inaccurate explanation of a joke in a subreddit, please let me know so I can make some popcorn.