Idris2-Erlang
Idris2-Erlang copied to clipboard
Add putChar and getChar primitives
I noticed that I have forgot to add the putChar
and getChar
primitives.
They are available in the Prelude.IO
module as %foreign
primitives: https://github.com/chrrasmussen/Idris2-Erlang/blob/master/idris2/libs/prelude/Prelude/IO.idr#L63-L66
The implementation would go here: https://github.com/chrrasmussen/Idris2-Erlang/blob/master/idris2/src/Compiler/Erlang/Codegen/NamedCExpToErlExpr.idr#L492-L498, and would be similar to the existing prim__putStr
and prim__getStr
.
In the Erlang code generator, Char
represents a grapheme (and not just a codepoint), which means these functions should handle any Unicode character.