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

Expose `Cofree` constructor #90

Closed natefaubion closed 5 years ago

natefaubion commented 7 years ago

Currently there's no way to make a single lazy Cofree node since the constructor is not exported, and mkCofree is strict.

paulyoung commented 7 years ago

Does defer not make it lazy?

natefaubion commented 7 years ago

mkCofree uses defer, but it takes the argument strictly https://github.com/purescript/purescript-free/blob/master/src/Control/Comonad/Cofree.purs#L40. If you added your own defer you'd have Lazy leaves, but not a Lazy spine.

paf31 commented 7 years ago

Exporting it is fine with me 👍

hdgarrood commented 5 years ago

Was this resolved by #92?

natefaubion commented 5 years ago

Yes, you can use deferCofree now.