[Haskell-cafe] Preferred syntax for append

Olaf Klinke olf at aatal-apotheke.de
Mon May 13 17:12:47 UTC 2024


> Concatenation with (<>) is more meaningful and holds better semantics
> than (<|>), described as just "An associative binary operation".

(<>) is also "just an associative binary operation", no more guarantees
than (<|>). 

That said, for append (<>) should be preferred over (<|>) because one
can then switch to more efficient append implementations just by
changing the type signature, e.g. when switching from String to Text:
The former is an Alternative, the latter ist not. 

(<|>) for list models non-deterministic choice, which can be useful in
combinatorial problems. 

Olaf



More information about the Haskell-Cafe mailing list