Re: [Haskell-cafe] A functor for two Peano systems

This whole exercise is my attempt to translate *The Littler MLer* and its last chapter where they go into functors.
That approach isn't working for you, and it's trying the patience of the cafe. (These are sub-beginner level q's, please use the Beginners' forum. And I'd forgotten that's what you're doing. Your first post in this thread should have said you're talking about ML functors. https://stackoverflow.com/questions/2030863/in-functional-programming-what-i.... says "most beginning programmers have difficulty with [functors]".) I suggest you first go through a Haskell tutorial, and get your knowledge secure of idiomatic Haskell. Even so, I just don't believe you're coming from idiomatic ML. Unless 'The Little MLer' is giving it as obfuscated code, and the objective is to de-obfuscate it. I'd code your `plus2` with pattern-matching:
plus2 :: MyNum -> MyNum -> MyNum plus2 MNZero m = m plus2 (OneMoreThan n') m = OneMoreThan $ plus2 n' m
Your test for `(x == MNZero)` inside helper function `pCessor` is useless: flow-of-control doesn't take the outer `else` branch unless `x` (i.e. `n`) is _not_ equal `MNZero`. Similar redundant code in the case for `Int`. But that has bigger problems, as Olaf points out: `Int`s can be negative. So if `plus` is called with a negative `n`, it'll call `pCessor` repeatedly until stack overflow (or numeric underflow). AntC

That approach isn't working for you, and it's trying the patience of the cafe. (These are sub-beginner level q's, please use the Beginners' forum....)
According to https://www.haskell.org/mailing-lists/ , the purpose of
haskell-cafe is "General Haskell questions; extended discussions. Forum in
which it’s acceptable to ask anything, no matter how naive, and get polite
replies." The OP's questions and efforts are more than appropriate here,
and they should expect no less than polite, if not helpful, responses here.
AntC, your replies are not at all polite, and you seem to be misinformed of
the purpose of this mailing list. Please help us maintain a more
appropriate environment here in the future, and I would ask the
haskell-cafe moderators to assist in this as well. If you want to direct
someone to a different forum, please do so politely and without insulting
them.
--Aaron V.
On Mon, Apr 5, 2021 at 4:19 PM Anthony Clayden
This whole exercise is my attempt to translate *The Littler MLer* and its last chapter where they go into functors.
That approach isn't working for you, and it's trying the patience of the cafe. (These are sub-beginner level q's, please use the Beginners' forum. And I'd forgotten that's what you're doing. Your first post in this thread should have said you're talking about ML functors. https://stackoverflow.com/questions/2030863/in-functional-programming-what-i.... says "most beginning programmers have difficulty with [functors]".)
I suggest you first go through a Haskell tutorial, and get your knowledge secure of idiomatic Haskell. Even so, I just don't believe you're coming from idiomatic ML. Unless 'The Little MLer' is giving it as obfuscated code, and the objective is to de-obfuscate it.
I'd code your `plus2` with pattern-matching:
plus2 :: MyNum -> MyNum -> MyNum plus2 MNZero m = m plus2 (OneMoreThan n') m = OneMoreThan $ plus2 n' m
Your test for `(x == MNZero)` inside helper function `pCessor` is useless: flow-of-control doesn't take the outer `else` branch unless `x` (i.e. `n`) is _not_ equal `MNZero`.
Similar redundant code in the case for `Int`. But that has bigger problems, as Olaf points out: `Int`s can be negative. So if `plus` is called with a negative `n`, it'll call `pCessor` repeatedly until stack overflow (or numeric underflow).
AntC _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Emphatically co-signed, and I would like to add that this is far from the
first time I've seen this sort of aggressive, dismissive, adversarial
behavior from AntC.
Usually it's in discussion of core libraries and extensions and I've held
my tongue because there are committees in charge of such things; if they
find his input outweighs his tone, so be it.
But this is entry-level community gatekeeping. Responding to innocent
questions with derision will drive many new and curious Haskellers away.
Worse, the ones who stay are more likely to echo that abuse down the line.
This is how communities become and remain toxic.
So I feel a duty to step up and say, this is thoroughly unacceptable here.
On Tue, Apr 6, 2021, 12:09 AM Georgi Lyubenov
Adding to what Aaron said, I would also request that you not speak for others (or at least not for me):
it's trying the patience of the cafe would be better rephrased as > it's trying my patience ======= Georgi
Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
participants (4)
-
Aaron VonderHaar
-
Akhra Gannon
-
Anthony Clayden
-
Georgi Lyubenov