Idris2-Erlang icon indicating copy to clipboard operation
Idris2-Erlang copied to clipboard

Add putChar and getChar primitives

Open christian-public opened this issue 4 years ago • 0 comments

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.

christian-public avatar Aug 30 '20 21:08 christian-public