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
30 changes: 15 additions & 15 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
"package.json"
],
"dependencies": {
"purescript-dom": "^2.0.0",
"purescript-eff": "^1.0.0",
"purescript-either": "^1.0.0",
"purescript-globals": "^1.1.0",
"purescript-lists": "^1.0.1",
"purescript-maps": "^1.1.0",
"purescript-maybe": "^1.0.0",
"purescript-prelude": "^1.0.1",
"purescript-semirings": "^1.0.0",
"purescript-tuples": "^1.0.0",
"purescript-validation": "^1.0.0",
"purescript-aff": "^1.1.0",
"purescript-control": "^1.0.0",
"purescript-console": "^1.0.0"
"purescript-dom": "^3.1.0",
"purescript-eff": "^2.0.0",
"purescript-either": "^2.0.0",
"purescript-globals": "^2.0.0",
"purescript-lists": "^3.2.0",
"purescript-maps": "^2.0.0",
"purescript-maybe": "^2.0.1",
"purescript-prelude": "^2.1.0",
"purescript-semirings": "^3.0.0",
"purescript-tuples": "^3.0.0",
"purescript-validation": "^2.0.0",
"purescript-aff": "^2.0.0",
"purescript-control": "^2.0.0",
"purescript-console": "^2.0.0"
},
"devDependencies": {
"purescript-console": "^1.0.0"
"purescript-console": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"devDependencies": {
"pulp": "^9.0.1",
"purescript-psa": "^0.3.9",
"purescript": "^0.9.2",
"purescript": "^0.10.1",
"rimraf": "^2.5.4"
}
}
3 changes: 2 additions & 1 deletion src/Routing.purs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Data.Maybe (Maybe(..))
import Data.Either (Either(..), either)
import Data.Tuple (Tuple(..))
import Data.String.Regex as R
import Data.String.Regex.Flags as RF

import Routing.Parser (parse)
import Routing.Match (Match, runMatch)
Expand All @@ -31,7 +32,7 @@ hashes cb =
hashChanged $ \old new -> do
cb (dropHash old) (dropHash new)
where dropHash h =
case R.regex "^[^#]*#" R.noFlags of
case R.regex "^[^#]*#" RF.noFlags of
Right regX -> R.replace regX "" h
Left _ -> h

Expand Down
5 changes: 3 additions & 2 deletions src/Routing/Match.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import Control.Alt (class Alt, (<|>))
import Control.Plus (class Plus)
import Control.Alternative (class Alternative)
import Global (readFloat, isNaN)
import Data.Semiring.Free (Free(), free, runFree)
import Data.Semiring.Free (Free(), free)
import Data.Foldable (foldl)
import Data.Validation.Semiring (V, invalid, unV)
import Data.Newtype (unwrap)


import Data.Map as M
Expand Down Expand Up @@ -130,7 +131,7 @@ runMatch (Match fn) route =
where
foldErrors errs =
Left $ foldl (\b a -> a <> "\n" <> b) "" do
es <- reverse <$> runFree errs
es <- reverse <$> unwrap errs
pure $ foldl (\b a -> a <> ";" <> b) "" $ showMatchError <$> es


Expand Down
8 changes: 4 additions & 4 deletions src/Routing/Parser.purs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import Data.Tuple (Tuple(..))
parsePart :: String -> RoutePart
parsePart str = fromMaybe (Path str) do
guard $ S.take 1 str == "?"
map (Query <<< M.fromList)
map (Query <<< M.fromFoldable)
$ traverse part2tuple parts
where
parts :: List String
parts = fromFoldable $ S.split "&" $ S.drop 1 str
parts = fromFoldable $ S.split (S.Pattern "&") $ S.drop 1 str

part2tuple :: String -> Maybe (Tuple String String)
part2tuple input = do
let keyVal = S.split "=" input
let keyVal = S.split (S.Pattern "=") input
guard $ A.length keyVal <= 2
Tuple <$> (A.head keyVal) <*> (keyVal A.!! 1)

Expand All @@ -36,4 +36,4 @@ parsePart str = fromMaybe (Path str) do
-- | applied to every hash part (usually `decodeURIComponent`)
parse :: (String -> String) -> String -> Route
parse decoder hash =
map ( decoder >>> parsePart ) $ fromFoldable (S.split "/" hash)
map ( decoder >>> parsePart ) $ fromFoldable (S.split (S.Pattern "/") hash)