Created
September 12, 2016 20:37
-
-
Save schar/10eed2835f22cc0f59587a89681af616 to your computer and use it in GitHub Desktop.
uncurrying reader and state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type R r a = r -> a | |
uncurryR :: R r (R s a) -> R (r, s) a -- an isomorphism | |
uncurryR m (r, s) = m r s | |
curryR :: R (r, s) a -> R r (R s a) -- another isomorphism | |
curryR m r s = m (r, s) | |
type S r a = r -> (a, r) | |
uncurryS :: S r (S s a) -> S (r, s) a -- not an isomorphism! | |
uncurryS m (r, s) = (v, (t, u)) | |
where (n, t) = m r | |
(v, u) = n s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment