Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Apply law #102

Open
eschnett opened this issue May 16, 2019 · 3 comments
Open

Missing Apply law #102

eschnett opened this issue May 16, 2019 · 3 comments

Comments

@eschnett
Copy link

The Composition Applicative laws is really an Apply law:

pure (.) <*> u <*> v <*> w ≡ u <*> (v <*> w)

You can rewrite the first term pure (.) <*> u as fmap (.) u, and then it does not depend on pure any more, making it a law for the Apply typeclass. This law is just Apply's associativity in disguise.

@chessai
Copy link
Collaborator

chessai commented May 16, 2019

alright, i've just adding this. running builds locally.

do you think Associativity is a good name with which to refer to this law?

@chessai
Copy link
Collaborator

chessai commented May 16, 2019

We should also test the following, but I'm not sure what to name these at all. I'd appreciate your input @eschnett.

x <.> (f <$> y) = (. f) <$> x <.> y
f <$> (x <.> y) = (f .) <$> x <.> y
(mf <$> m) .> (nf <$> n) = nf <$> (m .> n)
(mf <$> m) <. (nf <$> n) = mf <$> (m <. n)

@eschnett
Copy link
Author

It's called "Composition Law" when written with pure. I'd still call it "Composition".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants