haskell - Getting my bearings on state-monadic "uncurrying" -
the curry-uncurry isomorphisms can expressed invertible maps between various kinds of "higher-order" programs in reader monad (ignoring wrappers keep things concise):
type r r = r -> uncurryr :: r r (r s a) -> r (r, s) uncurryr m (r, s) = m r s curryr :: r (r, s) -> r r (r s a) curryr m r s = m (r, s)
i have become interested in state-monadic version of uncurrys
, follows:
type s r = r -> (a, r) uncurrys :: s r (s s a) -> s (r, s) uncurrys m (r, s) = (v, (t, u)) (n, t) = m r (v, u) = n s
of course, unlike uncurryr
, uncurrys
isn't isomorphism: s (r, s) a
in general "larger" type s r (s s a)
.
i'm academic linguist, , without going too detail, difference between r
, s
respect "uncurrying" operations -- i.e., whether they're isomorphisms -- turns out consequential thinking various problems in formal semantics of natural language (believe or not!).
in general, when construct looks relevant natural language semantics, i've found helpful chase down connections in computer science , category theory, extent can. end, interested know of related issues have been discussed, either in functional programming literature or in more categorical terms. sorry can't more specific, appreciate , pointers.
Comments
Post a Comment