Is there a way to define a type/alias representing a row polymorphic record?
So given this example
tester :: forall r. {val :: Int | r} -> Int
tester a =
a.val
callTester = tester {val: 1, b: 2}
I want to define the record type as an alias. Something like
type Val = forall r. {val :: Int | r}
tester :: Val -> Int
tester a =
a.val
callTester = tester {val: 1, b: 2}
But that will not compile.
For larger records and more complex functions defining the types multiple times leads to quite a lot of noise. It would be nice to factor this out.
e.g. fn :: a -> b -> a I have to define a twice
For non-polymorphic records its simple but I explicitly want to allow records with additional fields that are not know upfront.
Thanks