<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Mark,</p>
<p>Yes I would favour Rebecca's approach in her book to use
Semigroup. Personally I never think of lists as Monads, as I see
this instance useful only to power list comprehension. </p>
<p>Concatenation with (<>) is more meaningful and holds better
semantics than (<|>), described as just "An associative
binary operation". It's so vague it could be the documentation
for a Magma typeclass, and the name "Alternative" is quite loaded
(we think especially of parsers when thinking/seeing Alternative).
<br>
<br>
Cheers,</p>
<p>Hécate<br>
</p>
<div class="moz-cite-prefix">Le 12/05/2024 à 21:41, Mark McConnell
via Haskell-Cafe a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:1244981605.892396.1715542897959@mail.yahoo.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div id="yiv9416275160">
<div
style="font-family:courier new, courier, monaco, monospace, sans-serif;font-size:13px;"
class="yiv9416275160yahoo-style-wrap">
<div dir="ltr"><font size="3"
face="times new roman, new york, times, serif">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.</font></div>
<div dir="ltr"><font size="3"
face="times new roman, new york, times, serif"><br>
</font></div>
<div dir="ltr"><font size="3"
face="times new roman, new york, times, serif">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.</font></div>
<div dir="ltr"><font size="3"
face="times new roman, new york, times, serif"><br>
</font></div>
<div dir="ltr"><font size="3"
face="times new roman, new york, times, serif">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.</font></div>
<div dir="ltr"><font size="3"
face="times new roman, new york, times, serif"><br>
</font></div>
<div dir="ltr"><font size="3"
face="times new roman, new york, times, serif">I'm curious
about your thoughts on ++ versus <|> versus <>
.</font></div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Hécate ✨
🐦: @TechnoEmpress
IRC: Hecate
WWW: <a class="moz-txt-link-freetext" href="https://glitchbra.in">https://glitchbra.in</a>
RUN: BSD</pre>
</body>
</html>