Skip to content

Instantly share code, notes, and snippets.

@marcosh
Created June 14, 2018 13:20
Show Gist options
  • Save marcosh/b5e7f2b560ea7909da589ec64b14e867 to your computer and use it in GitHub Desktop.
Save marcosh/b5e7f2b560ea7909da589ec64b14e867 to your computer and use it in GitHub Desktop.
Web applications as profunctors
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