When we say a monad 'encapsulates a computation' - is this just saying 'wraps a functional transformation of data'?

softwareengineering.stackexchange https://softwareengineering.stackexchange.com/questions/257292

  •  05-10-2020
  •  | 
  •  

Question

When I think of the word 'computation' - my mind jumps to lambda calculus or operations on a state machine representing a CPU. It is quite a broad definition.

Now some people talk about monads as 'representing a unit of a computation'.

But if we consider the identity monad - this is a 'reference to the computation'. But ultimately we're almost certainly talking about functional programming. We're using functions. We use functions to transform data. So where does this fancy language come from?

My question is: When we say a monad 'encapsulates a computation' - is this just saying 'wraps a functional transformation of data'?

Was it helpful?

Solution

Lambda calculus has no "data flow" allegory, but has data transformation. Imperative world hasn't data flow either, but has computation flow. Monadic way combines both of the best of two worlds: data transformation and explicit computation (order). And we can say "given monads encapsulates a computation"

Licensed under: CC-BY-SA with attribution
scroll top