Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kcsongor/purescript-record-format
Experimental record formatting from type-level format strings
https://github.com/kcsongor/purescript-record-format
purescript
Last synced: about 1 month ago
JSON representation
Experimental record formatting from type-level format strings
- Host: GitHub
- URL: https://github.com/kcsongor/purescript-record-format
- Owner: kcsongor
- License: bsd-3-clause
- Created: 2017-08-27T12:04:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-23T22:00:11.000Z (over 1 year ago)
- Last Synced: 2024-05-02T04:36:26.496Z (8 months ago)
- Topics: purescript
- Language: PureScript
- Size: 16.6 KB
- Stars: 24
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-record-format
Record formatting from type-level format strings, based on [Justin Woo](https://github.com/justinwoo)'s idea.
This library uses the 0.12 version of the compiler.
## Example
```purescript
format
(SProxy :: SProxy "Hi {name}! Your favourite number is {number}")
{name : "Bill", number : 16}
```produces the string
```
"Hi Bill! Your favourite number is 16"
```A missing field results in a type-error:
```purescript
format
(SProxy "Hi {name}! Your favourite number is {number}")
{name : "Bill"}
``````
Could not match type( number :: t2
| t3
)with type
( name :: String
)
```The only requirement is that all the types in the record have `Show`
instances.