0

I'm currently learning about Haskell and have come across something called currying and curried values.

I have also found that (+) is a curried version of +

+ :: (Integer, Integer) -> Integer
(+) :: Integer -> Integer -> Integer

From what I can tell the non-curried you have to input 2 numbers at the same and I get completely lost with the curried version.

Any explanation and examples would be great thanks!

Niklas B.
  • 92,950
  • 18
  • 194
  • 224
orange
  • 5,297
  • 12
  • 50
  • 71
  • 3
    Woot? The first declaration is not valid Haskell and there is no function `(Integer, Integer) -> Integer` in standard Haskell. Maybe you meant `uncurry (+)`. Where did you read that "(+) is a curried version of +"? – Niklas B. Apr 07 '13 at 11:35
  • 1
    http://en.m.wikipedia.org/wiki/Currying – Oliver Charlesworth Apr 07 '13 at 11:36
  • 1
    «I have also found that (+) is a curried version of +» — that is simply not true. Forget it and read one of several Haskell textbooks or tutorials. – Roman Cheplyaka Apr 07 '13 at 11:42
  • @Roman: Well it's true in a sense. Technically, `(+)` is indeed the curried version of another function of type `(Integer, Integer) -> Integer`, but that other function doesn't exist in Haskell. Also, the term "currying" is typically used as a synonym for "partial function application" in the context of functional programming, and in that sense, OPs question makes little sense. – Niklas B. Apr 07 '13 at 12:47
  • i understood currying when i thought about the way we use ms excel. we tend to chain functions spread across cells (which can have other functions) instead of having a single cell with a long function – dde Apr 13 '13 at 15:39

0 Answers0