Skip to content

Conversation

@safareli
Copy link
Contributor

@safareli safareli commented Apr 4, 2017

fix #17

pure (Done unit)
go n' = pure (Loop (n' - 1))

loopFunction :: Int -> ({result :: Int, step :: Int} -> Int)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parens could be omitted here just left for conveniens

@safareli
Copy link
Contributor Author

safareli commented Apr 4, 2017

After this Trampoline from ps-free could be implemented using just function

-type Trampoline = Free Lazy
+type Trampoline = Free ((->) Unit) 

done :: forall a. a -> Trampoline a
done = pure

suspend :: forall a. Trampoline a -> Trampoline a
suspend = suspendF

-delay' :: forall a. Lazy a -> Trampoline a
-delay' = liftF

delay :: forall a. (Unit -> a) -> Trampoline a
-delay = delay' <<< defer
+delay = liftF

runTrampoline :: forall a. Trampoline a -> a
-runTrampoline = runFree force
+runTrampoline = runFree \f -> f Unit

@safareli
Copy link
Contributor Author

@paf31 ping

@paf31 paf31 merged commit 507d7c6 into purescript:master May 27, 2017
@paf31
Copy link
Contributor

paf31 commented May 27, 2017

Thanks!

@safareli safareli deleted the function branch May 28, 2017 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Function instance of MonadRec

2 participants