{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreidnvjjg32adrfq34iwlubihqopzn5iowhvybe2wl54uaxvaxg35c4",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3miyctpegqjr2"
},
"path": "/t/would-keyword-arguments-conflict-with-currying-in-haskell/13906#post_3",
"publishedAt": "2026-04-08T08:09:11.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"Purescript",
"github.com/ghc-proposals/ghc-proposals",
"Add Structural Types (Row Polymorphism) (#180)",
"jvanbruegge",
"+201\n-0",
"…"
],
"textContent": "I think I would restrict it to functions having either keyword arguments or positional arguments, so forbidding a combination of the two. In that case you could just consider a function with keyword arguments to be a function from a record type. For example my imagined syntax would be:\n\n\n magnitude :: {x :: Int, y :: Int} -> Double\n magnitude {x = x, y = y} = sqrt (fromIntegral (x * x + y * y))\n\n\nThat could be desugared into:\n\n\n data MagnitudeArg = MkMagnitudeArg { x :: Int, y :: Int }\n\n magnitude :: MagnitudeArg -> Double\n magnitude MkMagnitudeArg {x = x, y = y} = sqrt (fromIntegral (x * x + y * y))\n\n\nIn the Purescript Haskell dialect you can already write such functions using anonymous records:\n\n\n magnitude :: {x :: Number, y :: Number} -> Number\n magnitude {x, y} = sqrt (x * x + y * y)\n\n\nAnd there is a proposal to add support for it to GHC (although it is a lot more ambitious):\n\ngithub.com/ghc-proposals/ghc-proposals\n\n#### Add Structural Types (Row Polymorphism) (#180)\n\n`master` ← `jvanbruegge:row-polymorphism`\n\nopened 09:22AM - 09 Nov 18 UTC\n\n\n\n jvanbruegge\n \n\n\n+201\n-0\n\n\nRecord types in Haskell are just syntactic sugar over normal product types, this… prevents us from specifying functions that work for certain structures of records. [Rendered](https://github.com/jvanbruegge/ghc-proposals/blob/row-polymorphism/proposals/0000-row-polymorphism.rst)",
"title": "Would keyword arguments conflict with currying in Haskell?"
}