Skip to content

Fix Foldable1 instance; update CI to v0.14.0-rc5 #44

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

Merged
merged 3 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "0.14.0-rc3"
purescript: "0.14.0-rc5"

- uses: actions/setup-node@v1
with:
Expand Down
3 changes: 1 addition & 2 deletions src/Data/NonEmpty.purs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlW
import Data.FunctorWithIndex (class FunctorWithIndex, mapWithIndex)
import Data.Maybe (Maybe(..), maybe)
import Data.Ord (class Ord1)
import Data.Semigroup.Foldable (class Foldable1, foldMap1)
import Data.Semigroup.Foldable (class Foldable1)
import Data.Semigroup.Foldable (foldl1) as Foldable1
import Data.Traversable (class Traversable, traverse, sequence)
import Data.TraversableWithIndex (class TraversableWithIndex, traverseWithIndex)
Expand Down Expand Up @@ -161,7 +161,6 @@ instance traversableWithIndexNonEmpty
NonEmpty <$> f Nothing a <*> traverseWithIndex (f <<< Just) fa

instance foldable1NonEmpty :: Foldable f => Foldable1 (NonEmpty f) where
fold1 = foldMap1 identity
foldMap1 f (a :| fa) = foldl (\s a1 -> s <> f a1) (f a) fa
foldr1 f (a :| fa) = maybe a (f a) $ foldr (\a1 -> Just <<< maybe a1 (f a1)) Nothing fa
foldl1 f (a :| fa) = foldl f a fa
Expand Down
4 changes: 2 additions & 2 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Prelude

import Data.Foldable (fold, foldl)
import Data.Maybe (Maybe(..))
import Data.NonEmpty (NonEmpty, (:|), foldl1, oneOf, head, tail, singleton)
import Data.Semigroup.Foldable (fold1, foldr1)
import Data.NonEmpty (NonEmpty, (:|), oneOf, head, tail, singleton)
import Data.Semigroup.Foldable (fold1, foldl1, foldr1)
import Data.Unfoldable1 as U1
import Effect (Effect)
import Test.Assert (assert)
Expand Down