Skip to content

Commit da43e7d

Browse files
authored
Merge pull request #175 from purescript/compiler/0.12
Update for PureScript 0.12
2 parents e903fd2 + c276ea0 commit da43e7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1067
-60
lines changed

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) 2015 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "purescript-prelude",
33
"homepage": "https://github.com/purescript/purescript-prelude",
44
"description": "The PureScript Prelude",
5-
"license": "MIT",
5+
"license": "BSD-3-Clause",
66
"repository": {
77
"type": "git",
88
"url": "git://github.com/purescript/purescript-prelude.git"

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
55
"build": "eslint src && pulp build -- --censor-lib --strict",
6-
"test": "pulp test"
6+
"test": "pulp test --no-check-main"
77
},
88
"devDependencies": {
9-
"eslint": "^3.17.1",
10-
"purescript-psa": "^0.5.0-rc.1",
11-
"pulp": "^10.0.4",
12-
"rimraf": "^2.6.1"
9+
"eslint": "^4.19.1",
10+
"purescript-psa": "^0.6.0",
11+
"pulp": "^12.2.0",
12+
"rimraf": "^2.6.2"
1313
}
1414
}

src/Control/Applicative.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import Data.Unit (Unit, unit)
2525
-- | Instances must satisfy the following laws in addition to the `Apply`
2626
-- | laws:
2727
-- |
28-
-- | - Identity: `(pure id) <*> v = v`
28+
-- | - Identity: `(pure identity) <*> v = v`
2929
-- | - Composition: `pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`
3030
-- | - Homomorphism: `(pure f) <*> (pure x) = pure (f x)`
3131
-- | - Interchange: `u <*> (pure y) = (pure (_ $ y)) <*> u`

src/Control/Apply.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Control.Apply
88

99
import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
1010
import Data.Function (const)
11-
import Control.Category (id)
11+
import Control.Category (identity)
1212

1313
-- | The `Apply` class provides the `(<*>)` which is used to apply a function
1414
-- | to an argument under a type constructor.
@@ -53,7 +53,7 @@ infixl 4 applyFirst as <*
5353

5454
-- | Combine two effectful actions, keeping only the result of the second.
5555
applySecond :: forall a b f. Apply f => f a -> f b -> f b
56-
applySecond a b = const id <$> a <*> b
56+
applySecond a b = const identity <$> a <*> b
5757

5858
infixl 4 applySecond as *>
5959

src/Control/Bind.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Control.Bind
1313

1414
import Control.Applicative (class Applicative, liftA1, pure, unless, when)
1515
import Control.Apply (class Apply, apply, (*>), (<*), (<*>))
16-
import Control.Category (id)
16+
import Control.Category (identity)
1717

