-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Description
estring, echar, efloat, ... helpers are created using functions generated from the constant type.
However, this type does not contain boolean constants, such as true and false. Indeed, such constants are defined as constructors (without argument, nor uppercase), as seen using utop -dparsetree:
utop # true ;;
Ptop_def
[
structure_item (//toplevel//[1,0+0]..[1,0+4])
Pstr_eval
expression (//toplevel//[1,0+0]..[1,0+4])
Pexp_construct "true" (//toplevel//[1,0+0]..[1,0+4])
None
]As a consequence, ebool was not added to the Ast_pattern API, even though it is useful (as illustrated here)
It would be useful to have such values in the API:
val ebool : (bool, 'a, 'b) t -> (expression, 'a, 'b) t
val pbool : (bool, 'a, 'b) t -> (pattern, 'a, 'b) tWhile looking at this, I noticed that we are also missing two maps:
val map_value : f:('a -> 'b) -> ('b, 'c, 'd) t -> ('a, 'c, 'd) t
val map_value' : f:(location -> 'a -> 'b) -> ('b, 'c, 'd) t -> ('a, 'c, 'd) twith which it is simple to generate ebool and pbool, and that should be added to the API as well!
Metadata
Metadata
Assignees
Labels
No labels