[Haskell-cafe] Preferred syntax for append

Mark McConnell mmcconnell17704 at yahoo.com
Sun May 12 19:41:37 UTC 2024


We know that lists have map.  Sometimes we want to take the higher perspective of Functor, replacing map with fmap, then replacing fmap with <$> .  This post asks the corresponding question about append.
The notation for append within List itself is ++ .  Often we think of lists as Monads.  Applicative generalizes Monad, and Alternative specializes Applicative.  Alternative has <|> which behaves as ++ on List.  I have been using <|> for this purpose.
Recently, I have begun to read and enjoy "Effective Haskell".  In Chapter 1, this book uses <> for append.  Clearly they are thinking of List as a Semigroup.
I'm curious about your thoughts on ++ versus <|> versus <> .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20240512/f73d60de/attachment.html>


More information about the Haskell-Cafe mailing list