Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
"package.json"
],
"dependencies": {
"purescript-arrays": "^5.0.0",
"purescript-either": "^4.0.0",
"purescript-foldable-traversable": "^4.0.0",
"purescript-identity": "^4.0.0",
"purescript-integers": "^4.0.0",
"purescript-lists": "^5.0.0",
"purescript-maybe": "^4.0.0",
"purescript-strings": "^4.0.0",
"purescript-transformers": "^4.1.0",
"purescript-unicode": "^4.0.0",
"purescript-generics-rep": "^6.1.1"
"purescript-arrays": "master",
"purescript-either": "master",
"purescript-foldable-traversable": "master",
"purescript-identity": "master",
"purescript-integers": "master",
"purescript-lists": "master",
"purescript-maybe": "master",
"purescript-strings": "master",
"purescript-transformers": "master",
"purescript-unicode": "master"
"purescript-generics-rep": "master"
},
"devDependencies": {
"purescript-assert": "^4.0.0",
"purescript-console": "^4.1.0",
"purescript-psci-support": "^4.0.0"
"purescript-assert": "master",
"purescript-console": "master",
"purescript-psci-support": "master"
}
}
12 changes: 6 additions & 6 deletions src/Text/Parsing/Parser/String.purs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Data.Array (many)
import Data.Foldable (elem, notElem)
import Data.Maybe (Maybe(..))
import Data.Newtype (wrap)
import Data.String (Pattern, length)
import Data.String (Pattern)
import Data.String as S
import Data.String.CodeUnits as SCU
import Text.Parsing.Parser (ParseState(..), ParserT, fail)
Expand All @@ -20,14 +20,14 @@ import Text.Parsing.Parser.Pos (updatePosString)
-- | operations which this modules needs.
class StringLike s where
drop :: Int -> s -> s
indexOf :: Pattern -> s -> Maybe Int
stripPrefix :: Pattern -> s -> Maybe s
null :: s -> Boolean
uncons :: s -> Maybe { head :: Char, tail :: s }

instance stringLikeString :: StringLike String where
uncons = SCU.uncons
drop = S.drop
indexOf = S.indexOf
stripPrefix = S.stripPrefix
null = S.null

-- | Match end-of-file.
Expand All @@ -40,10 +40,10 @@ eof = do
string :: forall s m. StringLike s => Monad m => String -> ParserT s m String
string str = do
input <- gets \(ParseState input _ _) -> input
case indexOf (wrap str) input of
Just 0 -> do
case stripPrefix (wrap str) input of
Just remainder -> do
modify_ \(ParseState _ position _) ->
ParseState (drop (length str) input)
ParseState remainder
(updatePosString position str)
true
pure str
Expand Down