From 036a70f140eb7a6f5457505ee0cdcc4c528793cf Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 29 May 2016 01:14:07 +0200 Subject: footnotes for events/01 --- provider/posts/events/01.lhs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/provider/posts/events/01.lhs b/provider/posts/events/01.lhs index fd1bd03..01e769e 100644 --- a/provider/posts/events/01.lhs +++ b/provider/posts/events/01.lhs @@ -73,7 +73,7 @@ We are going to want to parse a specification of some kind into a form we can ru Below we see one such form. `ListT`{.haskell} allows for nondeterministic computation – it allows us to split -our wordline and continue depth-first much like `[]`{.haskell}. +our wordline[^worldlineSplits] and continue depth-first much like `[]`{.haskell}. Within every wordline we modify a distinct snapshot of `ObjCtx`{.haskell} we took while branching. @@ -83,7 +83,7 @@ We also share one `EvalCtx`{.haskell} across all worldlines. > type Eval m a = StateT ObjCtx (ListT (StateT EvalCtx m)) a `ListT`{.haskell} does not ship with extensive support for the -[transformers package][transformers]: +[transformers package][transformers][^pipes]: > instance MonadState s m => MonadState s (ListT m) where > get = lift get @@ -92,7 +92,7 @@ We also share one `EvalCtx`{.haskell} across all worldlines. The context shared among all worldlines mainly contains all objects that eventually get computed – haskells lazyness ensures that we terminate as long as we don´t have objects depend on themselves in a sufficiently -degenerate way. +degenerate way[^degenerate]. > data EvalCtx = EvalCtx > { _ctxEvents :: [Object] @@ -105,7 +105,7 @@ degenerate way. > } Every wordline constructs exactly one object while having access to a set -of declarations that can occur anywhere on the wordline. +of declarations that can occur anywhere on the wordline[^ctxVars]. > data ObjCtx = ObjCtx > { _objOccurs :: Bool @@ -135,8 +135,20 @@ layers to depend on one another: > where > x' = evalStateT (ListT.toList (objCtx <$> execStateT x def)) . flip (set ctxEvents) def . catMaybes +[^ctxVars]: In the base version of this file we carry declarations we may refer to when + creating objects (`_objVars`{.haskell}) within `EvalCtx`{.haskell} instead of `ObjCtx`{.haskell}. + Why is that a bad idea? + +[^worldlineSplits]: What does such a branching point look like in do notation? + +[^pipes]: It has been pointed out to me that `ListT`{.haskell} from [pipes][] does. + +[^degenerate]: Constructing an example that doesn´t terminate is trivial. Try constructing one that does while + still being self-referential! + [Google Calendar]: [Remind]: [JSON]: [monad transformers]: [transformers]: +[pipes]: -- cgit v1.2.3