monoids Questions

2

Solved

I'm trying to understand what Monoid is from a category theory perspective, but I'm a bit confused with the notation used to describe it. Here is Wikipedia: In category theory, a monoid (or monoid...
Abnegate asked 18/5, 2019 at 15:41

1

Solved

Is there any newtype in base that would basically achieve the following? newtype SemigroupFlip a = SemigroupFlip a instance Semigroup a => Semigroup (SemigroupFlip a) where (SemigroupFlip a) &...
Cienfuegos asked 1/8, 2023 at 8:2

2

I've been experimenting with monoids and Distributives lately, and I think I've found something of interest (described in my answer) - are these already known structures? (I've been unable to find ...

5

Solved

The free monoids are often being regarded as "list monoids". Yet, I am interested in other possible structures which might give us free monoids. Firstly, let us go over the definition of ...
Sheya asked 16/9, 2020 at 20:57

2

Solved

I am busy reading Bartosz Milewski's Category Theory book for programmers and I'm struggling with the depiction of non-identity morphisms when moving between describing a monoid as a set and a mono...

2

Solved

I have a type to describe post-calibration radiocarbon date probability distributions. The details and background don't matter for the question: It boils down to one probability value in _calPDFDen...
Jerkwater asked 30/5, 2022 at 9:24

1

The Cartesian class from the constrained-category project is for categories, products of objects in which are objects in the same category yet again. I wonder about the classes Cartesian extends: c...
Chifforobe asked 2/7, 2021 at 19:55

4

Solved

I'm trying to understand the motivation behind the MonadPlus. Why is it necessary if there are already the typeclasses Monad and Monoid? Granted, instances of Monoid are concrete types, whereas in...
Minard asked 11/4, 2014 at 23:2

4

I watched this video on the composite pattern, where the main example is how to use the pattern as a mean to generate HTML code from a tree structure describing a todo list where each item can be i...

4

Solved

I've read about monoid homomorphism from Monoid Morphisms, Products, and Coproducts and could not understand 100%. The author says (emphasis original): The length function maps from String to ...
Mavismavra asked 5/5, 2019 at 14:53

3

Solved

The base library in Haskell has the following type synonyms in Data.Semigroup: type ArgMin a b = Min (Arg a b) type ArgMax a b = Max (Arg a b) Here are links to the haddocks: ArgMin and ArgMax W...
Nutritionist asked 20/11, 2020 at 12:54

3

Solved

Suppose I have a type like data Options = Options { _optionOne :: Maybe Integer , _optionTwo :: Maybe Integer , _optionThree :: Maybe String } deriving Show with many more fields. I would l...
Went asked 27/3, 2018 at 15:55

1

Solved

In this (very interesting) talk the speaker poses a question: What is the e value for the float/std::min monoid. In other words: what is the identity element for the monoid composed of standard C...
Jarvey asked 5/10, 2020 at 14:28

1

Solved

On the one hand the monadic bind operator >>= is left associative (AFAIK). On the other hand the monad law demands associativity, i.e. evaluation order doesn't matter (like with monoids). Bes...

2

I am trying to define an instance: newtype Join a = Join { getJoin :: a -> Bool } deriving Generic instance Monoid (Join a) where f <> g = ??? mempty = ??? The goal is that the functi...
Ghat asked 19/7, 2020 at 16:22

3

Solved

I have learnt about Monoidal being an alternative way to represent Applicative not so long ago. There is an interesting question on Typeclassopedia: (Tricky) Prove that given your implementations...
Idell asked 17/7, 2020 at 7:31

3

Solved

Perhaps neither of these statements are categorically precise, but a monad is often defined as "a monoid in the category of endofunctors"; a Haskell Alternative is defined as "a monoid on applicati...
Catboat asked 24/4, 2018 at 18:46

1

Solved

While looking at the definition of Monoid I noticed that mconcat has the following definition (source): mconcat :: Monoid a => [a] -> a mconcat = foldr mappend mempty Why would the signatu...
Farina asked 8/2, 2020 at 22:50

2

Solved

I am reading the book 'Programming in Scala' (The red book). In the chapter about Monoids, I understand what a Monoid homomorphism is, for example: The String Monoid M with concatenation and leng...
Hobbyhorse asked 11/9, 2019 at 11:19

2

Solved

I have recently tried to find a good source on the difference between monads and monoids. Could someone provide a link to a good resource on this or perhaps take one's time to elaborate on the si...
Offstage asked 16/3, 2012 at 23:58

5

Solved

Who first said the following? A monad is just a monoid in the category of endofunctors, what's the problem? And on a less important note, is this true and if so could you give an explanation...
Clincher asked 6/10, 2010 at 6:55

1

Solved

Instance MonadPlus IO is unique because mzero throws: Prelude Control.Monad> mzero *** Exception: user error (mzero) So accordingly, MonadPlus IO implies that it is also intended for errors. ...
Groff asked 11/8, 2019 at 6:26

4

Solved

There is a similar question I found here that asks almost the same thing, but not quite. The question I have is how to compose a list of functions of type (a -> Bool) to be one function that is al...
Fradin asked 8/8, 2019 at 14:30

2

Solved

I am getting very confused with these three concepts. Is there any simple examples to illustrate the differences between Category, Monoid and Monad ? It would be very helpful if there is a illust...
Stakhanovism asked 31/3, 2013 at 5:44

2

Solved

I am trying to understand Traversable with the help of https://namc.in/2018-02-05-foldables-traversals. Somewhere the author mentioned the following sentence: Traversable is to Applicative con...
Viperish asked 5/4, 2019 at 10:19

© 2022 - 2024 — McMap. All rights reserved.