You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I have suggested renaming s and str to something more userfriendly but got rejected =/
Can we instead provide documentation with /// on each of the functions? I think the documentation in the Elmish.UrlParser github page is very helpful, so maybe adding it to the function would also provide value...
* s combinator for a static string we expect to find in the URL,
* </> combinator to capture a slash in the URL,
* str combinator to extract a string,
* i32 combinator to attempt to parse an int.
* top combinator that takes nothing.
* remaining combinator to get the remaining parts of the URL
I tend to shadow like this to provide clarity:
// combinator for a static string we expect to find in the URLletmatchString= UrlParser.s
// combinator to extract a stringletparseString= UrlParser.str
// combinator to attempt to parse and Int32letparseInt32= UrlParser.i32
The text was updated successfully, but these errors were encountered:
This library is so light and powerful! Great job yall
[<RequireQualifiedAccess>]moduleRouteropenElmishopenElmish.UrlParser[<RequireQualifiedAccess>]typeRoute=| Home
| Blog ofintlettoHash(route:Route)=match route with| Route.Home ->"#home"| Route.Blog id -> sprintf "#blog/%i" id
/// https://elmish.github.io/urlParser/docs/parsing.htmlletparseRoute:Parser<Route->Route,Route>=// combinator that takes nothingletmatchNothing= UrlParser.top
// combinator for a static string we expect to find in the URLletmatchString= UrlParser.s
// combinator to extract a stringletparseString= UrlParser.str
// combinator to attempt to parse and Int32letparseInt32= UrlParser.i32
UrlParser.oneOf [(matchString "blog"</> parseInt32)|> UrlParser.map (fun blogId -> Route.Blog blogId)(matchString "home")|> UrlParser.map Route.Home
matchNothing |> UrlParser.map Route.Home
]
I think I have suggested renaming
s
andstr
to something more userfriendly but got rejected =/Can we instead provide documentation with
///
on each of the functions? I think the documentation in theElmish.UrlParser
github page is very helpful, so maybe adding it to the function would also provide value...I tend to shadow like this to provide clarity:
The text was updated successfully, but these errors were encountered: