Skip to content

Commit 5bbf94d

Browse files
authored
Merge pull request #28 from garyb/updates
Add newtype instance for `Match`, tweak readme/build
2 parents 669e286 + 7188b6d commit 5bbf94d

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22
dist: trusty
33
sudo: required
4-
node_js: 6
4+
node_js: stable
55
install:
66
- npm install -g bower
77
- npm install

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# purescript-routing
22

3-
[![Latest release](http://img.shields.io/bower/v/purescript-routing.svg)](https://github.com/slamdata/purescript-routing/releases)
4-
[![Build Status](https://travis-ci.org/slamdata/purescript-routing.svg?branch=master)](https://travis-ci.org/slamdata/purescript-routing)
5-
[![Dependency Status](https://www.versioneye.com/user/projects/56e4cf18df573d00495abcf7/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56e4cf18df573d00495abcf7)
3+
[![Latest release](http://img.shields.io/github/release/slamdata/purescript-routing.svg)](https://github.com/slamdata/purescript-routing/releases)
4+
[![Build status](https://travis-ci.org/slamdata/purescript-routing.svg?branch=master)](https://travis-ci.org/slamdata/purescript-routing)
65

76
Client side routing library.
87

src/Routing/Match.purs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
module Routing.Match where
22

3+
import Prelude
34

4-
import Prelude (class Applicative, class Apply, class Functor, pure, bind, const, one, id, unit, ($), (<<<), (<$>), (<>), (*), (==))
5-
import Data.Either (Either(..))
6-
import Data.Tuple (Tuple(..), snd)
7-
import Data.Maybe (Maybe(..))
8-
import Data.List (List(..), reverse)
95
import Control.Alt (class Alt, (<|>))
10-
import Control.Plus (class Plus)
116
import Control.Alternative (class Alternative)
12-
import Global (readFloat, isNaN)
13-
import Data.Semiring.Free (Free(), free)
7+
import Control.Plus (class Plus)
8+
9+
import Data.Either (Either(..))
1410
import Data.Foldable (foldl)
11+
import Data.List (List(..), reverse)
12+
import Data.Map as M
13+
import Data.Maybe (Maybe(..))
14+
import Data.Newtype (class Newtype, unwrap)
15+
import Data.Semiring.Free (Free(), free)
16+
import Data.Tuple (Tuple(..), snd)
1517
import Data.Validation.Semiring (V, invalid, unV)
16-
import Data.Newtype (unwrap)
17-
1818

19-
import Data.Map as M
19+
import Global (readFloat, isNaN)
2020

21-
import Routing.Types (Route, RoutePart(..))
2221
import Routing.Match.Class (class MatchClass)
2322
import Routing.Match.Error (MatchError(..), showMatchError)
23+
import Routing.Types (Route, RoutePart(..))
2424

2525
newtype Match a = Match (Route -> V (Free MatchError) (Tuple Route a))
26-
unMatch :: forall a. Match a -> (Route -> V (Free MatchError) (Tuple Route a))
27-
unMatch (Match a) = a
26+
27+
-- Manual instance due to the `Route` synonym in the above
28+
instance newtypeMatch :: Newtype (Match a) (List RoutePart -> V (Free MatchError) (Tuple (List RoutePart) a)) where
29+
wrap = Match
30+
unwrap (Match m) = m
2831

2932
instance matchMatchClass :: MatchClass Match where
3033
lit input = Match \route ->

0 commit comments

Comments
 (0)