[Haskell-cafe] ($) and ApplicativeDo

amindfv at gmail.com amindfv at gmail.com
Thu Jun 16 16:30:25 UTC 2016


They're the same:

> :t \x -> pure x
 \x -> pure x :: Applicative f => a -> f a
> :t \x -> pure $ x
 \x -> pure $ x :: Applicative f => a -> f a

Tom


> El 16 jun 2016, a las 12:24, KC <kc1956 at gmail.com> escribió:
> 
> Think of the types of
> 
> pure x
> 
> And
> 
> pure $ x
> 
> --
> --
> 
> Sent from an expensive device which will be obsolete in a few months! :D
> 
> Casey
>    
> 
>> On Jun 16, 2016 9:06 AM, <amindfv at gmail.com> wrote:
>> foo :: Applicative f => f String
>> foo = do
>>     x <- pure "this works"
>>     pure x
>> 
>> ... but replace "pure x" with "pure $ x" and it doesn't typecheck: a monad instance is required!
>> 
>> Tom
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160616/4f2a6441/attachment.html>


More information about the Haskell-Cafe mailing list