[Haskell-cafe] noob question

Ben thefunkslists at gmail.com
Mon Feb 25 19:01:43 EST 2008


I'm just starting to learn Haskell, and I'm having some confusion (I  
think) with how the type inference is working.  Can someone explain  
why, in ghc 6.8.2 this works:

*Main> (1/3)^3
3.7037037037037035e-2

But this doesn't

*Main> (\k -> (1/k) ^ k) 3

<interactive>:1:8:
     Ambiguous type variable `t' in the constraints:
       `Fractional t' arising from a use of `/' at <interactive>:1:8-10
       `Integral t' arising from a use of `^' at <interactive>:1:7-15
     Probable fix: add a type signature that fixes these type  
variable(s)

TIA,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080225/c074ee50/attachment.htm


More information about the Haskell-Cafe mailing list