The curry-uncurry isomorphisms can be expressed as invertible maps between various kinds of "higher-order" programs in the Reader monad (ignoring wrappers to keep things concise):
type R r a = r -> a
uncurryR :: R r (R s a) -> R (r, s) a
uncurryR m (r, s) = m r s
curryR :: R (r, s) a -> R r (R s a)
curryR m r s = m (r, s)
I have become interested in a State-monadic version of uncurryS
, as follows:
type S r a = r -> (a, r)
uncurryS :: S r (S s a) -> S (r, s) a
uncurryS m (r, s) = (v, (t, u))
where (n, t) = m r
(v, u) = n s
Of course, unlike uncurryR
, unCurryS
isn't an isomorphism: S (r, s) a
is in general a much "larger" type than S r (S s a)
.
I'm an academic linguist, and without going into too much detail, the difference between R
and S
with respect to their "uncurrying" operations -- i.e., whether they're isomorphisms -- turns out to be consequential for thinking about various problems in the formal semantics of natural language (believe it or not!).
In general, when a construct looks relevant for natural language semantics, I've found it helpful to chase down connections in computer science and category theory, to the extent that I can. To that end, I would be very interested to know of any related issues have been discussed, either in the functional programming literature or in more categorical terms. I am sorry I can't be much more specific, but I appreciate any help and any pointers.