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

Category cat => Monoid (Join cat a) #64

Open
Icelandjack opened this issue Sep 23, 2017 · 0 comments
Open

Category cat => Monoid (Join cat a) #64

Icelandjack opened this issue Sep 23, 2017 · 0 comments

Comments

@Icelandjack
Copy link
Contributor

Icelandjack commented Sep 23, 2017

instance Category cat => Semigroup (Join cat a) where
  Join f <> Join g = Join (f . g)

instance Category cat => Monoid (Join cat a) where
  mempty  = Join id
  mappend = (<>)

This allows deriving Monoid (Kleisli m a a) and

newtype Endo a = Endo { appEndo :: Join (->) a }
  deriving 
    (Semigroup, Monoid)
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

1 participant