Tue May 29 14:59:03 EDT 2018
I don't understand Free
I made a small change : Term n -> Term (Op n), and now I cannot fix
Need to redo it from scratch.
Start by writing a template that just uses return to produce the data
type, then refine. This already exposes the bulk of the wrapping
Is there a way to implement the behavior of free without putting in
all the wrapping?
EDIT: Ok, I get it. I discovered unfold, and wrapped the Free monad
inside a WriterT . ReaderT to perform String rendering with indentation.
EDIT: I didn't get it. Then discovered liftF
-- exprDef = inlineNode ref -- 0 levels (Delay cuts off)
-- exprDef n = liftF $ Compose $ ref n -- 1 level
exprDef n = (liftF $ Compose $ ref n) >>= inlineNode ref -- 1 level + inline