Talk:Monad (functional programming)
This is actually the same as Monad (category theory). These should be merged. —Ashley Y 22:19, 2004 May 31 (UTC)
- They're not really the same thing: an explanation of Haskell's IO monad doesn't belong in an article on category theory, and a detailed explanation of monads in category theory isn't relavent to the average Haskell programmer. In addition, many standard Haskell monads aren't strictly speaking monads at all. I think it's probably best to keep the articles separate. Cadr 22:28, 31 May 2004 (UTC)
- Which Haskell monads are not monads in the CT sense? —Ashley Y 09:58, 2004 Jun 1 (UTC)
- It's not clear, actually, since the difference is only visible with the 'seq' function, which is considered slightly dubious anyway. More importantly, these are Haskell's monad laws that IO may or may not be properly living up to: the sense in which "monad" is used in Haskell is precisely the CT sense.
- If you think this should be a separate article, rename it "Monads in functional programming", rather than the () notation which suggests that it's a separate sense of the word.—Ashley Y 02:49, 2004 Jun 2 (UTC)
- OK, but it's still the case that the two articles cover very different information. I'm fine with it being renamed to Monads in functional programming. Cadr 14:15, 2 Jun 2004 (UTC)
Rename (from "Monad (functional programming)") done. —Ashley Y 23:27, 2004 Jun 2 (UTC)
Er, the first sentence of the second para (and possibly more) looks like a copyvio from http://nomaware.com/monads/html/introduction.html#what --- I don't know the topic well enough to rephrase to eliminate this. Could someone who knows the topic look into this? thanks, jdb ❋ 06:00, 27 Jan 2005 (UTC)
par function
Why is the function called par? --MarSch 11:06, 25 October 2005 (UTC)
- At least that's the function for total resistance of two resistors in parallel coupling. --TuukkaH 16:14, 25 October 2005 (UTC)
Rewrite
I guess my scam is up. I haven't really used Haskell any significant amount, and I barely understand this monad stuff. I just hoped I might be able to push this article away from the two mistakes so many monad tutorials make—presenting them as "how you do I/O" or completely neglecting to give any intuition to the general concept of a monad. I did my rewrite with a copy of Wadler's "Comprehending Monads" in hand, but since I made so many mistakes I'll tag the article for verification. TuukaH is correct above about the naming of par
. Gazpacho 04:13, 29 October 2005 (UTC)
Haskell
This page really seems to be more about monads in Haskell, rather than in a generic programming language. The examples given seem to be in Haskell, which for non haskell programmers (i.e. me) are really hard to follow.
Shouldn't this either be renamed to something like "Monads in Haskell" with a link to understanding Haskell, or have the equations written in a common mathematical way?
- If I understand correctly, monads are containers for values: for example, a monad value like "Just 5" contains the value 5. The return function "wraps" a value inside a monad, the fmap function allows another function to "look inside" a monad value, and it looks like join turns a value like Just (Just 5) into Just 5, or 3 into [3]. A few examples:
return 3 = either [3] or Just 3 -- "Wrap" the value 3 with a monad fmap (+1) [3,2,4] = [4,3,5] -- (+1) is the incrementor function, and it is allowed to "peek inside" this list to increment everything inside it. fmap (+1) (Just 5) = Just 6 -- Peeking inside a "Just" value. join Maybe (Maybe 7) = Maybe 7 -- "Joining" these two Maybe's into one join [[2]] = [2] -- Joining a listifier with a listifier
- Is this clear enough? --67.172.99.160 02:09, 3 December 2005 (UTC)