Last active
August 29, 2015 13:56
-
-
Save tonymorris/8817298 to your computer and use it in GitHub Desktop.
The composition law of Apply
This file contains hidden or 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
| {-# LANGUAGE NoImplicitPrelude #-} | |
| import Prelude(Eq(..), Bool, (.)) | |
| class Functor f where | |
| (<$>) :: | |
| (a -> b) | |
| -> f a | |
| -> f b | |
| class Functor f => Apply f where | |
| (<*>) :: | |
| f (a -> b) | |
| -> f a | |
| -> f b | |
| composition :: | |
| (Eq (f c), Apply f) => | |
| f (b -> c) | |
| -> f (a -> b) | |
| -> f a | |
| -> Bool | |
| composition fbc fab fa = | |
| (fbc <*> (fab <*> fa)) == | |
| ((((.) <$> fbc) <*> fab) <*> fa) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment