4 ms·
Show HN: Erlang code generator for Idris 2
- Zigma 6y agoUsing the Erlang code generator for Idris 2 I was able to build the following website: https://www.typedtext.io https://www.typedtext.io The website includes a blog post about how the website was built: https://www.typedtext.io/posts/view?id=2 https://www.typedtext.io/posts/view?id=2
- ch4s3 6y agoThis is really impressive. IS there anything else you're using Idris for in the context of Elixir/Erlang?
- Zigma 6y agoThanks! Not yet, but I am interested in building a web framework that is inspired by Phoenix Framework (I really like the Plug abstraction) and Hyper (https://github.com/purescript-hyper/hyper https://github.com/purescript-hyper/hyper). I would also like to support Phoenix LiveView in some shape or form.
- ch4s3 6y agothat is very cool.
- macintux 6y agoThe list keeps getting longer. The BEAM is quite an attractive target. https://gist.github.com/macintux/6349828#alternative-languages-targeting-the-erlang-vm https://gist.github.com/macintux/6349828#alternative-languag...
- vmchale 6y agoGood stuff! Idris keeps getting more impressive.
- didibus 6y agoIs Idris 2 implemented in Idris 1 ?
- Zigma 6y agoIdris 2 is implemented in Idris 2! See https://www.idris-lang.org/idris-2-version-020-released.html https://www.idris-lang.org/idris-2-version-020-released.html It should still be possible to bootstrap Idris 2 from Idris 1, via Idris2-boot (https://github.com/edwinb/Idris2-boot https://github.com/edwinb/Idris2-boot), and via version 0.2.1 of Idris2 (https://www.idris-lang.org/idris-2-version-021-released.html https://www.idris-lang.org/idris-2-version-021-released.html).
- Kabie 6y agoDependent type on BEAM? Can't wait to try it.
- rq1 6y agoThank you Zigma for your work. :) Can you quickly document the big steps to write a codegen? I have some ideas I want to have explore.
- Zigma 6y agoI assume that you mean a code generator for Idris 2. I think the easiest way to get going is to start from an existing code generator. Idris 2 currently supports: Chez Scheme, Racket, Gambit Scheme and JavaScript. Pick the language you are most familiar with. The files that are relevant to the Chez Scheme code generator are located here (similar locations for the other code generators): https://github.com/idris-lang/Idris2/blob/master/src/Compiler/Scheme/Chez.idr https://github.com/idris-lang/Idris2/blob/master/src/Compile..., https://github.com/idris-lang/Idris2/blob/master/src/Compiler/Scheme/Common.idr https://github.com/idris-lang/Idris2/blob/master/src/Compile..., https://github.com/idris-lang/Idris2/blob/master/support/chez/support.ss https://github.com/idris-lang/Idris2/blob/master/support/che... The current code generators are based on an intermediate representations called `NamedCExp`, defined here: https://github.com/idris-lang/Idris2/blob/master/src/Core/CompileExpr.idr#L62-L107 https://github.com/idris-lang/Idris2/blob/master/src/Core/Co... `NamedCExp` describe various forms an expression can take. These need to be translated into the target language. For example `NmApp` represents calling a function with the given arguments. You don't need to implement everything to make a proof of concept. The following document describe how to add a new code generator (It does not go into details of building it): https://idris2.readthedocs.io/en/latest/backends/custom.html https://idris2.readthedocs.io/en/latest/backends/custom.html You can see an overview of the different intermediate representations here: https://github.com/chrrasmussen/Idris2-Erlang/blob/master/docs/intermediaterepresentations.md https://github.com/chrrasmussen/Idris2-Erlang/blob/master/do... (Note that ErlExpr and AbstractFormat is specific to the Erlang code generator) If you have more questions, you are welcome to join the Idris community at any of the locations listed here: https://www.idris-lang.org https://www.idris-lang.org
- romanoderoma 6y agoThis is great news!
- zokier 6y agoWhat is the overall status of Idris2 these days, is it ready to replace Idris1 or is it still heavily WIP? I did notice that 0.2.1 was released about month ago so that sounds great! Has someone been using Idris (1 or 2) as their "daily driver" language? How has that gone, can you be productive in it?