News for hackers. Stuff that matters.
Re:Understanding the Elm type system by Kiro on Tuesday June 07, 2016 @10:04AM (#11854560)
Thanks! Is this the case in Elm as well? This is the example they give:

  connectWords : String -> String -> String
  connectWords firstWord secondWord =
    firstWord ++ secondWord
Re:Understanding the Elm type system by elbenshira on Tuesday June 07, 2016 @10:49AM (#11854867)
In this case, you think of `connectWords` as a function that takes two arguments. But since it is curried, you can also do this:

    let prefix = connectWords "Hello "
        world  = prefix "world"
        bob    = prefix "bob"
    in ...
`world` is "Hello world", and `bob` is "Hello bob". That is the power of currying. A maybe more useful example is specifying the mapping function in `List.map` without supplying the list to map over. This allows you to use the same map with multiple lists.
Re:Understanding the Elm type system by taylorfausak on Tuesday June 07, 2016 @10:52AM (#11854883)
Yes, all functions in Elm also have arity 1. That example desugars into this:

    connectWords = \ firstWord -> \ secondWord -> firstWord ++ secondWord