Send Beginners mailing list submissions to beginners@haskell.org 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 beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org 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 (David McBride) ---------------------------------------------------------------------- Message: 1 Date: Thu, 22 Dec 2016 10:46:45 -0500 From: David McBride <toa...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] applicative default structure Message-ID: <CAN+Tr43yCmX9=ih-vehxwptfpw_5h4xs4bxgvsxh6xw7euc...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" I get a Num ambiguous constraint error as well, but it is merely not giving you the rest of the errors. Prelude> let a1 = pure (1::Int) Prelude> let a2 = pure (1::Int) Prelude> a1 == a2 • Ambiguous type variable ‘f0’ arising from a use of ‘a1’ prevents the constraint ‘(Applicative f0)’ from being solved. Furthermore you can't compare an IO a with an IO a, so it will still cause an error. But if you go: Prelude>let a1 = 1 Prelude>let a2 = 1 Prelude>a1 == a2 True Then it is totally fine with that. On Thu, Dec 22, 2016 at 10:38 AM, Imants Cekusins <ima...@gmail.com> wrote: > > what is the "default" structure if you don't specify any > > similar to: > > display::Show a => a -> String > display = show > > fa::(Applicative f, Num a) => f a > fa = pure 1 > > f and a are *bounded* by Applicative and Num, so to say. No default. Or, > it is typed however type is a bit broader than * > > > > In this case it defaults f to IO and a to Int, > > does it though? > > > Prelude> let a1 = pure 1 > Prelude> let a2 = pure 1 > Prelude> a1 == a2 > > <interactive>:20:1: error: > • Ambiguous type variable ‘a0’ arising from a use of ‘a1’ > prevents the constraint ‘(Num a0)’ from being solved. > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161222/8f5e196a/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 102, Issue 13 ******************************************