Conversation
|
I find the following function useful also. foreverE' ::
(Monad m, Data e) =>
e -> Cell (ExceptT e m) (e,a) b -> Cell m a b
foreverE' e cell = foreverE e (readerToInput cell) where
readerToInput cell = proc a -> do
e <- constM ask -< ()
liftCell cell -< (e,a)My big breakthrough in understanding foreverE was when I understood that, actually, there is no Finite requirement on the exception type as long as we don't try to use exception to determine the "shape" of the cell, and just use it as an input to the cell. I suspect many recursive switching definitions are of this type. Together with |
| foreverCE e f = foreverE e $ commute $ runCellExcept . f | ||
|
|
||
| foreverCE' :: | ||
| (Monad m, Data void, Finite void, Data e, Finite e) => |
There was a problem hiding this comment.
I could avert the constraints on void by plugging in Void instead. Weird it's necessary at all. Have a look again whether I can get rid of them, and write a test just to see whether they are a nuisance.
|
Yes, I should add that function. |
withCell :: (Cell m a b -> Cell n c d) -> CellExcept a b m e -> CellExcept c d n e?