Skip to content

Commit 1de584b

Browse files
authored
Merge pull request #27 from purescript/compiler/0.12
Updates for 0.12
2 parents 1145444 + 2bde9b5 commit 1de584b

File tree

12 files changed

+54
-45
lines changed

12 files changed

+54
-45
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/bower_components/
55
/node_modules/
66
/output/
7+
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: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{
22
"name": "purescript-profunctor",
33
"homepage": "https://github.com/purescript/purescript-profunctor",
4-
"description": "Profunctor typeclass for PureScript",
54
"authors": [
65
"Hardy Jones <[email protected]>",
76
"Sean Chalmers <[email protected]>",
87
"Phil Freeman <[email protected]>"
98
],
10-
"license": "MIT",
9+
"license": "BSD-3-Clause",
1110
"repository": {
1211
"type": "git",
1312
"url": "git://github.com/purescript/purescript-profunctor.git"
@@ -22,10 +21,14 @@
2221
"package.json"
2322
],
2423
"dependencies": {
25-
"purescript-contravariant": "^3.0.0",
26-
"purescript-distributive": "^3.0.0",
27-
"purescript-either": "^3.0.0",
28-
"purescript-exists": "^3.0.0",
29-
"purescript-tuples": "^4.0.0"
24+
"purescript-contravariant": "^4.0.0",
25+
"purescript-control": "^4.0.0",
26+
"purescript-distributive": "^4.0.0",
27+
"purescript-either": "^4.0.0",
28+
"purescript-exists": "^4.0.0",
29+
"purescript-invariant": "^4.0.0",
30+
"purescript-newtype": "^3.0.0",
31+
"purescript-prelude": "^4.0.0",
32+
"purescript-tuples": "^5.0.0"
3033
}
3134
}

package.json

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

src/Data/Profunctor.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@ import Data.Newtype (class Newtype, wrap, unwrap)
1717
-- |
1818
-- | Laws:
1919
-- |
20-
-- | - Identity: `dimap id id = id`
20+
-- | - Identity: `dimap identity identity = identity`
2121
-- | - Composition: `dimap f1 g1 <<< dimap f2 g2 = dimap (f1 >>> f2) (g1 <<< g2)`
2222
class Profunctor p where
2323
dimap :: forall a b c d. (a -> b) -> (c -> d) -> p b c -> p a d
2424

2525
-- | Map a function over the (contravariant) first type argument only.
26-
lmap :: forall a b c p. Profunctor p => (a -> b) -> p b c -> p a c
27-
lmap a2b = dimap a2b id
26+
lcmap :: forall a b c p. Profunctor p => (a -> b) -> p b c -> p a c
27+
lcmap a2b = dimap a2b identity
2828

2929
-- | Map a function over the (covariant) second type argument only.
3030
rmap :: forall a b c p. Profunctor p => (b -> c) -> p a b -> p a c
31-
rmap b2c = dimap id b2c
31+
rmap b2c = dimap identity b2c
3232

3333
-- | Lift a pure function into any `Profunctor` which is also a `Category`.
3434
arr :: forall a b p. Category p => Profunctor p => (a -> b) -> p a b
35-
arr f = rmap f id
35+
arr f = rmap f identity
3636

3737
unwrapIso :: forall p t a. Profunctor p => Newtype t a => p t t -> p a a
3838
unwrapIso = dimap wrap unwrap
3939

40-
wrapIso :: forall p t a. Profunctor p => Newtype t a => (t -> a) -> p a a -> p t t
40+
wrapIso :: forall p t a. Profunctor p => Newtype t a => (a -> t) -> p a a -> p t t
4141
wrapIso _ = dimap unwrap wrap
4242

4343
instance profunctorFn :: Profunctor (->) where

src/Data/Profunctor/Choice.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ fanin
8181
fanin l r = (l +++ r) >>> join
8282
where
8383
join :: p (Either c c) c
84-
join = dimap (either id id) id id
84+
join = dimap (either identity identity) identity identity
8585

8686
infixr 2 fanin as |||

src/Data/Profunctor/Costar.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Data.Distributive (class Distributive, distribute)
99
import Data.Either (Either(..), either)
1010
import Data.Functor.Invariant (class Invariant, imapF)
1111
import Data.Newtype (class Newtype)
12-
import Data.Profunctor (class Profunctor, lmap)
12+
import Data.Profunctor (class Profunctor, lcmap)
1313
import Data.Profunctor.Closed (class Closed)
1414
import Data.Profunctor.Cochoice (class Cochoice)
1515
import Data.Profunctor.Costrong (class Costrong)
@@ -27,7 +27,7 @@ instance semigroupoidCostar :: Extend f => Semigroupoid (Costar f) where
2727
compose (Costar f) (Costar g) = Costar (f =<= g)
2828

