Replies: 1 comment 4 replies
-
The absorbing/identity/neutral element is sometimes called |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Context and motivation
In Haskell,
mempty
is the name for the monoid identity value.On a different note: in Dex, we can construct an empty list via
toList []
orAsList _ []
. Both of these are function calls - it would be nice to have a single-identifier value whose meaning is "empty list".Ideas
1. Define
nil
as emptyList
in the Preludenil
as empty list has precedent from languages like Lisp and Haskell.This leaves the gnarly name
mempty
untouched.2. Rename
Monoid
requirementmempty
tonil
This would look like:
Benefits:
nil
is a nicer name thanmempty
, based on taste and aesthetics.Considerations here:
nil
might be confused withNone
(fromdata Option a = None | Some a
in Haskell) orNULL
&nullptr
(from C/C++).Having thought a bit, I think renaming
mempty
tonil
still sounds quite good. Reasons:nil
has precedent for meaning "empty (linked) list" from Lisp and Haskell and descendants like Idris.mempty
withnil
also, which is simpler and a nice term-of-art with precedent.OP's thoughts
I would be quite happy with (2), if everyone is comfortable. It might be nice to rename
mcombine
too -<>
would be an easy non-controversial improvement.Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions