3 ms·
Look into "Row types" and how PureScript, Haskell, and Elm (to a limited extent) do it. '{foo :: Int | bar} is a record with a known property 'foo' and some un
by haskman 2y ago
Look into "Row types" and how PureScript, Haskell, and Elm (to a limited extent) do it.
'{foo :: Int | bar} is a record with a known property 'foo' and some unspecified properties 'bar'. You cannot pass a `{foo :: Int, bar :: Int}` into a function that expects `{foo :: Int}`.
A function that accepts any record with a field foo, changes foo, keeping other properties intact has the type
{foo :: Int | bar} -> {foo :: Int | bar}