Update trampoline docs to new interface.

This commit is contained in:
Max New 2014-01-20 14:40:10 -06:00
parent b47166144d
commit df135b8c9b

View file

@ -19,9 +19,9 @@ main = asText <| fac 1000000000000
Trampolining allows for long-running tail-recursive loops to be run without pushing calls onto the stack: Trampolining allows for long-running tail-recursive loops to be run without pushing calls onto the stack:
```haskell ```haskell
facT : Int -> Int -> Trampoline Int facT : Int -> Int -> Trampoline Int
facT n acc = Trampoline <| if n <= 0 facT n acc = if n <= 0
then Left acc then Done acc
else Right <| \() -> facT (n - 1) (n * acc) else Continue <| \() -> facT (n - 1) (n * acc)
fac : Int -> Int fac : Int -> Int
fac n = trampoline <| facT n 0 fac n = trampoline <| facT n 0