1818
import Data.Function (flip)
1919
import Data.Functor (class Functor, map, void, ($>), (<#>), (<$), (<$>))
@@ -81,7 +81,7 @@ instance discardUnit :: Discard Unit where
8181

8282
-- | Collapse two applications of a monadic type constructor into one.
8383
join :: forall a m. Bind m => m (m a) -> m a
84-
join m = m >>= id
84+
join m = m >>= identity
8585

8686
-- | Forwards Kleisli composition.
8787
-- |

src/Control/Category.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Control.Category
2-
( class Category, id
2+
( class Category, identity
33
, module Control.Semigroupoid
44
) where
55

@@ -12,9 +12,9 @@ import Control.Semigroupoid (class Semigroupoid, compose, (<<<), (>>>))
1212
-- | Instances must satisfy the following law in addition to the
1313
-- | `Semigroupoid` law:
1414
-- |
15-
-- | - Identity: `id <<< p = p <<< id = p`
15+
-- | - Identity: `identity <<< p = p <<< identity = p`
1616
class Semigroupoid a <= Category a where
17-
id :: forall t. a t t
17+
identity :: forall t. a t t
1818

1919
instance categoryFn :: Category (->) where
20-
id x = x
20+
identity x = x

src/Control/Semigroupoid.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Control.Semigroupoid where
22

33
-- | A `Semigroupoid` is similar to a [`Category`](#category) but does not
4-
-- | require an identity element `id`, just composable morphisms.
4+
-- | require an identity element `identity`, just composable morphisms.
55
-- |
66
-- | `Semigroupoid`s must satisfy the following law:
77
-- |

src/Data/BooleanAlgebra.purs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
module Data.BooleanAlgebra
22
( class BooleanAlgebra
33
, module Data.HeytingAlgebra
4+
, class BooleanAlgebraRecord
45
) where
56

6-
import Data.HeytingAlgebra (class HeytingAlgebra, ff, tt, implies, conj, disj, not, (&&), (||))
7+
import Data.HeytingAlgebra (class HeytingAlgebra, class HeytingAlgebraRecord, ff, tt, implies, conj, disj, not, (&&), (||))
8+
import Data.Symbol (class IsSymbol)
79
import Data.Unit (Unit)
10+
import Prim.Row as Row
11+
import Prim.RowList as RL
812

913
-- | The `BooleanAlgebra` type class represents types that behave like boolean
1014
-- | values.
@@ -19,3 +23,18 @@ class HeytingAlgebra a <= BooleanAlgebra a
1923
instance booleanAlgebraBoolean :: BooleanAlgebra Boolean
2024
instance booleanAlgebraUnit :: BooleanAlgebra Unit
2125
instance booleanAlgebraFn :: BooleanAlgebra b => BooleanAlgebra (a -> b)
26+
instance booleanAlgebraRecord :: (RL.RowToList row list, BooleanAlgebraRecord list row row) => BooleanAlgebra (Record row)
27+
28+
-- | A class for records where all fields have `BooleanAlgebra` instances, used
29+
-- | to implement the `BooleanAlgebra` instance for records.
30+
class HeytingAlgebraRecord rowlist row subrow <= BooleanAlgebraRecord rowlist row subrow | rowlist -> subrow
31+
32+
instance booleanAlgebraRecordNil :: BooleanAlgebraRecord RL.Nil row ()
33+
34+
instance booleanAlgebraRecordCons
35+
:: ( IsSymbol key
36+
, Row.Cons key focus subrowTail subrow
37+
, BooleanAlgebraRecord rowlistTail row subrowTail
38+
, BooleanAlgebra focus
39+
)
40+
=> BooleanAlgebraRecord (RL.Cons key focus rowlistTail) row subrow

src/Data/CommutativeRing.purs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ module Data.CommutativeRing
22
( class CommutativeRing
33
, module Data.Ring
44
, module Data.Semiring
5+
, class CommutativeRingRecord
56
) where
67

7-
import Data.Ring (class Ring)
8+
import Data.Ring (class Ring, class RingRecord)
89
import Data.Semiring (class Semiring, add, mul, one, zero, (*), (+))
10+
import Data.Symbol (class IsSymbol)
911
import Data.Unit (Unit)
12+
import Prim.Row as Row
13+
import Prim.RowList as RL
1014

1115
-- | The `CommutativeRing` class is for rings where multiplication is
1216
-- | commutative.
@@ -21,3 +25,18 @@ instance commutativeRingInt :: CommutativeRing Int
2125
instance commutativeRingNumber :: CommutativeRing Number
2226
instance commutativeRingUnit :: CommutativeRing Unit
2327
instance commutativeRingFn :: CommutativeRing b => CommutativeRing (a -> b)
28+
instance commutativeRingRecord :: (RL.RowToList row list, CommutativeRingRecord list row row) => CommutativeRing (Record row)
29+
30+
-- | A class for records where all fields have `CommutativeRing` instances, used
31+
-- | to implement the `CommutativeRing` instance for records.
32+
class RingRecord rowlist row subrow <= CommutativeRingRecord rowlist row subrow | rowlist -> subrow
33+
34+
instance commutativeRingRecordNil :: CommutativeRingRecord RL.Nil row ()
35+
36+
instance commutativeRingRecordCons
37+
:: ( IsSymbol key
38+
, Row.Cons key focus subrowTail subrow
39+
, CommutativeRingRecord rowlistTail row subrowTail
40+
, CommutativeRing focus
41+
)
42+
=> CommutativeRingRecord (RL.Cons key focus rowlistTail) row subrow

0 commit comments

Comments
 (0)