Questions tagged [monads]
For questions about design or implementation of monads or monadic features as found in Haskell and other languages, or using monads as part of language design or implementation.
9 questions
2
votes
1
answer
189
views
Why isn't the nullable marker in Dart a monad? [closed]
Consider the following code:
...
10
votes
1
answer
2k
views
Why can you implement a Monoid type in Java or C#, but not Monad or Functor?
Haskell and some other functional languages have Monad and Monoid types (and Semigroup, Functor, Applicative, and many others), and lists, trees, Maybe, and other types subtype all or some of these. ...
0
votes
1
answer
97
views
What is the object translating part of a monadic endofunctor? [closed]
A monad is an endofunctor $T:C\rightarrow C$ with natural transformations $\eta:id_C\rightarrow T$ and $\mu:T^2\rightarrow T$.
Being natural transformations mean that $$T(f)\circ \eta_A = \eta_B\circ ...
23
votes
3
answers
3k
views
Why does Haskell use the bind operation instead of Kleisli composition?
In monads, Kleisli composition has the type
infix oK: ('b -> 'c monad) -> ('a -> 'b monad) -> ('a -> 'c monad)
and it satisfies the nice algebraic ...
6
votes
3
answers
1k
views
What are the disadvantages of introducing the IO monad?
The IO monad, or the Karmic monad as what it's called in the language I'm making, is a catch-all for every side-effects.
Introducing this monad has many benefits, ...
16
votes
1
answer
815
views
What is an arrow and what powers would it give as a first class concept in a programming language
A while ago on lambda-the-ultimate, several times in fact, arrows - a concept related to/generalising monads
came up.
At least one person (I think it was this one) felt they were a significant ...
3
votes
2
answers
209
views
Can I use monadic types without needing colored functions?
The inspiration for this question
There are many advantages of using monadic types like Promise<T> or Result<T> as ...
4
votes
1
answer
244
views
How do I create an internal DSL with Haskell's do notation?
Haskell has a do notation for writing code that executes in a monad. I've seen that this is sometimes (ab?)used for creating embedded internal domain-specific ...
5
votes
3
answers
132
views
Alternate syntax so I can have both a safe navigation and a monad unwrapping operator?
I'd like to have both a safe navigation operator and monad unwrapping operator.
Safe navigation is like the feature in TypeScript:
...