Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: applicative default structure (Ovidiu Deac)
----------------------------------------------------------------------
Message: 1
Date: Fri, 23 Dec 2016 14:48:31 +0200
From: Ovidiu Deac <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] applicative default structure
Message-ID:
<cakvse7tdaz9s6mdyyrkjez3vrer_j43+a4_7s+2zgbqfd_o...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
So normally it should fail but the default typing in ghci is the one who
makes our life easier.
Thanks for the explanation!
On Thu, Dec 22, 2016 at 5:33 PM, David McBride <[email protected]> wrote:
> Rather than bailing with an instance error for both Applicative and Num,
> which is the technically the right way, and the way that it used to be in
> the dark ages of ghci. Instead it chooses types which are probably what
> you wanted. In this case it defaults f to IO and a to Int, and then runs
> it.
>
> You can read more about type defaulting in ghci here:
> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html
>
> On Thu, Dec 22, 2016 at 10:18 AM, Ovidiu Deac <[email protected]>
> wrote:
>
>> My understanding is that x can take any form required for type-inference.
>> That's fine but what is the "default" structure if you don't specify any?
>>
>> On Thu, Dec 22, 2016 at 5:13 PM, Imants Cekusins <[email protected]>
>> wrote:
>>
>>> > What is f here?
>>>
>>> anything Applicative:
>>>
>>> Prelude> let a1 = pure 1
>>> Prelude> let a2 = pure 1
>>>
>>> Prelude> (a1::Maybe Int) == a2
>>> True
>>> Prelude> (a1::Maybe Float) == a2
>>> True
>>> Prelude> (a1::Either String Float) == a2
>>> True
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>>
>>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20161223/bbc497bf/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 102, Issue 14
******************************************