Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinwoo/purescript-mochi
Make yourself a record by stretching out the rows!
https://github.com/justinwoo/purescript-mochi
purescript
Last synced: 15 days ago
JSON representation
Make yourself a record by stretching out the rows!
- Host: GitHub
- URL: https://github.com/justinwoo/purescript-mochi
- Owner: justinwoo
- License: mit
- Created: 2018-12-04T12:12:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-04T23:34:00.000Z (about 6 years ago)
- Last Synced: 2024-12-07T04:09:24.929Z (about 1 month ago)
- Topics: purescript
- Language: PureScript
- Homepage:
- Size: 2.93 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PureScript-Mochi
Make yourself a record by stretching out the rows!
![](https://i.imgur.com/plqqJrt.jpg)
## Example
```purs
type Fruits =
{ apple :: Int
, banana :: String
, cherry :: Boolean
}-- IDE inferred type signature:
mkFruits
:: Int
-> String
-> Boolean
-> { apple :: Int
, banana :: String
, cherry :: Boolean
}
mkFruits = constructRecord (Proxy :: Proxy Fruits)main :: Effect Unit
main = do
let (fruits :: Fruits) = { apple: 1, banana: "a", cherry: true }
assertEqual
{ expected: fruits
, actual: mkFruits 1 "a" true
}
```