Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinwoo/purescript-la-galbi
A simple library to parse a path string to a record of the parameters
https://github.com/justinwoo/purescript-la-galbi
purescript
Last synced: about 1 month ago
JSON representation
A simple library to parse a path string to a record of the parameters
- Host: GitHub
- URL: https://github.com/justinwoo/purescript-la-galbi
- Owner: justinwoo
- Created: 2018-01-12T21:40:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-14T13:38:48.000Z (about 7 years ago)
- Last Synced: 2024-11-14T02:06:59.003Z (3 months ago)
- Topics: purescript
- Language: PureScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PureScript-LA Galbi
A simple library to parse a url string to a record of the parameters, defined by using a nested tuple with simple type aliases.
Named for delicious LA Galbi, where the short rib bones line the top of each cut to make meat segments.
![](https://i.imgur.com/OJOnYqt.jpg)
## Example
From the tests:
```hs
type MyRoute = S "hello" / S "world" / Param "id" Int / Param "name" StringmyRouteP :: Proxy MyRoute
myRouteP = ProxytestUrl :: String
testUrl = "/hello/world/1/joe"-- ...
case parseUrl myRouteP testUrl of
Left e -> failure $ "oops: " <> show e
Right result ->
assert "says hi joe #1" $
"hi " <> result.name <> " #" <> show result.id == "hi joe #1"
```