When a value is piped into a method, such as shown below, the error my_const.<method_name> does not exist is given. Was it decided that you shouldn't be able to pipe into methods?
my_const = []
_ = my_const.concat([1, 2, 3]) # Ok
_ = [1, 2, 3] |> my_const.concat # Not Ok!
# Error: (`my_const.concat` does not exist)
_ = my_const.append(1) # Ok
_ = 1 |> my_const.append # Not Ok!
_ = my_const.is_eq([1, 2]) # Ok
_ = [1, 2] |> my_const.is_eq # Not Ok!
syntactically, my_const.concat always means, without exception, "access the field concat on a record named my_constant"
Ah, so brackets needed?
and my_const.concat() is always syntactically a method call
yep!
It's just the formatter is currently removing the brackets
ah then that's a formatter bug we should fix! :smile:
mind opening a gh issue for it?
No prob
Separately, should you be able to pipe into a method of a literal? E.g.
_ = [1,2,3].concat([4,5,6])
This gives a parser error. It looks a bit odd and is uncommon but sometimes I find it nicer to read at the start of a longer pipeline.
yes, that should work! definitely also worth a gh issue :smile:
Last updated: Sep 03 2026 at 15:16 UTC