summaryrefslogtreecommitdiff
path: root/provider
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-05-29 01:14:07 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2016-05-29 01:14:07 +0200
commit036a70f140eb7a6f5457505ee0cdcc4c528793cf (patch)
treead15e90d45d1c64590e0c3c7fbc44fd68ff0c8e7 /provider
parent8b9c2726b05fef8eb073583ebb46271a5ef654b6 (diff)
downloaddirty-haskell.org-036a70f140eb7a6f5457505ee0cdcc4c528793cf.tar
dirty-haskell.org-036a70f140eb7a6f5457505ee0cdcc4c528793cf.tar.gz
dirty-haskell.org-036a70f140eb7a6f5457505ee0cdcc4c528793cf.tar.bz2
dirty-haskell.org-036a70f140eb7a6f5457505ee0cdcc4c528793cf.tar.xz
dirty-haskell.org-036a70f140eb7a6f5457505ee0cdcc4c528793cf.zip
footnotes for events/01
Diffstat (limited to 'provider')
-rw-r--r--provider/posts/events/01.lhs20
1 files 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
73Below we see one such form. 73Below we see one such form.
74 74
75`ListT`{.haskell} allows for nondeterministic computation – it allows us to split 75`ListT`{.haskell} allows for nondeterministic computation – it allows us to split
76our wordline and continue depth-first much like `[]`{.haskell}. 76our wordline[^worldlineSplits] and continue depth-first much like `[]`{.haskell}.
77 77
78Within every wordline we modify a distinct snapshot of `ObjCtx`{.haskell} we took 78Within every wordline we modify a distinct snapshot of `ObjCtx`{.haskell} we took
79while branching. 79while branching.
@@ -83,7 +83,7 @@ We also share one `EvalCtx`{.haskell} across all worldlines.
83> type Eval m a = StateT ObjCtx (ListT (StateT EvalCtx m)) a 83> type Eval m a = StateT ObjCtx (ListT (StateT EvalCtx m)) a
84 84
85`ListT`{.haskell} does not ship with extensive support for the 85`ListT`{.haskell} does not ship with extensive support for the
86[transformers package][transformers]: 86[transformers package][transformers][^pipes]:
87 87
88> instance MonadState s m => MonadState s (ListT m) where 88> instance MonadState s m => MonadState s (ListT m) where
89> get = lift get 89> get = lift get
@@ -92,7 +92,7 @@ We also share one `EvalCtx`{.haskell} across all worldlines.
92The context shared among all worldlines mainly contains all objects that 92The context shared among all worldlines mainly contains all objects that
93eventually get computed – haskells lazyness ensures that we terminate as 93eventually get computed – haskells lazyness ensures that we terminate as
94long as we don´t have objects depend on themselves in a sufficiently 94long as we don´t have objects depend on themselves in a sufficiently
95degenerate way. 95degenerate way[^degenerate].
96 96
97> data EvalCtx = EvalCtx 97> data EvalCtx = EvalCtx
98> { _ctxEvents :: [Object] 98> { _ctxEvents :: [Object]
@@ -105,7 +105,7 @@ degenerate way.
105> } 105> }
106 106
107Every wordline constructs exactly one object while having access to a set 107Every wordline constructs exactly one object while having access to a set
108of declarations that can occur anywhere on the wordline. 108of declarations that can occur anywhere on the wordline[^ctxVars].
109 109
110> data ObjCtx = ObjCtx 110> data ObjCtx = ObjCtx
111> { _objOccurs :: Bool 111> { _objOccurs :: Bool
@@ -135,8 +135,20 @@ layers to depend on one another:
135> where 135> where
136> x' = evalStateT (ListT.toList (objCtx <$> execStateT x def)) . flip (set ctxEvents) def . catMaybes 136> x' = evalStateT (ListT.toList (objCtx <$> execStateT x def)) . flip (set ctxEvents) def . catMaybes
137 137
138[^ctxVars]: In the base version of this file we carry declarations we may refer to when
139 creating objects (`_objVars`{.haskell}) within `EvalCtx`{.haskell} instead of `ObjCtx`{.haskell}.
140 Why is that a bad idea?
141
142[^worldlineSplits]: What does such a branching point look like in do notation?
143
144[^pipes]: It has been pointed out to me that `ListT`{.haskell} from [pipes][] does.
145
146[^degenerate]: Constructing an example that doesn´t terminate is trivial. Try constructing one that does while
147 still being self-referential!
148
138[Google Calendar]: <https://calendar.google.com> 149[Google Calendar]: <https://calendar.google.com>
139[Remind]: <https://www.roaringpenguin.com/products/remind> 150[Remind]: <https://www.roaringpenguin.com/products/remind>
140[JSON]: <https://en.wikipedia.org/wiki/JSON> 151[JSON]: <https://en.wikipedia.org/wiki/JSON>
141[monad transformers]: <https://en.wikibooks.org/wiki/Haskell/Monad_transformers> 152[monad transformers]: <https://en.wikibooks.org/wiki/Haskell/Monad_transformers>
142[transformers]: <https://hackage.haskell.org/package/transformers> 153[transformers]: <https://hackage.haskell.org/package/transformers>
154[pipes]: <https://hackage.haskell.org/package/pipes>