2929
instance categoryCostar :: Comonad f => Category (Costar f) where
30-
id = Costar extract
30+
identity = Costar extract
3131

3232
instance functorCostar :: Functor (Costar f a) where
3333
map f (Costar g) = Costar (f <<< g)
@@ -65,14 +65,14 @@ instance costrongCostar :: Functor f => Costrong (Costar f) where
6565

6666
instance cochoiceCostar :: Applicative f => Cochoice (Costar f) where
6767
unleft (Costar f) =
68-
let g = either id (\r -> g (pure (Right r))) <<< f
68+
let g = either identity (\r -> g (pure (Right r))) <<< f
6969
in Costar (g <<< map Left)
7070
unright (Costar f) =
71-
let g = either (\l -> g (pure (Left l))) id <<< f
71+
let g = either (\l -> g (pure (Left l))) identity <<< f
7272
in Costar (g <<< map Right)
7373

7474
instance closedCostar :: Functor f => Closed (Costar f) where
7575
closed (Costar f) = Costar \g x -> f (map (_ $ x) g)
7676

7777
hoistCostar :: forall f g a b. (g ~> f) -> Costar f a b -> Costar g a b
78-
hoistCostar f (Costar g) = Costar (lmap f g)
78+
hoistCostar f (Costar g) = Costar (lcmap f g)

src/Data/Profunctor/Cowrap.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Prelude
44

55
import Data.Newtype (class Newtype)
66
import Data.Functor.Contravariant (class Contravariant)
7-
import Data.Profunctor (class Profunctor, lmap)
7+
import Data.Profunctor (class Profunctor, lcmap)
88

99
-- | Provides a `Contravariant` over the first argument of a `Profunctor`.
1010
newtype Cowrap p b a = Cowrap (p a b)
@@ -17,4 +17,4 @@ instance showCowrap :: Show (p a b) => Show (Cowrap p b a) where
1717
show (Cowrap x) = "(Cowrap " <> show x <> ")"
1818

1919
instance contravariantCowrap :: Profunctor p => Contravariant (Cowrap p b) where
20-
cmap f (Cowrap a) = Cowrap (lmap f a)
20+
cmap f (Cowrap a) = Cowrap (lcmap f a)

src/Data/Profunctor/Join.purs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Prelude
55
import Data.Functor.Invariant (class Invariant)
66
import Data.Newtype (class Newtype)
77
import Data.Profunctor (class Profunctor, dimap)
8-
import Data.Monoid (class Monoid)
98

109
-- | Turns a `Profunctor` into a `Invariant` functor by equating the two type
1110
-- | arguments.
@@ -22,7 +21,7 @@ instance semigroupJoin :: Semigroupoid p => Semigroup (Join p a) where
2221
append (Join a) (Join b) = Join (a <<< b)
2322

2423
instance monoidJoin :: Category p => Monoid (Join p a) where
25-
mempty = Join id
24+
mempty = Join identity
2625

2726
instance invariantJoin :: Profunctor p => Invariant (Join p) where
2827
imap f g (Join a) = Join (dimap g f a)

src/Data/Profunctor/Split.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ unSplit :: forall f a b r. (forall x. (a -> x) -> (x -> b) -> f x -> r) -> Split
3030
unSplit f (Split e) = runExists (\(SplitF g h fx) -> f g h fx) e
3131

3232
liftSplit :: forall f a. f a -> Split f a a
33-
liftSplit = split id id
33+
liftSplit = split identity identity
3434

3535
lowerSplit :: forall f a. Invariant f => Split f a a -> f a
3636
lowerSplit = unSplit (flip imap)

src/Data/Profunctor/Star.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ instance semigroupoidStar :: Bind f => Semigroupoid (Star f) where
2929
compose (Star f) (Star g) = Star \x -> g x >>= f
3030

3131
instance categoryStar :: Monad f => Category (Star f) where
32-
id = Star pure
32+
identity = Star pure
3333

3434
instance functorStar :: Functor f => Functor (Star f a) where
3535
map f (Star g) = Star (map f <<< g)

src/Data/Profunctor/Strong.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ fanout
7878
fanout l r = split >>> (l *** r)
7979
where
8080
split :: p a (Tuple a a)
81-
split = dimap id (\a -> Tuple a a) id
81+
split = dimap identity (\a -> Tuple a a) identity
8282

8383
infixr 3 fanout as &&&

0 commit comments

Comments
 (0)