Skip to content

Commit

Permalink
Add Category instance for Flip (#33)
Browse files Browse the repository at this point in the history
* Add Category instance for Flip

* Update CHANGELOG.md

* Fix formatting
  • Loading branch information
masaeedu authored Mar 14, 2021
1 parent 81ac75e commit e59244d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Breaking changes:

New features:

- `Semigroupoid` and `Category` instances for `Flip` (#33)

Bugfixes:

Other improvements:
Expand Down
6 changes: 6 additions & 0 deletions src/Data/Functor/Flip.purs
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ instance biapplicativeFlip :: Biapplicative p => Biapplicative (Flip p) where

instance contravariantFlip :: Profunctor p => Contravariant (Flip p b) where
cmap f (Flip a) = Flip (lcmap f a)

instance semigroupoidFlip :: Semigroupoid p => Semigroupoid (Flip p) where
compose (Flip a) (Flip b) = Flip $ compose b a

instance categoryFlip :: Category p => Category (Flip p) where
identity = Flip identity

0 comments on commit e59244d

Please sign in to comment.