IO Monad like in Haskell


#1

Hi all

Does it exist IO module in reason?
I find the following code is weird:

  didMount: self => {
    self.send(Query);
    ReasonReact.NoUpdate;
  },

Because self.send(Query); raised a side effect, but didMount do not care about it.

Thanks


#2

There is no IO monad in Reason.

The way I understand side-effects and reducer is: the reducer must be pure but the developer is responsible for enforcing this


#3

The only reason didMount exists īs to raise a side effect.
You can think about IO monad as Haskell specific. It’s not the way it used in impure languages. But nothing stops you from using IO monad. People use it even in plain javascript.