Since the newtype optimisation was added (471a47255fb2757b0efce52560e30a0aa88bdeaa), code generators are no longer able to add special handling of the generated constructor/deconstructor for data types that are affected by the newtype optimisation.
To restore this functionality, I have added a new option (noNewtype) to disable the newtype optimisation for individual data types.
Motivation
In my Erlang code generator I have added special handling to some data types, like ErlAtom, ErlBinary and ErlCharlist (from the Erlang module). By doing this I can convert values between an Idris-specific representation to an Erlang-specific representation (and back), like so:
MkErlAtom "test" will generate an Erlang atom: 'test'
MkErlBinary "test" will generate an Erlang binary: <<"test"/utf8>>
MkErlCharlist "test" will generate an Erlang charlist: "test"
These data types fulfil the critera for the newtype optimisation, which means that, without the noNewtype option, the code generator is unable to add its own special handling.
Other comments
The name is supposed to match the existing noHints option, but I am happy to change it if anyone has any suggestions.
The included test is placed in the chez section because it rely on printing the internal structure of the data types.
Since the newtype optimisation was added (471a47255fb2757b0efce52560e30a0aa88bdeaa), code generators are no longer able to add special handling of the generated constructor/deconstructor for data types that are affected by the newtype optimisation.
To restore this functionality, I have added a new option (
noNewtype
) to disable the newtype optimisation for individual data types.Motivation
In my Erlang code generator I have added special handling to some data types, like
ErlAtom
,ErlBinary
andErlCharlist
(from theErlang
module). By doing this I can convert values between an Idris-specific representation to an Erlang-specific representation (and back), like so:MkErlAtom "test"
will generate an Erlang atom:'test'
MkErlBinary "test"
will generate an Erlang binary:<<"test"/utf8>>
MkErlCharlist "test"
will generate an Erlang charlist:"test"
These data types fulfil the critera for the newtype optimisation, which means that, without the
noNewtype
option, the code generator is unable to add its own special handling.Other comments
The name is supposed to match the existing
noHints
option, but I am happy to change it if anyone has any suggestions.The included test is placed in the
chez
section because it rely on printing the internal structure of the data types.