Created
June 14, 2018 13:20
-
-
Save marcosh/b5e7f2b560ea7909da589ec64b14e867 to your computer and use it in GitHub Desktop.
Web applications as profunctors
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
module Application where | |
import Data.Profunctor | |
newtype Application request response = Application {unApplication :: request -> IO response} | |
instance Profunctor Application where | |
dimap actOnRequest actOnResponse application = Application $ (fmap actOnResponse) . (unApplication application) . actOnRequest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment