Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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!

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
}
```