Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinwoo/purescript-biang
A library for converting generic reps of Sum and Product to row types, for whatever convenient usage needs at the type level.
https://github.com/justinwoo/purescript-biang
purescript type-level
Last synced: 28 days ago
JSON representation
A library for converting generic reps of Sum and Product to row types, for whatever convenient usage needs at the type level.
- Host: GitHub
- URL: https://github.com/justinwoo/purescript-biang
- Owner: justinwoo
- License: mit
- Created: 2018-08-02T09:50:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-02T09:52:16.000Z (over 6 years ago)
- Last Synced: 2024-11-14T02:14:56.239Z (2 months ago)
- Topics: purescript, type-level
- Language: PureScript
- Homepage:
- Size: 2.93 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Purescript-Biang
[![Build Status](https://travis-ci.org/justinwoo/purescript-biang.svg?branch=master)](https://travis-ci.org/justinwoo/purescript-biang)
A library for converting generic reps of Sum and Product to row types, for whatever convenient usage needs at the type level.
Biang, like the noodles
![](https://i.imgur.com/bvqiF1I.png)
## Usage
```purs
data Fruit = Apple | Banana String | Kiwi Int
derive instance genericFruit :: Generic Fruit _-- inferred type:
fruitRow :: RProxy
( "Apple" :: NoArguments
, "Banana" :: Argument String
, "Kiwi" :: Argument Int
)
fruitRow = sumToRow (Proxy :: Proxy Fruit)data Thing = Thing Int String Boolean
derive instance genericThing :: Generic Thing _-- inferred type:
thingRow :: RProxy
( a :: Int
, b :: String
, c :: Boolean
)
thingRow = productToRow (Proxy :: Proxy Thing)
```See the [API Docs](https://pursuit.purescript.org/packages/purescript-biang/) or the [tests](test/Main.purs) for usage.