Skip to content

fix: Fix Foldable1 (Coyoneda f) instance #105

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Data/Coyoneda.purs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Data.Exists (Exists, runExists, mkExists)
import Data.Foldable (class Foldable, foldMap, foldl, foldr)
import Data.Functor.Invariant (class Invariant, imapF)
import Data.Ord (class Ord1, compare1)
import Data.Semigroup.Foldable (class Foldable1, foldMap1)
import Data.Semigroup.Foldable (class Foldable1, foldMap1, foldr1Default, foldl1Default)
import Data.Semigroup.Traversable (class Traversable1, sequence1, traverse1)
import Data.Traversable (class Traversable, traverse)

Expand Down Expand Up @@ -126,6 +126,8 @@ instance traversableCoyoneda :: Traversable f => Traversable (Coyoneda f) where
instance foldable1Coyoneda :: Foldable1 f => Foldable1 (Coyoneda f) where
foldMap1 f = unCoyoneda \k -> foldMap1 (f <<< k)
fold1 = unCoyoneda \k -> foldMap1 k
foldr1 = foldr1Default
foldl1 = foldl1Default

instance traversable1Coyoneda :: Traversable1 f => Traversable1 (Coyoneda f) where
traverse1 f = unCoyoneda \k -> map liftCoyoneda <<< traverse1 (f <<< k)
Expand Down