tweak comments in examples
authorAdam Megacz <megacz@cs.berkeley.edu>
Tue, 29 Mar 2011 11:20:41 +0000 (04:20 -0700)
committerAdam Megacz <megacz@cs.berkeley.edu>
Tue, 29 Mar 2011 11:20:41 +0000 (04:20 -0700)
examples/ImmutableHeap.hs
examples/RegexMatcher.hs

index 56ff12c..717f84b 100644 (file)
@@ -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 
index ca02755..a50a10b 100644 (file)
@@ -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