From b096aab78240e38ff69c120367e65be60cbc54f5 Mon Sep 17 00:00:00 2001 From: Adam Megacz Date: Tue, 29 Mar 2011 04:20:41 -0700 Subject: [PATCH] tweak comments in examples --- examples/ImmutableHeap.hs | 6 ------ examples/RegexMatcher.hs | 7 +++---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/examples/ImmutableHeap.hs b/examples/ImmutableHeap.hs index 56ff12c..717f84b 100644 --- a/examples/ImmutableHeap.hs +++ b/examples/ImmutableHeap.hs @@ -4,16 +4,10 @@ where import IsomorphismForCodeTypes import Prelude hiding ( id, (.) ) - class GuestLanguageHeap c where alloc :: <[ (Integer,Integer) -> Integer ]>@c lookup :: <[ Integer -> (Integer,Integer) ]>@c --- --- Here's nice example of Sheard's observation that it's often easier --- to write two-stage programs by applying "back" to some function rather than --- writing the final result directly --- onetwocycle = back onetwocycle' where onetwocycle' xy = <[ let (x,y) = ~~xy diff --git a/examples/RegexMatcher.hs b/examples/RegexMatcher.hs index ca02755..a50a10b 100644 --- a/examples/RegexMatcher.hs +++ b/examples/RegexMatcher.hs @@ -110,13 +110,12 @@ staged_accept (Times e1 e2) emptyOk k = staged_accept (Star e) emptyOk' k = loop emptyOk' where - -- loop :: Bool -> <[s -> Bool]>@g + -- Note that the type of "loop" is NOT (forall c s. <[s -> Bool]>@c) + -- because "k" is free here; this restrictionis analogous to the free + -- environment variable in Nanevski's example. loop emptyOk = if emptyOk then <[ \s -> ~~k s || ~~(staged_accept e True (loop False)) s ]> else <[ \s -> ~~(staged_accept e False (loop False)) s ]> - -- note that loop is not (forall c s. <[s -> Bool]>@c) - -- because "k" is free in loop; it is analogous to the free - -- environment variable in Nanevski's example staged_accept (Const c) emptyOk k = <[ \s -> if gs_empty s -- 1.7.10.4