What is the appropriate data type?

In question In search of constructive criticism regarding the implementation of the monad, abesto asked people to criticize his Monad, which counts the number of binding operations. It turned out that this is actually not a monad, because it did not satisfy the first two monadic laws, but I found the example interesting. Is there any data type suitable for these types of structures?

+3
source share
1 answer

This is an interesting question and relates to the mathematical line of monads.

Of course, we could create a type class Monadishthat looks exactly like Monadtypeclass:

class Monadish m where
  returnish :: a -> ma
  bindish :: m a -> (a -> m b) -> m b

, ; , . , ""; , .

? : - , , . , (check), (check), (... nope). , , , , - .

- . : typeclass . , "" , , . , , , , . - : , , , .

+7

All Articles