[Haskell-beginners] Error with floats in implementation of Horner's method.

Andrew Fleckenstein andrew.fleckenstein at gmail.com
Fri Dec 13 21:51:25 UTC 2013


I know Num is a class, and Double is an instance of the Num class. I guess
using Num would make it more generic, but I don't see why either one would
be better in this particular function.


On Fri, Dec 13, 2013 at 4:20 PM, Kim-Ee Yeoh <ky3 at atamo.com> wrote:

>
> On Sat, Dec 14, 2013 at 4:07 AM, Andrew Fleckenstein <
> andrew.fleckenstein at gmail.com> wrote:
>
>> I know it has something to do with types,
>
>
> Right! :)
>
>
>> but whenever I try to add a type signature to the functions it just
>> messes everything up even more.
>
>
> This works: let a :: [Double]; a = [-1,2,-6,2]
>
> This works too: let a :: Num a => [a]; a = [-1,2,-6,2]
>
> What do you think are the pros and cons of either?
>
> -- Kim-Ee
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20131213/87f761cf/attachment-0001.html>


More information about the Beginners mailing list