reanalyze
reanalyze copied to clipboard
decorating functions in pipe chains?
Hi Christiano and all Wondering if youve considered decoration for functions called in pipe chains? I wasnt able to add the decorator where I thought it would go
Thanks for the quick feedback about literal divides. Alex
Hi, do you have an example?
if columns->Js.Array.length >= 2 {
let dataRecordIdColumn = @doesNotRaise columns->Belt.Array.getExn(0)
...
}
One can annotate the function Belt.Array.getExn
or the result of the application.
In the case of pipe, there are issues with the parsing of the annotation.
See examples in https://github.com/rescript-association/reanalyze/pull/165
This should be moved to an issue in the https://github.com/rescript-lang/syntax repository:
1 (@doesNotRaise [])->Belt.Array.getExn(0)
formats to @doesNotRaise []->Belt.Array.getExn(0)
so this is annotating the argument not the result
2 @doesNotRaise ([]->Belt.Array.getExn(0))
formats to []->Belt.Array.getExn(0)
so it completely destroys the annotation.
For your workaround, you can annotate the function for now.
Rad. Thanks for the examples. I need to take more time looking in there as well