ogma
ogma copied to clipboard
[FEATURE] Implement map for user defined types
Description
Implement map
for user defined types.
The implementation would take a user defined type as input, a field identifier (checked at hir phase), and an expression where the input is the value found at the identifier.
The output of the expression would need to match the field's type, and the output of the map
expression would be the user defined type.
- Support a variable which gives access to the input (like
$self
? Probably not, given it would incur a performance penalty when cloned which might not be necessary for every use case
For sum types, instead of the identifier mapping the field, the identifier would map the variant.
This is kinda neat, for example a Result type could do map Err ...