Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can monads be seen as a reification of computation (or computationals processes)?

In my first analysis i would answer yes, but i cannot find any reference where this fact is stated clearly.

like image 349
GreyGeek Avatar asked Nov 01 '25 16:11

GreyGeek


2 Answers

The following links can be said to be evidence towards your claim:

  • Continuation Monad
  • State Monad

A case can be made that this has nothing to do with Monads in particular, in that first-class functions are reified computations. In that case, any given monad is just a special case of the use of first-class functions, due to the nature of bind. To see where I'm coming from here, consider the functions of the lambda calculus. In one sense, all of the functions of the lambda calculus are reified computations, since they are the significant part of the language and can be manipulated in any way you see fit. Functions are computations, and so functions that can be passed as arguments are reified computations.

like image 99
Axle Avatar answered Nov 04 '25 10:11

Axle


Yes, they can. Additionally, they can be seen as (this list is very incomplete):

  • Burritos
  • A way to do IO
  • A way to organise libraries
  • A somewhat organised heap of objects
  • Monoidal objects in a category of endofunctors
  • Lax functors from a terminal bicategory
  • An (higher-order) algebraic structure consisting of bind and return (or join and return) satisfying the monad laws

Out of these (including yours), I would claim that only the last three definitions tell us what a monad is: An algebraic structure. Everything else tells us what monads are used for, give a (bad to flawed) metaphor, say how a particular calculus expresses monads, or, like yours, elaborate what monads mean in a certain frame of reference (e.g. lambda calculus).

Viewing them as reification of computation/effects sounds like a mental model that is not inherently broken, but I would still advise to leave it behind and look at monads as an algebraic structure, devoid of any particular reference to the calculus one uses to express them: For the simple reason that doing that eases reasoning about the frame of reference one is trying to tame with a monad (say, a parser) without getting one's thoughts tangled up in, say, lambda calculus.

like image 39
barsoap Avatar answered Nov 04 '25 10:11

barsoap



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!