Skip to content

Commit f66c163

Browse files
authored
Updates for 0.11 (#49)
* Updates for 0.11 * Update bower.json
1 parent a826cdd commit f66c163

File tree

8 files changed

+42
-49
lines changed

8 files changed

+42
-49
lines changed

.travis.yml

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
language: node_js
22
dist: trusty
33
sudo: required
4-
node_js: 6
5-
env:
6-
- PATH=$HOME/purescript:$PATH
4+
node_js: stable
75
install:
8-
- 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')
9-
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
10-
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
11-
- chmod a+x $HOME/purescript
126
- npm install -g bower
137
- npm install
8+
- bower install
149
script:
15-
- bower install --production
1610
- npm run -s build
17-
- bower install
18-
- npm -s test
1911
after_success:
2012
- >-
2113
test $TRAVIS_TAG &&

bower.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020
"package.json"
2121
],
2222
"dependencies": {
23-
"purescript-arrays": "^3.0.0",
24-
"purescript-either": "^2.0.0",
25-
"purescript-foldable-traversable": "^2.0.0",
26-
"purescript-identity": "^2.0.0",
27-
"purescript-integers": "^2.0.0",
28-
"purescript-lists": "^3.0.0",
29-
"purescript-maybe": "^2.0.0",
30-
"purescript-strings": "^2.0.0",
31-
"purescript-transformers": "^2.0.0",
32-
"purescript-unicode": "^2.0.0"
23+
"purescript-arrays": "^4.0.0",
24+
"purescript-either": "^3.0.0",
25+
"purescript-foldable-traversable": "^3.0.0",
26+
"purescript-identity": "^3.0.0",
27+
"purescript-integers": "^3.0.0",
28+
"purescript-lists": "^4.0.0",
29+
"purescript-maybe": "^3.0.0",
30+
"purescript-strings": "^3.0.0",
31+
"purescript-transformers": "^3.0.0",
32+
"purescript-unicode": "^3.0.0"
3333
},
3434
"devDependencies": {
35-
"purescript-assert": "^2.0.0",
36-
"purescript-console": "^2.0.0"
35+
"purescript-assert": "^3.0.0",
36+
"purescript-console": "^3.0.0"
3737
}
3838
}

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "pulp build --censor-lib --strict",
6-
"test": "pulp test"
5+
"build": "pulp build && pulp test"
76
},
87
"devDependencies": {
9-
"pulp": "^9.0.1",
10-
"purescript-psa": "^0.3.9",
11-
"rimraf": "^2.5.0"
8+
"pulp": "^11.0.0",
9+
"purescript-psa": "^0.5.0",
10+
"purescript": "^0.11.1",
11+
"rimraf": "^2.5.4"
1212
}
1313
}

src/Text/Parsing/Parser.purs

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ module Text.Parsing.Parser
1515
import Prelude
1616
import Control.Alt (class Alt)
1717
import Control.Lazy (defer, class Lazy)
18-
import Control.Monad.Except (class MonadError, ExceptT(..), throwError, runExceptT, mapExceptT)
18+
import Control.Monad.Error.Class (class MonadThrow, throwError)
19+
import Control.Monad.Except (class MonadError, ExceptT(..), runExceptT, mapExceptT)
1920
import Control.Monad.Rec.Class (class MonadRec)
2021
import Control.Monad.State (runStateT, class MonadState, StateT(..), gets, evalStateT, mapStateT, modify)
21-
import Control.Monad.Trans.Class (lift, class MonadTrans)
22+
import Control.Monad.Trans.Class (class MonadTrans, lift)
2223
import Control.MonadPlus (class Alternative, class MonadZero, class MonadPlus, class Plus)
2324
import Data.Either (Either(..))
2425
import Data.Identity (Identity)
@@ -78,6 +79,7 @@ derive newtype instance bindParserT :: Monad m => Bind (ParserT s m)
7879
derive newtype instance monadParserT :: Monad m => Monad (ParserT s m)
7980
derive newtype instance monadRecParserT :: MonadRec m => MonadRec (ParserT s m)
8081
derive newtype instance monadStateParserT :: Monad m => MonadState (ParseState s) (ParserT s m)
82+
derive newtype instance monadThrowParserT :: Monad m => MonadThrow ParseError (ParserT s m)
8183
derive newtype instance monadErrorParserT :: Monad m => MonadError ParseError (ParserT s m)
8284

