Hello, I'm kind of new with Haskell and I would like to know about the following: [some function]:: Int -> Int -> Int Now is my question, how should I interpret "Int -> Int -> Int"? Meaning what does "Int -> Int -> Int" mean? Thank you for answering my question. Kind Regards, JTKM
Hi JTKM, TKM wrote:
Now is my question, how should I interpret "Int -> Int -> Int"? Meaning what does "Int -> Int -> Int" mean?
There are many good tutorials and books online. Here's a link that directly answers your question: http://book.realworldhaskell.org/read/types-and-functions.html#id581829 Section "The type of a function of more than one argument" Hope this helps, Martijn.
It means Int -> (Int -> Int). -> is right associative. On 6 Feb 2009, at 01:28, TKM wrote:
Hello,
I'm kind of new with Haskell and I would like to know about the following:
[some function]:: Int -> Int -> Int
Now is my question, how should I interpret "Int -> Int -> Int"? Meaning what does "Int -> Int -> Int" mean?
Thank you for answering my question.
Kind Regards, JTKM _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Maybe you mean that f :: Int -> Int -> Int does not say much about what the function does since the Int arguments have no "name" in Haskell? E.g. the following might "mean" more, but is not valid Haskell: f :: numerator:Int -> denominator:Int -> quotient:Int In Haskell you regularly see documentation that says: "the 4th argument of dpSwitch is ..., the 7th argument of dpSwitch is ..." That's okay, since it trains you at counting :-) Of course, I'm being sarcastic. But most of the time, this is not an issue, since functions usually only have a few arguments, or have argument types that tell more. 2009/2/5 TKM <temp.public@gmail.com>
Hello,
I'm kind of new with Haskell and I would like to know about the following:
[some function]:: Int -> Int -> Int
Now is my question, how should I interpret "Int -> Int -> Int"? Meaning what does "Int -> Int -> Int" mean?
Thank you for answering my question.
Kind Regards, JTKM
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Martijn van Steenbergen -
Miguel Mitrofanov -
Peter Verswyvelen -
TKM