https://github.com/norpan/elm-dynamic-types
An experiment with dynamic types in Elm
https://github.com/norpan/elm-dynamic-types
dynamic-types elm
Last synced: 3 months ago
JSON representation
An experiment with dynamic types in Elm
- Host: GitHub
- URL: https://github.com/norpan/elm-dynamic-types
- Owner: norpan
- Created: 2017-03-07T13:21:48.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T13:25:26.000Z (about 8 years ago)
- Last Synced: 2024-12-27T22:59:47.379Z (5 months ago)
- Topics: dynamic-types, elm
- Language: Elm
- Homepage:
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dynamic Types in Elm
This is an experiment in implementing dynamic data and types in Elm.
One rationale for this is to be able to write something like this:
```elm
Dynamic.Json.decoder #Type : Json.Decode.Decoder Type
```However, there is obviosly a lot of other things that can be done too.
## Compiler extension
I started experimenting with a compiler extension, and it seems feasible
to hook into the "Canonicalize" stage and just generate ValidExpr from a raw
"#Type" expression. We have the canonical type there and generating valid
expressions seems straightforward enough.But it's not done yet.
## Example
See the `Example.elm` file for an example on how the generated code would
look and how it could be used.```
Example.run Example.test
```