Re:Functors, Applicatives, and Monads in Pictures (2013)
by rane on Thursday September 24, 2015 @07:18PM
(#10275461)
Isn't Maybe being an instance of Applicative enough in this case?
[ Parent
| on HN ]
Re:Functors, Applicatives, and Monads in Pictures (2013)
by AnimalMuppet on Thursday September 24, 2015 @07:48PM
(#10275591)
Maybe...
But seriously, I guess I think it's not a Monad. The Monad signature (in this case) is
(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b
and I think what we really want (and what I said we wanted to do) is Maybe a -> (a -> b) -> Maybe b
I don't know whether that's Applicative or Functor, but I don't think it's Monad.
Re:Functors, Applicatives, and Monads in Pictures (2013)
by Muphrid on Saturday September 26, 2015 @06:20PM
(#10284627)
That operation is called fmap, and it's characteristic of a functor. In Haskell, it's called liftM for monads, but they're really the same thing (and I think recent proposals are going to iron out this redundancy). fmap is one of the properties of a functor. All monads are functors, so all monads provide an operation with that signature.