Skip to content

Update to v0.14.0-rc3 #38

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
Oct 24, 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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ node_js: stable
env:
- PATH=$HOME/purescript:$PATH
install:
- TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest))
# - TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest))
- TAG=v0.14.0-rc3
- curl --location --output $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
- chmod a+x $HOME/purescript
Expand Down
16 changes: 8 additions & 8 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
"package.json"
],
"dependencies": {
"purescript-control": "^4.0.0",
"purescript-foldable-traversable": "^4.0.0",
"purescript-maybe": "^4.0.0",
"purescript-prelude": "^4.0.0",
"purescript-tuples": "^5.0.0",
"purescript-unfoldable": "^4.0.0"
"purescript-control": "master",
"purescript-foldable-traversable": "master",
"purescript-maybe": "master",
"purescript-prelude": "master",
"purescript-tuples": "master",
"purescript-unfoldable": "master"
},
"devDependencies": {
"purescript-assert": "^4.0.0",
"purescript-console": "^4.0.0"
"purescript-assert": "master",
"purescript-console": "master"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"devDependencies": {
"pulp": "^15.0.0",
"purescript-psa": "^0.6.0",
"purescript-psa": "^0.8.0",
"rimraf": "^2.6.2"
}
}
4 changes: 3 additions & 1 deletion src/Data/NonEmpty.purs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Data.Eq (class Eq1)
import Data.Foldable (class Foldable, foldl, foldr, foldMap)
import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex)
import Data.FunctorWithIndex (class FunctorWithIndex, mapWithIndex)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..), maybe)
import Data.Ord (class Ord1)
import Data.Semigroup.Foldable (class Foldable1, foldMap1)
import Data.Traversable (class Traversable, traverse, sequence)
Expand Down Expand Up @@ -107,6 +107,8 @@ instance traversableWithIndexNonEmpty
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 = foldl1

instance unfoldable1NonEmpty :: Unfoldable f => Unfoldable1 (NonEmpty f) where
unfoldr1 f b = uncurry (:|) $ unfoldr (map f) <$> f b
5 changes: 3 additions & 2 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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)
import Data.Semigroup.Foldable (fold1, foldr1)
import Data.Unfoldable1 as U1
import Effect (Effect)
import Test.Assert (assert)
Expand All @@ -19,7 +19,8 @@ main :: Effect Unit
main = do
assert $ singleton 0 == 0 :| []
assert $ 0 :| Nothing /= 0 :| Just 1
assert $ foldl1 (+) (1 :| [2, 3]) == 6
assert $ foldl1 (\l r -> "(" <> l <> r <> ")") ("a" :| ["b", "c", "d"]) == "(((ab)c)d)"
assert $ foldr1 (\l r -> "(" <> l <> r <> ")") ("a" :| ["b", "c", "d"]) == "(a(b(cd)))"
assert $ foldl (+) 0 (1 :| [2, 3]) == 6
assert $ fold1 ("Hello" :| [" ", "World"]) == "Hello World"
assert $ fold ("Hello" :| [" ", "World"]) == "Hello World"
Expand Down