Skip to content

Commit 3db300e

Browse files
authored
Merge pull request #51 from purescript/bump
Prepare for 2.0 release
2 parents 7a9f9a6 + 35323db commit 3db300e

File tree

9 files changed

+36
-82
lines changed

9 files changed

+36
-82
lines changed

bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"package.json"
1818
],
1919
"dependencies": {
20-
"purescript-bifunctors": "^1.0.0",
21-
"purescript-maybe": "^1.0.0"
20+
"purescript-bifunctors": "^2.0.0",
21+
"purescript-maybe": "^2.0.0"
2222
},
2323
"devDependencies": {
24-
"purescript-assert": "^1.0.0",
25-
"purescript-console": "^1.0.0",
26-
"purescript-integers": "^1.0.0",
24+
"purescript-assert": "^2.0.0",
25+
"purescript-console": "^2.0.0",
26+
"purescript-integers": "^2.0.0",
2727
"purescript-math": "^2.0.0"
2828
}
2929
}

examples/Traversable.purs

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/Tree.purs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Data/Bifoldable.purs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
module Data.Bifoldable where
22

3-
import Control.Applicative (class Applicative, pure)
3+
import Prelude
4+
45
import Control.Apply (applySecond)
56

6-
import Data.BooleanAlgebra (class BooleanAlgebra)
7-
import Data.Function (id, flip, (<<<))
8-
import Data.Monoid (class Monoid, mempty, append, (<>))
9-
import Data.Monoid.Conj (Conj(..), runConj)
10-
import Data.Monoid.Disj (Disj(..), runDisj)
11-
import Data.Monoid.Dual (Dual(..), runDual)
12-
import Data.Monoid.Endo (Endo(..), runEndo)
13-
import Data.Unit (Unit, unit)
7+
import Data.Monoid (class Monoid, mempty)
8+
import Data.Monoid.Conj (Conj(..))
9+
import Data.Monoid.Disj (Disj(..))
10+
import Data.Monoid.Dual (Dual(..))
11+
import Data.Monoid.Endo (Endo(..))
12+
import Data.Newtype (unwrap)
1413

1514
-- | `Bifoldable` represents data structures with two type arguments which can be
1615
-- | folded.
@@ -46,8 +45,7 @@ bifoldrDefault
4645
-> c
4746
-> p a b
4847
-> c
49-
bifoldrDefault f g z p =
50-
runEndo (bifoldMap (Endo <<< f) (Endo <<< g) p) z
48+
bifoldrDefault f g z p = unwrap (bifoldMap (Endo <<< f) (Endo <<< g) p) z
5149

5250
-- | A default implementation of `bifoldl` using `bifoldMap`.
5351
-- |
@@ -62,8 +60,8 @@ bifoldlDefault
6260
-> p a b
6361
-> c
6462
bifoldlDefault f g z p =
65-
runEndo
66-
(runDual
63+
unwrap
64+
(unwrap
6765
(bifoldMap (Dual <<< Endo <<< flip f) (Dual <<< Endo <<< flip g) p))
6866
z
6967

@@ -136,7 +134,7 @@ biany
136134
-> (b -> c)
137135
-> t a b
138136
-> c
139-
biany p q = runDisj <<< bifoldMap (Disj <<< p) (Disj <<< q)
137+
biany p q = unwrap <<< bifoldMap (Disj <<< p) (Disj <<< q)
140138

141139
-- | Test whether a predicate holds at all positions in a data structure.
142140
biall
@@ -146,4 +144,4 @@ biall
146144
-> (b -> c)
147145
-> t a b
148146
-> c
149-
biall p q = runConj <<< bifoldMap (Conj <<< p) (Conj <<< q)
147+
biall p q = unwrap <<< bifoldMap (Conj <<< p) (Conj <<< q)

src/Data/Bitraversable.purs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ module Data.Bitraversable
66
, module Data.Bifoldable
77
) where
88

9-
import Control.Applicative (class Applicative)
10-
import Control.Category (id)
9+
import Prelude
1110

1211
import Data.Bifoldable (class Bifoldable, biall, biany, bifold, bifoldMap, bifoldMapDefaultL, bifoldMapDefaultR, bifoldl, bifoldlDefault, bifoldr, bifoldrDefault, bifor_, bisequence_, bitraverse_)
1312
import Data.Bifunctor (class Bifunctor, bimap)

src/Data/Foldable.purs

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,21 @@ module Data.Foldable
2222
, minimumBy
2323
) where
2424

25-
import Control.Applicative (class Applicative, pure)
26-
import Control.Apply ((*>))
25+
import Prelude
26+
2727
import Control.Plus (class Plus, alt, empty)
2828

