From 24881710b30a4d3014853b750d657276c667a22c Mon Sep 17 00:00:00 2001 From: Alexander Thiemann Date: Thu, 3 Nov 2016 10:58:08 +0100 Subject: [PATCH 1/2] bump to psc 0.10.1 --- bower.json | 30 +++++++++++++++--------------- package.json | 2 +- src/Routing.purs | 3 ++- src/Routing/Match.purs | 5 +++-- src/Routing/Parser.purs | 8 ++++---- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/bower.json b/bower.json index e4ef256..c15961d 100644 --- a/bower.json +++ b/bower.json @@ -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": "^1.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" } } diff --git a/package.json b/package.json index d9bdb28..b718f0e 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/Routing.purs b/src/Routing.purs index e99ab3c..27ee161 100644 --- a/src/Routing.purs +++ b/src/Routing.purs @@ -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) @@ -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 diff --git a/src/Routing/Match.purs b/src/Routing/Match.purs index 6ed6318..f82b18f 100644 --- a/src/Routing/Match.purs +++ b/src/Routing/Match.purs @@ -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 @@ -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 diff --git a/src/Routing/Parser.purs b/src/Routing/Parser.purs index ef7886b..ba37c06 100644 --- a/src/Routing/Parser.purs +++ b/src/Routing/Parser.purs @@ -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) @@ -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) From 0e0aef4f30fce611d41b8e4d7200be0f43c21a1d Mon Sep 17 00:00:00 2001 From: Alexander Thiemann Date: Thu, 3 Nov 2016 11:03:17 +0100 Subject: [PATCH 2/2] also bump purescript-globals --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index c15961d..5349a06 100644 --- a/bower.json +++ b/bower.json @@ -27,7 +27,7 @@ "purescript-dom": "^3.1.0", "purescript-eff": "^2.0.0", "purescript-either": "^2.0.0", - "purescript-globals": "^1.0.0", + "purescript-globals": "^2.0.0", "purescript-lists": "^3.2.0", "purescript-maps": "^2.0.0", "purescript-maybe": "^2.0.1",