8385
instance altParserT :: Monad m => Alt (ParserT s m) where

src/Text/Parsing/Parser/Combinators.purs

+4-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ option a p = p <|> pure a
6060

6161
-- | Optionally parse something, failing quietly.
6262
optional :: forall m s a. Monad m => ParserT s m a -> ParserT s m Unit
63-
optional p = (void p) <|> pure unit
63+
optional p = void p <|> pure unit
6464

6565
-- | pure `Nothing` in the case where a parser fails without consuming input.
6666
optionMaybe :: forall m s a. Monad m => ParserT s m a -> ParserT s m (Maybe a)
@@ -154,7 +154,7 @@ chainr1' p f a = (do f' <- f
154154
pure $ f' a a') <|> pure a
155155

156156
-- | Parse one of a set of alternatives.
157-
choice :: forall f m s a. (Foldable f, Monad m) => f (ParserT s m a) -> ParserT s m a
157+
choice :: forall f m s a. Foldable f => Monad m => f (ParserT s m a) -> ParserT s m a
158158
choice = foldl (<|>) empty
159159

160160
-- | Skip many instances of a phrase.
@@ -177,10 +177,9 @@ manyTill :: forall s a m e. Monad m => ParserT s m a -> ParserT s m e -> ParserT
177177
manyTill p end = scan
178178
where
179179
scan = (end $> Nil)
180-
<|> (do
181-
x <- p
180+
<|> do x <- p
182181
xs <- scan
183-
pure (x:xs))
182+
pure (x:xs)
184183

185184
-- | Parse several phrases until the specified terminator matches, requiring at least one match.
186185
many1Till :: forall s a m e. Monad m => ParserT s m a -> ParserT s m e -> ParserT s m (List a)

src/Text/Parsing/Parser/String.purs

+9-9
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ instance stringLikeString :: StringLike String where
2929
null = S.null
3030

3131
-- | Match end-of-file.
32-
eof :: forall s m. (StringLike s, Monad m) => ParserT s m Unit
32+
eof :: forall s m. StringLike s => Monad m => ParserT s m Unit
3333
eof = do
3434
input <- gets \(ParseState input _ _) -> input
3535
unless (null input) (fail "Expected EOF")
3636

3737
-- | Match the specified string.
38-
string :: forall s m. (StringLike s, Monad m) => String -> ParserT s m String
38+
string :: forall s m. StringLike s => Monad m => String -> ParserT s m String
3939
string str = do
4040
input <- gets \(ParseState input _ _) -> input
4141
case indexOf (wrap str) input of
@@ -48,7 +48,7 @@ string str = do
4848
_ -> fail ("Expected " <> show str)
4949

5050
-- | Match any character.
51-
anyChar :: forall s m. (StringLike s, Monad m) => ParserT s m Char
51+
anyChar :: forall s m. StringLike s => Monad m => ParserT s m Char
5252
anyChar = do
5353
input <- gets \(ParseState input _ _) -> input
5454
case uncons input of
@@ -61,30 +61,30 @@ anyChar = do
6161
pure head
6262

6363
-- | Match a character satisfying the specified predicate.
64-
satisfy :: forall s m. (StringLike s, Monad m) => (Char -> Boolean) -> ParserT s m Char
64+
satisfy :: forall s m. StringLike s => Monad m => (Char -> Boolean) -> ParserT s m Char
6565
satisfy f = try do
6666
c <- anyChar
6767
if f c then pure c
6868
else fail $ "Character '" <> singleton c <> "' did not satisfy predicate"
6969

7070
-- | Match the specified character
71-
char :: forall s m. (StringLike s, Monad m) => Char -> ParserT s m Char
71+
char :: forall s m. StringLike s => Monad m => Char -> ParserT s m Char
7272
char c = satisfy (_ == c) <?> ("Expected " <> show c)
7373

