External Publication
Visit Post

Would keyword arguments conflict with currying in Haskell?

Haskell Community [Unofficial] April 10, 2026
Source

Shantanu-sg-01:

Would adding keyword arguments conflict with currying in Haskell?

For example, how would partial application work if arguments could be passed out of order or by name?

I don’t think it would necessarily conflict with currying. I imagine it could work as a bit of syntactic sugar, e.g.

httpRequest :: String -> Method -> Maybe Body -> IO Response
httpRequest url method body = ...

-- Partially apply the function with a keyword argument
httpRequest method:POST

-- ... which would desugar to
\url body -> httpRequest url POST body

Something like the above could still be curried as usual:

mapM (httpRequest body:Nothing method:GET)
  [ "https://example.com",
    "https://google.com",
    ...
  ]

That said, this only works if all keyword arguments are mandatory. Optional keyword arguments would be more complicated since it would be ambiguous whether we intend to call with defaults or want to wait for the rest of the arguments. This could potentially be disambiguated based on where/how the function is used or explicitly via some extra syntax.

Discussion in the ATmosphere

Loading comments...