Skip to main content

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.

Filter by
Sorted by
Tagged with
2 votes
1 answer
189 views

Why isn't the nullable marker in Dart a monad? [closed]

Consider the following code: ...
Michael Tsang's user avatar
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. ...
Michael Homer's user avatar
  • 13.6k
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 ...
Gergely's user avatar
  • 363
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 ...
Gergely's user avatar
  • 363
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, ...
Dannyu NDos's user avatar
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 ...
Bruce Adams's user avatar
  • 2,874
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 ...
mousetail 'he-him''s user avatar
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 ...
Michael Homer's user avatar
  • 13.6k
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: ...
mousetail 'he-him''s user avatar