Skip to content

Commit 291a90a

Browse files
authored
Merge pull request #38 from paluh/updateTo14
Update to v0.14.0-rc3
2 parents 4cc48f6 + 9577d11 commit 291a90a

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ node_js: stable
55
env:
66
- PATH=$HOME/purescript:$PATH
77
install:
8-
- TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest))
8+
# - TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest))
9+
- TAG=v0.14.0-rc3
910
- curl --location --output $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
1011
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
1112
- chmod a+x $HOME/purescript

bower.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
"package.json"
1717
],
1818
"dependencies": {
19-
"purescript-control": "^4.0.0",
20-
"purescript-foldable-traversable": "^4.0.0",
21-
"purescript-maybe": "^4.0.0",
22-
"purescript-prelude": "^4.0.0",
23-
"purescript-tuples": "^5.0.0",
24-
"purescript-unfoldable": "^4.0.0"
19+
"purescript-control": "master",
20+
"purescript-foldable-traversable": "master",
21+
"purescript-maybe": "master",
22+
"purescript-prelude": "master",
23+
"purescript-tuples": "master",
24+
"purescript-unfoldable": "master"
2525
},
2626
"devDependencies": {
27-
"purescript-assert": "^4.0.0",
28-
"purescript-console": "^4.0.0"
27+
"purescript-assert": "master",
28+
"purescript-console": "master"
2929
}
3030
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"devDependencies": {
99
"pulp": "^15.0.0",
10-
"purescript-psa": "^0.6.0",
10+
"purescript-psa": "^0.8.0",
1111
"rimraf": "^2.6.2"
1212
}
1313
}

src/Data/NonEmpty.purs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Data.Eq (class Eq1)
2020
import Data.Foldable (class Foldable, foldl, foldr, foldMap)
2121
import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex)
2222
import Data.FunctorWithIndex (class FunctorWithIndex, mapWithIndex)
23-
import Data.Maybe (Maybe(..))
23+
import Data.Maybe (Maybe(..), maybe)
2424
import Data.Ord (class Ord1)
2525
import Data.Semigroup.Foldable (class Foldable1, foldMap1)
2626
import Data.Traversable (class Traversable, traverse, sequence)
@@ -107,6 +107,8 @@ instance traversableWithIndexNonEmpty
107107
instance foldable1NonEmpty :: Foldable f => Foldable1 (NonEmpty f) where
108108
fold1 = foldMap1 identity
109109
foldMap1 f (a :| fa) = foldl (\s a1 -> s <> f a1) (f a) fa
110+
foldr1 f (a :| fa) = maybe a (f a) $ foldr (\a1 -> Just <<< maybe a1 (f a1)) Nothing fa
111+
foldl1 = foldl1
110112

111113
instance unfoldable1NonEmpty :: Unfoldable f => Unfoldable1 (NonEmpty f) where
112114
unfoldr1 f b = uncurry (:|) $ unfoldr (map f) <$> f b

test/Main.purs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Prelude
55
import Data.Foldable (fold, foldl)
66
import Data.Maybe (Maybe(..))
77
import Data.NonEmpty (NonEmpty, (:|), foldl1, oneOf, head, tail, singleton)
8-
import Data.Semigroup.Foldable (fold1)
8+
import Data.Semigroup.Foldable (fold1, foldr1)
99
import Data.Unfoldable1 as U1
1010
import Effect (Effect)
1111
import Test.Assert (assert)
@@ -19,7 +19,8 @@ main :: Effect Unit
1919
main = do
2020
assert $ singleton 0 == 0 :| []
2121
assert $ 0 :| Nothing /= 0 :| Just 1
22-
assert $ foldl1 (+) (1 :| [2, 3]) == 6
22+
assert $ foldl1 (\l r -> "(" <> l <> r <> ")") ("a" :| ["b", "c", "d"]) == "(((ab)c)d)"
23+
assert $ foldr1 (\l r -> "(" <> l <> r <> ")") ("a" :| ["b", "c", "d"]) == "(a(b(cd)))"
2324
assert $ foldl (+) 0 (1 :| [2, 3]) == 6
2425
assert $ fold1 ("Hello" :| [" ", "World"]) == "Hello World"
2526
assert $ fold ("Hello" :| [" ", "World"]) == "Hello World"

0 commit comments

Comments
 (0)