by Kiro · 10y ago · 0 comments
connectWords : String -> String -> String
connectWords firstWord secondWord =
firstWord ++ secondWord 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. connectWords = \ firstWord -> \ secondWord -> firstWord ++ secondWord