purescript / purescript-free

Free monads, Cofree comonads, Yoneda and Coyoneda functors, and the Trampoline monad.
BSD 3-Clause "New" or "Revised" License
93 stars 27 forks source link

Provide non memoized Trampoline? #83

Closed safareli closed 6 years ago

safareli commented 7 years ago

Currently Trampoline is defined in terms of Lazy which is memoized. Because of this Trampoline is also memoized. But there could also exist non memoized definition for Trampoline using just ((->) Unit) (Currently -> is not MonadRec, but will become once https://github.com/purescript/purescript-tailrec/pull/18 is merged). This implementation might be more efficient as it has no extra Lazy wrapper and memoization.

We have two options:

  1. use -> instead of Lazy in Trampoline
  2. define new Trampoline in terms of ->
paf31 commented 7 years ago

I'd be fine with switching to ->, but it'd be a breaking change.

safareli commented 7 years ago

Will set up PR for it. Can you review https://github.com/purescript/purescript-tailrec/pull/18

garyb commented 6 years ago

Resolved by #85, will be in the 0.12 release