7474
-- | Match a whitespace character.
75-
whiteSpace :: forall s m. (StringLike s, Monad m) => ParserT s m String
75+
whiteSpace :: forall s m. StringLike s => Monad m => ParserT s m String
7676
whiteSpace = do
7777
cs <- many $ satisfy \c -> c == '\n' || c == '\r' || c == ' ' || c == '\t'
7878
pure $ fromCharArray cs
7979

8080
-- | Skip whitespace characters.
81-
skipSpaces :: forall s m. (StringLike s, Monad m) => ParserT s m Unit
81+
skipSpaces :: forall s m. StringLike s => Monad m => ParserT s m Unit
8282
skipSpaces = void whiteSpace
8383

8484
-- | Match one of the characters in the array.
85-
oneOf :: forall s m. (StringLike s, Monad m) => Array Char -> ParserT s m Char
85+
oneOf :: forall s m. StringLike s => Monad m => Array Char -> ParserT s m Char
8686
oneOf ss = satisfy (flip elem ss) <?> ("Expected one of " <> show ss)
8787

8888
-- | Match any character not in the array.
89-
noneOf :: forall s m. (StringLike s, Monad m) => Array Char -> ParserT s m Char
89+
noneOf :: forall s m. StringLike s => Monad m => Array Char -> ParserT s m Char
9090
noneOf ss = satisfy (flip notElem ss) <?> ("Expected none of " <> show ss)

src/Text/Parsing/Parser/Token.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ when tokpos f = try $ do
6363
pure a
6464

6565
-- | Match the specified token at the head of the stream.
66-
match :: forall a m. (Monad m, Eq a) => (a -> Position) -> a -> ParserT (List a) m a
66+
match :: forall a m. Monad m => Eq a => (a -> Position) -> a -> ParserT (List a) m a
6767
match tokpos tok = when tokpos (_ == tok)
6868

6969
type LanguageDef = GenLanguageDef String Identity

test/Main.purs

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ parens = between (string "(") (string ")")
2525

2626
nested :: forall m. Monad m => ParserT String m Int
2727
nested = fix \p -> (do
28-
string "a"
28+
_ <- string "a"
2929
pure 0) <|> ((+) 1) <$> parens p
3030

31-
parseTest :: forall s a eff. (Show a, Eq a) => s -> a -> Parser s a -> Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
31+
parseTest :: forall s a eff. Show a => Eq a => s -> a -> Parser s a -> Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
3232
parseTest input expected p = case runParser input p of
3333
Right actual -> do
3434
assert' ("expected: " <> show expected <> ", actual: " <> show actual) (expected == actual)
3535
logShow actual
3636
Left err -> assert' ("error: " <> show err) false
3737

38-
parseErrorTestPosition :: forall s a eff. (Show a) => Parser s a -> s -> Position -> Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
38+
parseErrorTestPosition :: forall s a eff. Show a => Parser s a -> s -> Position -> Eff (console :: CONSOLE, assert :: ASSERT | eff) Unit
3939
parseErrorTestPosition p input expected = case runParser input p of
4040
Right _ -> assert' "error: ParseError expected!" false
4141
Left err -> do
@@ -69,7 +69,7 @@ exprTest = buildExprParser [ [ Infix (string "/" >>= \_ -> pure (/)) AssocRight
6969
manySatisfyTest :: Parser String String
7070
manySatisfyTest = do
7171
r <- some $ satisfy (\s -> s /= '?')
72-
char '?'
72+
_ <- char '?'
7373
pure (fromCharArray r)
7474

7575
data TestToken = A | B
@@ -427,7 +427,7 @@ main = do
427427
parseTest "(((a)))" 3 nested
428428
parseTest "aaa" (Cons "a" (Cons "a" (Cons "a" Nil))) $ many (string "a")
429429
parseTest "(ab)" (Just "b") $ parens do
430-
string "a"
430+
_ <- string "a"
431431
optionMaybe $ string "b"
432432
parseTest "a,a,a" (Cons "a" (Cons "a" (Cons "a" Nil))) $ string "a" `sepBy1` string ","
433433
parseTest "a,a,a," (Cons "a" (Cons "a" (Cons "a" Nil))) $ do

0 commit comments

Comments
 (0)