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: 5 months 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 (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-02T09:52:16.000Z (almost 7 years ago)
- Last Synced: 2024-12-26T22:24:31.560Z (7 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
[](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

## 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.