lux/control/comonad
Types
CoMonad
CoMonads are the opposite/complement to monads.
CoMonadic structures are often infinite in size and built upon lazily-evaluated functions.
(sig: (CoMonad w)
(: (lux/control/functor;Functor w)
functor)
(: (All [b] (-> (w b) b))
unwrap)
(: (All [b] (-> (w b) (w (w b))))
split))
Macros
be
## A co-monadic parallel to the "do" macro.
(let [square (lambda [n] (i.* n n))]
(be CoMonad<Stream>
[inputs (iterate i.inc 2)]
(square (head inputs))))