Skip to content

Commit cf3674f

Browse files
committed
Further updates for v1.0.0
1 parent a2ded28 commit cf3674f

File tree

7 files changed

+62
-149
lines changed

7 files changed

+62
-149
lines changed

.travis.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
language: node_js
2-
sudo: false
3-
node_js:
4-
- 0.10
2+
dist: trusty
3+
sudo: required
4+
node_js: 6
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 bower gulp -g
13-
- npm install && bower install
12+
- npm install -g bower
13+
- npm install
14+
- bower install
1415
script:
15-
- gulp
16+
- npm run -s build
17+
after_success:
18+
- >-
19+
test $TRAVIS_TAG &&
20+
echo $GITHUB_TOKEN | pulp login &&
21+
echo y | pulp publish --no-push

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# purescript-these
22

3+
[![Latest release](http://img.shields.io/bower/v/purescript-these.svg)](https://github.com/purescript/purescript-these/releases)
34
[![Build Status](https://travis-ci.org/purescript-contrib/purescript-these.svg?branch=master)](https://travis-ci.org/purescript-contrib/purescript-these)
5+
[![Dependency Status](https://www.versioneye.com/user/projects/57553f1e7757a0004a1ddf1d/badge.svg?style=flat)](https://www.versioneye.com/user/projects/57553f1e7757a0004a1ddf1d)
6+
[![Maintainer: garyb](https://img.shields.io/badge/maintainer-garyb-lightgrey.svg)](http://github.com/garyb)
47

58
Data type isomorphic to `α ∨ β ∨ (α ∧ β)`
69

@@ -10,6 +13,6 @@ Data type isomorphic to `α ∨ β ∨ (α ∧ β)`
1013
bower install purescript-these
1114
```
1215

13-
## Module documentation
16+
## Documentation
1417

15-
- [Data.These](docs/Data.These.md)
18+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-these).

bower.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
{
22
"name": "purescript-these",
3+
"homepage": "https://github.com/purescript-contrib/purescript-these",
34
"description": "Data type isomorphic to: α ∨ β ∨ (α ∧ β)",
45
"license": "MIT",
56
"repository": {
67
"type": "git",
78
"url": "git://github.com/purescript-contrib/purescript-these.git"
89
},
10+
"ignore": [
11+
"**/.*",
12+
"bower_components",
13+
"node_modules",
14+
"output",
15+
"test",
16+
"bower.json",
17+
"package.json"
18+
],
919
"dependencies": {
10-
"purescript-foldable-traversable": "^1.0.0",
11-
"purescript-tuples": "^1.0.0"
20+
"purescript-generics": "^1.0.0"
1221
}
1322
}

docs/Data.These.md

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

gulpfile.js

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

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"private": true,
3+
"scripts": {
4+
"clean": "rimraf output && rimraf .pulp-cache",
5+
"build": "pulp build --censor-lib --strict"
6+
},
37
"devDependencies": {
4-
"gulp": "^3.8.11",
5-
"gulp-plumber": "^1.0.0",
6-
"gulp-purescript": "^0.5.0",
7-
"rimraf": "^2.3.3"
8+
"pulp": "^9.0.0",
9+
"purescript-psa": "^0.3.9",
10+
"rimraf": "^2.5.0"
811
}
912
}

src/Data/These.purs

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
module Data.These where
22

33
import Prelude
4-
( ($)
5-
, (<$>)
6-
, (<*>)
7-
, (<<<)
8-
, (<>)
9-
, class Applicative
10-
, class Apply
11-
, class Bind
12-
, class Functor
13-
, class Monad
14-
, class Semigroup
15-
, class Show
16-
, show
17-
, pure
18-
, id
19-
)
4+
5+
import Control.Extend (class Extend)
206

217
import Data.Bifunctor (class Bifunctor)
228
import Data.Bitraversable (class Bitraversable, class Bifoldable, bitraverse)
9+
import Data.Functor.Invariant (class Invariant, imapF)
10+
import Data.Generic (class Generic)
2311
import Data.Maybe (Maybe(..))
2412
import Data.Traversable (class Traversable, class Foldable, foldMap, foldl, foldr)
2513
import Data.Tuple (Tuple(..))
2614

27-
data These a b = This a
28-
| That b
29-
| Both a b
15+
data These a b
16+
= This a
17+
| That b
18+
| Both a b
19+
20+
derive instance eqThese :: (Eq a, Eq b) => Eq (These a b)
21+
derive instance ordThese :: (Ord a, Ord b) => Ord (These a b)
22+
derive instance genericThese :: (Generic a, Generic b) => Generic (These a b)
3023

3124
instance semigroupThese :: (Semigroup a, Semigroup b) => Semigroup (These a b) where
3225
append (This a) (This b) = This (a <> b)
@@ -44,6 +37,9 @@ instance functorThese :: Functor (These a) where
4437
map f (That a) = That (f a)
4538
map _ (This a) = This a
4639

40+
instance invariantThese :: Invariant (These a) where
41+
imap = imapF
42+
4743
instance foldableThese :: Foldable (These a) where
4844
foldr f z = foldr f z <<< theseRight
4945
foldl f z = foldl f z <<< theseRight
@@ -88,17 +84,22 @@ instance applicativeThese :: Semigroup a => Applicative (These a) where
8884
instance bindThese :: Semigroup a => Bind (These a) where
8985
bind (This a) _ = This a
9086
bind (That x) k = k x
91-
bind (Both a x) k = case k x of
92-
This b -> This (a <> b)
93-
That y -> Both a y
94-
Both b y -> Both (a <> b) y
87+
bind (Both a x) k =
88+
case k x of
89+
This b -> This (a <> b)
90+
That y -> Both a y
91+
Both b y -> Both (a <> b) y
9592

9693
instance monadThese :: Semigroup a => Monad (These a)
9794

95+
instance extendEither :: Extend (These a) where
96+
extend _ (This a) = This a
97+
extend f x = map (const (f x)) x
98+
9899
instance showThese :: (Show a, Show b) => Show (These a b) where
99-
show (This x) = "This (" <> show x <> ")"
100-
show (That y) = "That (" <> show y <> ")"
101-
show (Both x y) = "Both (" <> show x <> ") (" <> show y <> ")"
100+
show (This x) = "(This " <> show x <> ")"
101+
show (That y) = "(That " <> show y <> ")"
102+
show (Both x y) = "(Both " <> show x <> " " <> show y <> ")"
102103

103104
these :: forall a b c. (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c
104105
these l _ _ (This a) = l a

0 commit comments

Comments
 (0)