Skip to content

Commit 5bbd04f

Browse files
authored
Merge pull request #25 from purescript/compiler/0.12
Updates for 0.12
2 parents 0c14b63 + 31d3c33 commit 5bbd04f

File tree

5 files changed

+73
-27
lines changed

5 files changed

+73
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/bower_components/
66
/node_modules/
77
/output/
8+
package-lock.json

LICENSE

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
The MIT License (MIT)
1+
Copyright 2018 PureScript
22

3-
Copyright (c) 2014 PureScript
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
45

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of
6-
this software and associated documentation files (the "Software"), to deal in
7-
the Software without restriction, including without limitation the rights to
8-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9-
the Software, and to permit persons to whom the Software is furnished to do so,
10-
subject to the following conditions:
6+
1. Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
118

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation and/or
11+
other materials provided with the distribution.
1412

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software without
15+
specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

bower.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
"Gary Burgess <gary.burgess@gmail.com>",
77
"John A. De Goes <john@degoes.net>"
88
],
9-
"description": "Call-by-need values",
10-
"license": "MIT",
9+
"license": "BSD-3-Clause",
1110
"repository": {
1211
"type": "git",
1312
"url": "git://github.com/purescript/purescript-lazy.git"
@@ -21,6 +20,9 @@
2120
"package.json"
2221
],
2322
"dependencies": {
24-
"purescript-monoid": "^3.0.0"
23+
"purescript-control": "^4.0.0",
24+
"purescript-foldable-traversable": "^4.0.0",
25+
"purescript-invariant": "^4.0.0",
26+
"purescript-prelude": "^4.0.0"
2527
}
2628
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"build": "eslint src && pulp build -- --censor-lib --strict"
66
},
77
"devDependencies": {
8-
"eslint": "^3.17.1",
9-
"pulp": "^10.0.4",
10-
"purescript-psa": "^0.5.0-rc.1",
11-
"rimraf": "^2.6.1"
8+
"eslint": "^4.19.1",
9+
"pulp": "^12.2.0",
10+
"purescript-psa": "^0.6.0",
11+
"rimraf": "^2.6.2"
1212
}
1313
}

src/Data/Lazy.purs

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ import Prelude
55
import Control.Comonad (class Comonad)
66
import Control.Extend (class Extend)
77
import Control.Lazy as CL
8-
8+
import Data.Eq (class Eq1)
9+
import Data.Foldable (class Foldable, foldMap, foldl, foldr)
10+
import Data.FoldableWithIndex (class FoldableWithIndex)
911
import Data.Functor.Invariant (class Invariant, imapF)
12+
import Data.FunctorWithIndex (class FunctorWithIndex)
1013
import Data.HeytingAlgebra (implies, ff, tt)
11-
import Data.Monoid (class Monoid, mempty)
14+
import Data.Ord (class Ord1)
15+
import Data.Semigroup.Foldable (class Foldable1, fold1Default)
16+
import Data.Semigroup.Traversable (class Traversable1)
17+
import Data.Traversable (class Traversable, traverse)
18+
import Data.TraversableWithIndex (class TraversableWithIndex)
1219

1320
-- | `Lazy a` represents lazily-computed values of type `a`.
1421
-- |
@@ -44,14 +51,16 @@ instance euclideanRingLazy :: EuclideanRing a => EuclideanRing (Lazy a) where
4451
div a b = defer \_ -> force a / force b
4552
mod a b = defer \_ -> force a `mod` force b
4653

47-
instance fieldLazy :: Field a => Field (Lazy a)
48-
4954
instance eqLazy :: Eq a => Eq (Lazy a) where
5055
eq x y = (force x) == (force y)
5156

57+
derive instance eq1Lazy :: Eq1 Lazy
58+
5259
instance ordLazy :: Ord a => Ord (Lazy a) where
5360
compare x y = compare (force x) (force y)
5461

62+
derive instance ord1Lazy :: Ord1 Lazy
63+
5564
instance boundedLazy :: Bounded a => Bounded (Lazy a) where
5665
top = defer \_ -> top
5766
bottom = defer \_ -> bottom
@@ -75,6 +84,34 @@ instance booleanAlgebraLazy :: BooleanAlgebra a => BooleanAlgebra (Lazy a)
7584
instance functorLazy :: Functor Lazy where
7685
map f l = defer \_ -> f (force l)
7786

87+
instance functorWithIndexLazy :: FunctorWithIndex Unit Lazy where
88+
mapWithIndex f = map $ f unit
89+
90+
instance foldableLazy :: Foldable Lazy where
91+
foldr f z l = f (force l) z
92+
foldl f z l = f z (force l)
93+
foldMap f l = f (force l)
94+
95+
instance foldableWithIndexLazy :: FoldableWithIndex Unit Lazy where
96+
foldrWithIndex f = foldr $ f unit
97+
foldlWithIndex f = foldl $ f unit
98+
foldMapWithIndex f = foldMap $ f unit
99+
100+
instance foldable1Lazy :: Foldable1 Lazy where
101+
foldMap1 f l = f (force l)
102+
fold1 = fold1Default
103+
104+
instance traversableLazy :: Traversable Lazy where
105+
traverse f l = defer <<< const <$> f (force l)
106+
sequence l = defer <<< const <$> force l
107+
108+
instance traversableWithIndexLazy :: TraversableWithIndex Unit Lazy where
109+
traverseWithIndex f = traverse $ f unit
110+
111+
instance traversable1Lazy :: Traversable1 Lazy where
112+
traverse1 f l = defer <<< const <$> f (force l)
113+
sequence1 l = defer <<< const <$> force l
114+
78115
instance invariantLazy :: Invariant Lazy where
79116
imap = imapF
80117

0 commit comments

Comments
 (0)