Skip to content

Commit 18ed0f3

Browse files
committed
Updates for PureScript 0.8
1 parent 7ed53c6 commit 18ed0f3

File tree

7 files changed

+78
-84
lines changed

7 files changed

+78
-84
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
/bower_components/
55
/node_modules/
66
/output/
7-
/tmp/

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
language: node_js
22
sudo: false
33
node_js:
4-
- 0.10
4+
- 5
55
env:
66
- PATH=$HOME/purescript:$PATH
77
install:
88
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
99
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
1010
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
1111
- chmod a+x $HOME/purescript
12+
- npm install -g bower
1213
- npm install
1314
script:
1415
- npm run build
16+
after_success:
17+
- >-
18+
test $TRAVIS_TAG &&
19+
psc-publish > .pursuit.json &&
20+
curl -X POST http://pursuit.purescript.org/packages \
21+
-d @.pursuit.json \
22+
-H 'Accept: application/json' \
23+
-H "Authorization: token ${GITHUB_TOKEN}"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ Constant data type.
1212
bower install purescript-const
1313
```
1414

15-
## Module documentation
15+
## Documentation
1616

17-
- [Data.Const](docs/Data/Const.md)
17+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-const).

bower.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
"name": "purescript-const",
33
"homepage": "https://github.com/purescript/purescript-const",
44
"description": "Constant data type for PureScript",
5-
"keywords": [
6-
"purescript",
7-
"const",
8-
"constant"
9-
],
105
"authors": [
116
"Hardy Jones <[email protected]>",
127
"Gary Burgess <[email protected]>",
@@ -27,7 +22,7 @@
2722
"package.json"
2823
],
2924
"dependencies": {
30-
"purescript-contravariant": "^0.2.0",
31-
"purescript-foldable-traversable": "^0.4.0"
25+
"purescript-contravariant": "^1.0.0",
26+
"purescript-foldable-traversable": "^1.0.0"
3227
}
3328
}

docs/Data/Const.md

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

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
"private": true,
33
"scripts": {
44
"postinstall": "pulp dep install",
5-
"build": "pulp build && rimraf docs && pulp docs"
5+
"clean": "rimraf output && rimraf .pulp-cache",
6+
"build": "pulp build"
67
},
78
"devDependencies": {
8-
"pulp": "^4.0.1",
9-
"rimraf": "^2.4.1"
9+
"pulp": "^7.0.0",
10+
"rimraf": "^2.5.0"
1011
}
1112
}

src/Data/Const.purs

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
-- | This module defines the `Const` type constructor.
2-
31
module Data.Const where
42

5-
import Prelude
6-
7-
import Data.Bifoldable (Bifoldable)
8-
import Data.Foldable (Foldable)
9-
import Data.Functor.Contravariant (Contravariant)
10-
import Data.Functor.Invariant (Invariant, imapF)
11-
import Data.Monoid (Monoid, mempty)
12-
import Data.Traversable (Traversable)
3+
import Control.Applicative (class Applicative, pure)
4+
import Control.Apply (class Apply)
5+
import Control.Bind (class Bind)
6+
import Control.Semigroupoid (class Semigroupoid)
7+
8+
import Data.BooleanAlgebra (class BooleanAlgebra, not, (||), (&&))
9+
import Data.Bounded (class Bounded, bottom, top)
10+
import Data.BoundedOrd (class BoundedOrd)
11+
import Data.DivisionRing (class DivisionRing)
12+
import Data.Eq (class Eq, (==))
13+
import Data.Foldable (class Foldable)
14+
import Data.Functor (class Functor)
15+
import Data.Functor.Contravariant (class Contravariant)
16+
import Data.Functor.Invariant (class Invariant, imapF)
17+
import Data.ModuloSemiring (class ModuloSemiring, mod, (/))
18+
import Data.Monoid (class Monoid, mempty)
19+
import Data.Num (class Num)
20+
import Data.Ord (class Ord, compare)
21+
import Data.Ring (class Ring, (-))
22+
import Data.Semigroup (class Semigroup, (<>))
23+
import Data.Semiring (class Semiring, one, zero, (+), (*))
24+
import Data.Show (class Show, show)
25+
import Data.Traversable (class Traversable)
1326

1427
-- | The `Const` type constructor, which wraps its first type argument
1528
-- | and ignores its second. That is, `Const a b` is isomorphic to `a`
@@ -24,46 +37,70 @@ newtype Const a b = Const a
2437
getConst :: forall a b. Const a b -> a
2538
getConst (Const x) = x
2639

27-
instance eqConst :: (Eq a) => Eq (Const a b) where
40+
instance eqConst :: Eq a => Eq (Const a b) where
2841
eq (Const x) (Const y) = x == y
2942

30-
instance ordConst :: (Ord a) => Ord (Const a b) where
43+
instance ordConst :: Ord a => Ord (Const a b) where
3144
compare (Const x) (Const y) = compare x y
3245

33-
instance boundedConst :: (Bounded a) => Bounded (Const a b) where
46+
instance boundedConst :: Bounded a => Bounded (Const a b) where
3447
top = Const top
3548
bottom = Const bottom
3649

37-
instance showConst :: (Show a) => Show (Const a b) where
38-
show (Const x) = "Const (" ++ show x ++ ")"
50+
instance boundedOrdConst :: BoundedOrd a => BoundedOrd (Const a b)
51+
52+
instance showConst :: Show a => Show (Const a b) where
53+
show (Const x) = "(Const " <> show x <> ")"
3954

4055
instance semigroupoidConst :: Semigroupoid Const where
4156
compose _ (Const x) = Const x
4257

43-
instance semigroupConst :: (Semigroup a) => Semigroup (Const a b) where
58+
instance semigroupConst :: Semigroup a => Semigroup (Const a b) where
4459
append (Const x) (Const y) = Const (x <> y)
4560

46-
instance monoidConst :: (Monoid a) => Monoid (Const a b) where
61+
instance monoidConst :: Monoid a => Monoid (Const a b) where
4762
mempty = Const mempty
4863

64+
instance semiringConst :: Semiring a => Semiring (Const a b) where
65+
add (Const x) (Const y) = Const (x + y)
66+
zero = Const zero
67+
mul (Const x) (Const y) = Const (x * y)
68+
one = Const one
69+
70+
instance ringConst :: Ring a => Ring (Const a b) where
71+
sub (Const x) (Const y) = Const (x - y)
72+
73+
instance moduloSemiringConst :: ModuloSemiring a => ModuloSemiring (Const a b) where
74+
div (Const x) (Const y) = Const (x / y)
75+
mod (Const x) (Const y) = Const (x `mod` y)
76+
77+
instance divisionRingConst :: DivisionRing a => DivisionRing (Const a b)
78+
79+
instance numConst :: Num a => Num (Const a b)
80+
81+
instance booleanAlgebraConst :: BooleanAlgebra a => BooleanAlgebra (Const a b) where
82+
conj (Const x) (Const y) = Const (x && y)
83+
disj (Const x) (Const y) = Const (x || y)
84+
not (Const x) = Const (not x)
85+
4986
instance functorConst :: Functor (Const a) where
5087
map _ (Const x) = Const x
5188

5289
instance invariantConst :: Invariant (Const a) where
5390
imap = imapF
5491

55-
instance applyConst :: (Semigroup a) => Apply (Const a) where
92+
instance contravariantConst :: Contravariant (Const a) where
93+
cmap _ (Const x) = Const x
94+
95+
instance applyConst :: Semigroup a => Apply (Const a) where
5696
apply (Const x) (Const y) = Const (x <> y)
5797

58-
instance bindConst :: (Semigroup a) => Bind (Const a) where
98+
instance bindConst :: Semigroup a => Bind (Const a) where
5999
bind (Const x) _ = Const x
60100

61-
instance applicativeConst :: (Monoid a) => Applicative (Const a) where
101+
instance applicativeConst :: Monoid a => Applicative (Const a) where
62102
pure _ = Const mempty
63103

64-
instance contravariantConst :: Contravariant (Const a) where
65-
cmap _ (Const x) = Const x
66-
67104
instance foldableConst :: Foldable (Const a) where
68105
foldr _ z _ = z
69106
foldl _ z _ = z

0 commit comments

Comments
 (0)