|
|
|
|
|
by tel
4296 days ago
|
|
"Effect" is a more general idea. It's a lens for viewing any kind of impure computation[0]. Monads are a model for effects. You can view them as pure[1] computation in lambda calculus or as defining a region of code which, internally, has impure effects. So to summarize: effects are a general concept, monads are a particular technology for implementing that concept. Further complexity ensues when people start talking about the general concept of a monad which is interesting in its own right but it has a more sophisticated relationship with the concept of effects. [0] Purity is a property of, say, functions. Its definition is a function `f` is pure if and only if const () . f = const ()
which usually means that non-termination is impure as well. The notion of equality you use above can finesse this definition a lot.[1] As stated in [0], non-termination is an effect, so Haskell monads are impure in that sense. Haskell typically ignores non-termination effects, though. Generally, monads would work more or less just fine even without non-termination though. Externally you can think of them as pure. |
|