Proposal: Add a strict version of <$> for monads
Ivan Lazar Miljenovic
ivan.miljenovic at gmail.com
Fri Nov 29 12:42:48 UTC 2013
On 29 November 2013 23:35, David Luposchainsky
<dluposchainsky at googlemail.com> wrote:
> On 29.11.2013 13:23, Johan Tibell wrote:
>> On Fri, Nov 29, 2013 at 1:19 PM, Twan van Laarhoven
>>
>> I don't like that this function is implemented for Monads, I think
>> that it makes sense for some other functors as well. Though to do
>> this 'properly' we would probably end up with another typeclass
>> "StrictFunctor" or something, and that is perhaps too much
>> unnecessary complexity.
>>
>>
>> Do you have an example of such a functor?
>
> Async is a Functor (but not Applicative). When asyncs finish and you
> poll their result with `wait`, you potentially get back an IO <thunk>.
> (Just the first example that came to mind.)
Except wait :: Async a -> IO a, so it's actually in the IO monad
(which _is_ a monad :p).
I'm +1
--
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com
More information about the Libraries
mailing list