File tree Expand file tree Collapse file tree 4 files changed +62
-3
lines changed
Expand file tree Collapse file tree 4 files changed +62
-3
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,20 @@ matches' :: forall e a. (String -> String) -> Match a -> (Maybe a -> a -> Eff e
3333```
3434
3535
36+ #### ` matchesAff' `
37+
38+ ``` purescript
39+ matchesAff' :: forall e a. (String -> String) -> Match a -> Aff e (Tuple (Maybe a) a)
40+ ```
41+
42+
43+ #### ` matchesAff `
44+
45+ ``` purescript
46+ matchesAff :: forall e a. Match a -> Aff e (Tuple (Maybe a) a)
47+ ```
48+
49+
3650#### ` matchHash `
3751
3852``` purescript
@@ -201,6 +215,23 @@ type Route = List RoutePart
201215
202216
203217
218+ ## Module Routing.Hash.Aff
219+
220+ #### ` modifyHash `
221+
222+ ``` purescript
223+ modifyHash :: forall e. (String -> String) -> Aff (dom :: DOM | e) Unit
224+ ```
225+
226+
227+ #### ` setHash `
228+
229+ ``` purescript
230+ setHash :: forall e. String -> Aff (dom :: DOM | e) Unit
231+ ```
232+
233+
234+
204235## Module Routing.Match.Class
205236
206237#### ` MatchClass `
Original file line number Diff line number Diff line change 2828 "purescript-semirings" : " ~0.1.1" ,
2929 "purescript-lists" : " ~0.6.0" ,
3030 "purescript-globals" : " ~0.1.6" ,
31- "purescript-dom" : " ~0.1.2"
31+ "purescript-dom" : " ~0.1.2" ,
32+ "purescript-aff" : " ~0.10.0"
3233 },
3334 "devDependencies" : {
3435 "purescript-timers" : " ~0.0.8" ,
Original file line number Diff line number Diff line change @@ -4,12 +4,16 @@ module Routing (
44 matches ,
55 matches' ,
66 matchHash ,
7- matchHash'
7+ matchHash' ,
8+ matchesAff ,
9+ matchesAff'
810 ) where
911
1012import Control.Monad.Eff
13+ import Control.Monad.Aff
1114import Data.Maybe
1215import Data.Either
16+ import Data.Tuple
1317import qualified Data.String.Regex as R
1418
1519import Routing.Parser
@@ -49,8 +53,18 @@ matches' :: forall e a. (String -> String) ->
4953matches' decoder routing cb = hashes $ \old new ->
5054 let mr = matchHash' decoder routing
5155 fst = either (const Nothing ) Just $ mr old
52- in either (const $ pure unit) (cb fst) $ mr new
56+ in either (const $ pure unit) (cb fst) $ mr new
5357
58+ matchesAff' :: forall e a . (String -> String ) ->
59+ Match a -> Aff e (Tuple (Maybe a ) a )
60+ matchesAff' decoder routing =
61+ makeAff \_ k -> do
62+ matches' decoder routing \old new ->
63+ k $ Tuple old new
64+
65+ matchesAff :: forall e a . Match a -> Aff e (Tuple (Maybe a ) a )
66+ matchesAff = matchesAff' decodeURIComponent
67+
5468
5569matchHash :: forall a . Match a -> String -> Either String a
5670matchHash = matchHash' decodeURIComponent
Original file line number Diff line number Diff line change 1+ module Routing.Hash.Aff where
2+
3+ import DOM
4+ import Control.Monad.Aff
5+ import Control.Monad.Eff.Class
6+ import qualified Routing.Hash as R
7+
8+ modifyHash :: forall e . (String -> String ) -> Aff (dom :: DOM |e ) Unit
9+ modifyHash func = liftEff $ R .modifyHash func
10+
11+ setHash :: forall e . String -> Aff (dom :: DOM |e ) Unit
12+ setHash hash = liftEff $ R .setHash hash
13+
You can’t perform that action at this time.
0 commit comments