I wanted to have curry
, uncurry
and fmap
that work for functions of any arity.
Are there better solutions?
I know there are simpler solutions, but some complexity is necessary if one wishes to have type inference: only the most trivial type families can be admitted to be one to one by GHC, and in more complicated cases one has to resort to an uneasy mix of type families and classes equipped with functional dependencies, for which the algorithm in GHC is more flexible.
My motivation for writing these functions is from working with servant
, where client (Proxy @Endpoint)
can be a function of any number of arguments, depending on the Endpoint
specification, so code that wants to work with any client
has to be polymorphic in the number of arguments.