Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/evanrelf/recto

Toy anonymous records
https://github.com/evanrelf/recto

Last synced: 12 days ago
JSON representation

Toy anonymous records

Awesome Lists containing this project

README

        

# recto

Toy anonymous records. See [verso] for anonymous variants.

## Example

```haskell
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE TypeOperators #-}

import Recto

type Person = Record
[ "firstName" ::: String
, "lastName" ::: String
, "likesDogs" ::: Bool
]

evan :: Person
evan = record
( #firstName := "Evan"
, #lastName := "Relf"
, #likesDogs := True
)

fullName
:: ["firstName" ::: String, "lastName" ::: String] :| r
=> Record r
-> String
fullName r = r.firstName <> " " <> r.lastName

greet :: Person -> IO ()
greet person = putStrLn $ "Hello, " <> fullName person <> "!"
```

[verso]: https://github.com/evanrelf/verso