klarkc / pure-vue

It's Vue, it's PureScript. Simple as that.
MIT License
18 stars 0 forks source link

Improve setup hook turning it side-effect free #11

Open klarkc opened 2 years ago

klarkc commented 2 years ago

Maybe we should improve setup hook using a custom type as a free monad instead of Effect.

Free monads updates a value on each code evaluation, creating a returning final value, it seems to fit our use case.

That final value would be Either Render Binding

klarkc commented 2 years ago

Pros:

Cons:

klarkc commented 1 year ago

We can eliminate the need of a monad transformer using qualified do:

count :: Unwrap "count" Int
count = ref 0

-- ?bind ma \a -> ?bind (foo a) \b -> ?bind (bar b) \c -> finalResult c

setup :: Setup Binding
setup = PureVue.do
  count
  ...