@@ -1,5 +1,4 @@
1−module Trampoline (Trampoline, trampoline)
2− where
1+module Trampoline where
32
43{-| Trampolining loops for unbounded recursion.
54Since most javascript implementations lack tail-call elimination, deeply tail-recursive functions will result in a stack overflow.
@@ -33,10 +32,10 @@ main = asText <| fac 1000000000000
3332@docs Trampoline, trampoline
3433 -}
3534import Native.Trampoline
36−import open Either
3735
3836{-| A computation that might loop. A trampoline is either the resulting value or a thunk that needs to be run more. -}
39−data Trampoline a = Trampoline (Either a (() -> Trampoline a))
37+data Trampoline a = Done a
38+ | Continue (() -> Trampoline a)
4039
4140{-| Run a trampolining loop in constant space. -}
4241trampoline : Trampoline a -> a