I don’t think it could work because even with pizzas, you still need parenthesis sometimes. For example, I recently wrote a parsing package, and as I cannot export |.
and |=
, I have to use |> ignore
or |> keep
, leading to code like this:
PR.succeed identity
|> PR.ignore PR.spaces
|> PR.keep (PR.int ExpectingInt InvalidNumber |> PR.map Just)
|> PR.ignore PR.spaces
|> PR.ignore (PR.symbol "," ExpectingComma |> PR.optional ())
|> PR.ignore PR.spaces
|> PR.forwardOrSkip Nothing [ "," ] ExpectingSpace Discarded
to work around having no parenthesis, I would need to use more let..in
blocks:
let
parseInt =
PR.int ExpectingInt InvalidNumber
|> PR.map Just
parseComma =
PR.symbol "," ExpectingComma
|> PR.optional ()
in
PR.succeed identity
|> PR.ignore PR.spaces
|> PR.keep parseInt
|> PR.ignore PR.spaces
|> PR.ignore parseComma
|> PR.ignore PR.spaces
|> PR.forwardOrSkip Nothing [ "," ] ExpectingSpace Discarded
Maybe that is actually more readable, and perhaps if I was tidying up some code I might even do that. But I could see it being very annoying at the time when you are writing a pipeline, as usually at that point you are just trying to sequence a load of stuff together in order, and don’t want the cognitive interruption of having to create another let..in
block (and then delete it again, when you realize you didn’t need it, and then put it back again when you realize you really did…).
I do agree pipelines can be harder to read sometimes, but so handy when you are just trying to figure out something complicated that needs to combine sequencing and transformation.