29-
import Data.BooleanAlgebra (class BooleanAlgebra, not)
30-
import Data.Eq (class Eq, (==))
31-
import Data.Function (id, flip, (<<<))
3229
import Data.Maybe (Maybe(..))
3330
import Data.Maybe.First (First(..))
3431
import Data.Maybe.Last (Last(..))
35-
import Data.Monoid (class Monoid, mempty, (<>))
32+
import Data.Monoid (class Monoid, mempty)
3633
import Data.Monoid.Additive (Additive(..))
37-
import Data.Monoid.Conj (Conj(..), runConj)
38-
import Data.Monoid.Disj (Disj(..), runDisj)
39-
import Data.Monoid.Dual (Dual(..), runDual)
40-
import Data.Monoid.Endo (Endo(..), runEndo)
34+
import Data.Monoid.Conj (Conj(..))
35+
import Data.Monoid.Disj (Disj(..))
36+
import Data.Monoid.Dual (Dual(..))
37+
import Data.Monoid.Endo (Endo(..))
4138
import Data.Monoid.Multiplicative (Multiplicative(..))
42-
import Data.Ord (class Ord, compare)
43-
import Data.Ordering (Ordering(..))
44-
import Data.Semiring (class Semiring, one, (*), zero, (+))
45-
import Data.Unit (Unit, unit)
39+
import Data.Newtype (alaF, unwrap)
4640

4741
-- | `Foldable` represents data structures which can be _folded_.
4842
-- |
@@ -76,7 +70,7 @@ foldrDefault
7670
-> b
7771
-> f a
7872
-> b
79-
foldrDefault c u xs = runEndo (foldMap (Endo <<< c) xs) u
73+
foldrDefault c u xs = unwrap (foldMap (Endo <<< c) xs) u
8074

8175
-- | A default implementation of `foldl` using `foldMap`.
8276
-- |
@@ -89,8 +83,7 @@ foldlDefault
8983
-> b
9084
-> f a
9185
-> b
92-
foldlDefault c u xs =
93-
runEndo (runDual (foldMap (Dual <<< Endo <<< flip c) xs)) u
86+
foldlDefault c u xs = unwrap (unwrap (foldMap (Dual <<< Endo <<< flip c) xs)) u
9487

9588
-- | A default implementation of `foldMap` using `foldr`.
9689
-- |
@@ -234,24 +227,24 @@ intercalate sep xs = (foldl go { init: true, acc: mempty } xs).acc
234227
-- | The conjunction of all the values in a data structure. When specialized
235228
-- | to `Boolean`, this function will test whether all of the values in a data
236229
-- | structure are `true`.
237-
and :: forall a f. (Foldable f, BooleanAlgebra a) => f a -> a
230+
and :: forall a f. (Foldable f, HeytingAlgebra a) => f a -> a
238231
and = all id
239232

240233
-- | The disjunction of all the values in a data structure. When specialized
241234
-- | to `Boolean`, this function will test whether any of the values in a data
242235
-- | structure is `true`.
243-
or :: forall a f. (Foldable f, BooleanAlgebra a) => f a -> a
236+
or :: forall a f. (Foldable f, HeytingAlgebra a) => f a -> a
244237
or = any id
245238

246239
-- | `all f` is the same as `and <<< map f`; map a function over the structure,
247240
-- | and then get the conjunction of the results.
248-
all :: forall a b f. (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b
249-
all p = runConj <<< foldMap (Conj <<< p)
241+
all :: forall a b f. (Foldable f, HeytingAlgebra b) => (a -> b) -> f a -> b
242+
all p = alaF Conj foldMap p
250243

251244
-- | `any f` is the same as `or <<< map f`; map a function over the structure,
252245
-- | and then get the disjunction of the results.
253-
any :: forall a b f. (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b
254-
any p = runDisj <<< foldMap (Disj <<< p)
246+
any :: forall a b f. (Foldable f, HeytingAlgebra b) => (a -> b) -> f a -> b
247+
any p = alaF Disj foldMap p
255248

256249
-- | Find the sum of the numeric values in a data structure.
257250
sum :: forall a f. (Foldable f, Semiring a) => f a -> a

src/Data/Traversable.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"use strict";
22

3-
// module Data.Traversable
4-
53
// jshint maxparams: 3
64

75
exports.traverseArrayImpl = function () {

src/Data/Traversable.purs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ module Data.Traversable
1010
, module Data.Foldable
1111
) where
1212

13-
import Control.Applicative (class Applicative, pure)
14-
import Control.Apply (class Apply, apply)
15-
import Control.Category (id)
13+
import Prelude
1614

1715
import Data.Foldable (class Foldable, all, and, any, elem, find, fold, foldMap, foldMapDefaultL, foldMapDefaultR, foldl, foldlDefault, foldr, foldrDefault, for_, intercalate, maximum, maximumBy, minimum, minimumBy, notElem, oneOf, or, product, sequence_, sum, traverse_)
18-
import Data.Functor (class Functor, map, (<$>))
1916
import Data.Maybe (Maybe(..))
2017
import Data.Maybe.First (First(..))
2118
import Data.Maybe.Last (Last(..))

test/Main.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"use strict";
22

3-
// module Test.Main
4-
53
exports.arrayFrom1UpTo = function (n) {
64
var result = [];
75
for (var i = 1; i <= n; i++) {

0 commit comments

Comments
 (0)