grammar: open the Comb data-type
authorJulien Moutinho <julm+symantic-parser@sourcephile.fr>
Sat, 30 Jan 2021 18:09:34 +0000 (19:09 +0100)
committerJulien Moutinho <julm+symantic-parser@sourcephile.fr>
Sat, 30 Jan 2021 19:05:50 +0000 (20:05 +0100)
22 files changed:
src/Symantic/Parser/Grammar.hs
src/Symantic/Parser/Grammar/Combinators.hs
src/Symantic/Parser/Grammar/ObserveSharing.hs
src/Symantic/Parser/Grammar/Optimize.hs
src/Symantic/Parser/Grammar/View.hs
src/Symantic/Parser/Grammar/Write.hs
src/Symantic/Parser/Machine.hs
src/Symantic/Parser/Machine/Instructions.hs
src/Symantic/Parser/Machine/View.hs
test/Golden.hs
test/Golden/Grammar/boom.opt.dump
test/Golden/Grammar/brainfuck.dump
test/Golden/Grammar/brainfuck.opt.dump
test/Golden/Grammar/nandlang.dump
test/Golden/Grammar/nandlang.opt.dump
test/Golden/Machine/boom.dump
test/Golden/Machine/brainfuck.dump
test/Golden/Machine/many-char-eof.dump
test/Golden/Machine/nandlang.dump
test/Golden/Machine/some-string.dump
test/Parser/Brainfuck.hs
test/Parser/Nandlang.hs

index c21c939c384ff2ff620fe3ee25894922fffc5c7c..690d962b6ee374ef5cfa4273686f3ca5443a8330 100644 (file)
@@ -1,3 +1,4 @@
+{-# LANGUAGE AllowAmbiguousTypes #-} -- For grammar
 {-# LANGUAGE ConstraintKinds #-} -- For Grammar
 module Symantic.Parser.Grammar
   ( module Symantic.Parser.Grammar
@@ -23,10 +24,10 @@ import Text.Show (Show(..))
 import qualified Language.Haskell.TH.Syntax as TH
 
 -- Class 'Grammar'
-type Grammar repr =
+type Grammar tok repr =
   ( Applicable repr
   , Alternable repr
-  --, Satisfiable repr
+  , Satisfiable tok repr
   , Letable TH.Name repr
   , Selectable repr
   , Matchable repr
@@ -36,7 +37,7 @@ type Grammar repr =
 
 -- | A usual pipeline to interpret 'Comb'inators:
 -- 'observeSharing' then 'optimizeGrammar' then a polymorphic @(repr)@.
-grammar :: Grammar repr => ObserveSharing TH.Name (OptimizeGrammar TH.Name repr) a -> repr a
+grammar :: Grammar tok repr => ObserveSharing TH.Name (OptimizeGrammar TH.Name repr) a -> repr a
 grammar = optimizeGrammar . observeSharing
 
 -- | A usual pipeline to show 'Comb'inators:
index 53432e6885b16d7baf09a2a2503520ad906f5344..327db0926ab3ab314f049b174723c508c5997968 100644 (file)
@@ -202,14 +202,17 @@ conditional cs p def = match p fs qs def
 -}
 
 -- * Class 'Satisfiable'
-class Satisfiable repr tok where
+class Satisfiable tok repr where
   satisfy :: [ErrorItem tok] -> TermGrammar (tok -> Bool) -> repr tok
   default satisfy ::
-    Sym.Liftable repr => Satisfiable (Sym.Output repr) tok =>
+    Sym.Liftable repr => Satisfiable tok (Sym.Output repr) =>
     [ErrorItem tok] ->
     TermGrammar (tok -> Bool) -> repr tok
   satisfy es = Sym.lift . satisfy es
 
+  item :: repr tok
+  item = satisfy [] (H.const H..@ H.bool True)
+
 -- ** Type 'ErrorItem'
 data ErrorItem tok
   =  ErrorItemToken tok
@@ -233,8 +236,8 @@ class Lookable repr where
   eof :: repr ()
   eof = Sym.lift eof
   default eof :: Sym.Liftable repr => Lookable (Sym.Output repr) => repr ()
-  -- eof = negLook (satisfy @_ @Char [ErrorItemAny] (H.const H..@ H.bool True))
-             -- (item @_ @Char)
+  -- eof = negLook (satisfy @Char [ErrorItemAny] (H.const H..@ H.bool True))
+             -- (item @Char)
 
 {-# INLINE (<:>) #-}
 infixl 4 <:>
@@ -257,13 +260,13 @@ between open close p = open *> p <* close
 
 string ::
   Applicable repr => Alternable repr =>
-  Satisfiable repr Char =>
+  Satisfiable Char repr =>
   [Char] -> repr [Char]
 string = try . traverse char
 
 oneOf ::
   TH.Lift tok => Eq tok =>
-  Satisfiable repr tok =>
+  Satisfiable tok repr =>
   [tok] -> repr tok
 oneOf ts = satisfy [ErrorItemLabel "oneOf"]
   (Sym.trans H.ValueCode
@@ -272,7 +275,7 @@ oneOf ts = satisfy [ErrorItemLabel "oneOf"]
 
 noneOf ::
   TH.Lift tok => Eq tok =>
-  Satisfiable repr tok =>
+  Satisfiable tok repr =>
   [tok] -> repr tok
 noneOf cs = satisfy (ErrorItemToken Functor.<$> cs) (Sym.trans H.ValueCode
   { value = not . (`List.elem` cs)
@@ -288,21 +291,21 @@ ofChars = List.foldr (\alt acc ->
   \inp -> [|| alt == $$inp || $$(acc inp) ||])
   (const [||False||])
 
-more :: Applicable repr => Satisfiable repr Char => Lookable repr => repr ()
-more = look (void (item @_ @Char))
+more :: Applicable repr => Satisfiable Char repr => Lookable repr => repr ()
+more = look (void (item @Char))
 
 char ::
-  Applicable repr => Satisfiable repr Char =>
+  Applicable repr => Satisfiable Char repr =>
   Char -> repr Char
 char c = satisfy [ErrorItemToken c] (H.eq H..@ H.char c) $> H.char c
 -- char c = satisfy [ErrorItemToken c] (H.eq H..@ H.qual H..@ H.char c) $> H.char c
 
-anyChar :: Satisfiable repr Char => repr Char
+anyChar :: Satisfiable Char repr => repr Char
 anyChar = satisfy [] (H.const H..@ H.bool True)
 
 token ::
   TH.Lift tok => Show tok => Eq tok =>
-  Applicable repr => Satisfiable repr tok =>
+  Applicable repr => Satisfiable tok repr =>
   tok -> repr tok
 token tok = satisfy [ErrorItemToken tok] (H.eq H..@ H.char tok) $> H.char tok
 -- token tok = satisfy [ErrorItemToken tok] (H.eq H..@ H.qual H..@ H.char tok) $> H.char tok
@@ -310,12 +313,9 @@ token tok = satisfy [ErrorItemToken tok] (H.eq H..@ H.char tok) $> H.char tok
 tokens ::
   TH.Lift tok => Eq tok => Show tok =>
   Applicable repr => Alternable repr =>
-  Satisfiable repr tok => [tok] -> repr [tok]
+  Satisfiable tok repr => [tok] -> repr [tok]
 tokens = try . traverse token
 
-item :: Satisfiable repr tok => repr tok
-item = satisfy [] (H.const H..@ H.bool True)
-
 -- Composite Combinators
 -- someTill :: repr a -> repr b -> repr [a]
 -- someTill p end = negLook end *> (p <:> manyTill p end)
index f82eac798a9680ec8ab527dfdd2533dd4cd0dcc8..4094f91bbc626deee7f97a44a1bc82d82795be37 100644 (file)
@@ -31,8 +31,8 @@ instance
   , MakeLetName letName
   , Eq letName
   , Hashable letName
-  , G.Satisfiable repr tok
-  ) => G.Satisfiable (ObserveSharing letName repr) tok
+  , G.Satisfiable tok repr
+  ) => G.Satisfiable tok (ObserveSharing letName repr)
 instance
   ( Letable letName repr
   , MakeLetName letName
@@ -94,7 +94,7 @@ instance
 -- Combinators semantics for the 'CleanDefs' interpreter
 instance G.Applicable repr => G.Applicable (CleanDefs letName repr)
 instance G.Alternable repr => G.Alternable (CleanDefs letName repr)
-instance G.Satisfiable repr tok => G.Satisfiable (CleanDefs letName repr) tok
+instance G.Satisfiable tok repr => G.Satisfiable tok (CleanDefs letName repr)
 instance G.Selectable repr => G.Selectable (CleanDefs letName repr)
 instance G.Matchable repr => G.Matchable (CleanDefs letName repr) where
   conditional a cs bs b = CleanDefs $
index 21bb5e9db4d64f75fbc7bf0f30a8096a4aea5817..6d74476090e765f7f2d39f350aaab881db9bb096 100644 (file)
@@ -1,6 +1,6 @@
-{-# LANGUAGE PatternSynonyms #-} -- For aliased combinators
-{-# LANGUAGE TemplateHaskell #-} -- For optimizeCombNode
-{-# LANGUAGE ViewPatterns #-} -- For optimizeCombNode
+{-# LANGUAGE PatternSynonyms #-} -- For Comb and OptC
+{-# LANGUAGE TemplateHaskell #-} -- For branch
+{-# LANGUAGE ViewPatterns #-} -- For unSomeComb
 {-# OPTIONS_GHC -fno-warn-orphans #-} -- For MakeLetName TH.Name
 module Symantic.Parser.Grammar.Optimize where
 
@@ -8,10 +8,13 @@ import Data.Bool (Bool(..))
 import Data.Either (Either(..), either)
 import Data.Eq (Eq(..))
 import Data.Function ((.))
+import Data.Maybe (Maybe(..))
 import qualified Data.Functor as Functor
 import qualified Data.Foldable as Foldable
 import qualified Data.List as List
 import qualified Language.Haskell.TH.Syntax as TH
+import Data.Kind (Constraint, Type)
+import Type.Reflection (Typeable, typeRep, eqTypeRep, (:~~:)(..))
 
 import Symantic.Parser.Grammar.Combinators as Comb
 import Symantic.Parser.Haskell ()
@@ -19,430 +22,438 @@ import Symantic.Univariant.Letable
 import Symantic.Univariant.Trans
 import qualified Symantic.Parser.Haskell as H
 
--- import Debug.Trace (trace)
+{-
+import Data.Function (($), flip)
+import Debug.Trace (trace)
 
--- * Type 'Comb'
--- | Pattern-matchable 'Comb'inators of the grammar.
--- @(repr)@ is not strictly necessary since it's only a phantom type
--- (no constructor use it as a value), but having it:
---
--- 1. emphasizes that those 'Comb'inators will be 'trans'formed again
---    (eg. in 'ViewGrammar' or 'Instr'uctions).
---
--- 2. Avoid overlapping instances between
---    @('Trans' ('Comb' repr) repr)@ and
---    @('Trans' ('Comb' repr) ('OptimizeGrammar' letName repr))@
-data Comb repr a where
-  Pure :: TermGrammar a -> Comb repr a
-  Satisfy ::
-    Satisfiable repr tok =>
-    [ErrorItem tok] ->
-    TermGrammar (tok -> Bool) -> Comb repr tok
-  Item :: Satisfiable repr tok => Comb repr tok
-  Try :: Comb repr a -> Comb repr a
-  Look :: Comb repr a -> Comb repr a
-  NegLook :: Comb repr a -> Comb repr ()
-  Eof :: Comb repr ()
-  (:<*>) :: Comb repr (a -> b) -> Comb repr a -> Comb repr b
-  (:<*) :: Comb repr a -> Comb repr b -> Comb repr a
-  (:*>) :: Comb repr a -> Comb repr b -> Comb repr b
-  (:<|>) :: Comb repr a -> Comb repr a -> Comb repr a
-  Empty :: Comb repr a
-  Branch ::
-    Comb repr (Either a b) ->
-    Comb repr (a -> c) -> Comb repr (b -> c) -> Comb repr c
-  Match :: Eq a =>
-    Comb repr a ->
-    [TermGrammar (a -> Bool)] ->
-    [Comb repr b] -> Comb repr b -> Comb repr b
-  ChainPre :: Comb repr (a -> a) -> Comb repr a -> Comb repr a
-  ChainPost :: Comb repr a -> Comb repr (a -> a) -> Comb repr a
-  Def :: TH.Name -> Comb repr a -> Comb repr a
-  Ref :: Bool -> TH.Name -> Comb repr a
-infixl 3 :<|>
-infixl 4 :<*>
-infixl 4 :<*, :*>
+(&) = flip ($)
+infix 0 &
+-}
 
-pattern (:<$>) :: TermGrammar (a -> b) -> Comb repr a -> Comb repr b
-pattern x :<$> p = Pure x :<*> p
-pattern (:$>) :: Comb repr a -> TermGrammar b -> Comb repr b
-pattern (:<$) :: TermGrammar a -> Comb repr b -> Comb repr a
-pattern p :$> x = p :*> Pure x
-pattern x :<$ p = Pure x :<* p
-infixl 4 :<$>, :<$, :$>
+-- * Data family 'Comb'
+-- | 'Comb'uctions for the 'Machine'.
+-- This is an extensible data-type.
+data family Comb
+  (comb :: ReprComb -> Constraint)
+  (repr :: ReprComb)
+  :: ReprComb
 
-{-
-pattern (:*>) :: Comb repr a -> Comb repr b -> Comb repr b
-pattern (:<*) :: Comb repr a -> Comb repr b -> Comb repr a
-pattern x :<* p = H.Const :<$> x :<*> p
-pattern p :*> x = H.Id :<$ p :<*> x
-x .<* p = H.const :<$> x :<*> p
-x .<$ p = Pure x .<* p
-p .*> x = H.id .<$ p :<*> x
-p .$> x = p .*> Pure x
--}
+-- | Convenient utility to pattern-match a 'SomeComb'.
+pattern Comb :: Typeable comb =>
+  Comb comb repr a ->
+  SomeComb repr a
+pattern Comb x <- (unSomeComb -> Just x)
 
-{-
-pattern (:<$>) :: Defunc (a -> b) -> Fix Combinator a -> Combinator (Fix Combinator) b
-pattern f :<$> p = (Pure f) :<*> p
-pattern (:$>) :: Fix Combinator a -> Defunc b -> Combinator (Fix Combinator) b
-pattern p :$> x = p :*> (Pure x)
-pattern (:<$) :: Defunc a -> Fix Combinator b -> Combinator (Fix Combinator) a
-pattern x :<$ p = (Pure x) :<* p
--}
+-- ** Type 'ReprComb'
+type ReprComb = Type -> Type
 
+-- ** Type 'SomeComb'
+-- | Some 'Comb'inator existentialized over the actual combinator symantic class.
+-- Useful to handle a list of 'Comb'inators
+-- without requiring impredicative quantification.
+-- Must be used by pattern-matching
+-- on the 'SomeComb' data-constructor,
+-- to bring the constraints in scope.
+data SomeComb repr a =
+  forall comb.
+  (Trans (Comb comb repr) repr, Typeable comb) =>
+  SomeComb (Comb comb repr a)
 
-instance Applicable (Comb repr) where
-  pure = Pure
-  (<*>) = (:<*>)
-  (<*) = (:<*)
-  (*>) = (:*>)
-instance Alternable (Comb repr) where
-  (<|>) = (:<|>)
-  empty = Empty
-  try = Try
-instance Selectable (Comb repr) where
-  branch = Branch
-instance Matchable (Comb repr) where
-  conditional = Match
-instance Foldable (Comb repr) where
-  chainPre = ChainPre
-  chainPost = ChainPost
-instance Satisfiable repr tok => Satisfiable (Comb repr) tok where
-  satisfy = Satisfy
-instance Lookable (Comb repr) where
-  look = Look
-  negLook = NegLook
-  eof = Eof
-instance Letable TH.Name (Comb repr) where
-  def = Def
-  ref = Ref
-instance MakeLetName TH.Name where
-  makeLetName _ = TH.qNewName "name"
+instance Trans (SomeComb repr) repr where
+  trans (SomeComb x) = trans x
 
--- Pattern-matchable 'Comb'inators keep enough structure
--- to have some of the symantics producing them interpreted again
--- (eg. after being modified by 'optimizeGrammar').
-type instance Output (Comb repr) = repr
-instance
-  ( Applicable repr
-  , Alternable repr
-  , Selectable repr
-  , Foldable repr
-  , Lookable repr
-  , Matchable repr
-  , Letable TH.Name repr
-  ) => Trans (Comb repr) repr where
+-- | @(unSomeComb c :: 'Maybe' ('Comb' comb repr a))@
+-- extract the data-constructor from the given 'SomeComb'
+-- iif. it belongs to the @('Comb' comb repr a)@ data-instance.
+unSomeComb ::
+  forall comb repr a.
+  Typeable comb =>
+  SomeComb repr a -> Maybe (Comb comb repr a)
+unSomeComb (SomeComb (c::Comb c repr a)) =
+  case typeRep @comb `eqTypeRep` typeRep @c of
+    Just HRefl -> Just c
+    Nothing -> Nothing
+
+-- Applicable
+data instance Comb Applicable repr a where
+  Pure :: TermGrammar a -> Comb Applicable repr a
+  (:<*>:) :: SomeComb repr (a -> b) -> SomeComb repr a -> Comb Applicable repr b
+  (:<*:) :: SomeComb repr a -> SomeComb repr b -> Comb Applicable repr a
+  (:*>:) :: SomeComb repr a -> SomeComb repr b -> Comb Applicable repr b
+infixl 4 :<*>:, :<*:, :*>:
+pattern (:<$>:) :: TermGrammar (a -> b) -> SomeComb repr a -> Comb Applicable repr b
+pattern t :<$>: x <- Comb (Pure t) :<*>: x
+pattern (:$>:) :: SomeComb repr a -> TermGrammar b -> Comb Applicable repr b
+pattern x :$>: t <- x :*>: Comb (Pure t)
+instance Applicable repr => Trans (Comb Applicable repr) repr where
   trans = \case
-    Pure a -> pure (H.optimizeTerm a)
-    Satisfy es p -> satisfy es p
-    Item -> item
+    Pure x -> pure (H.optimizeTerm x)
+    f :<*>: x -> trans f <*> trans x
+    x :<*: y -> trans x <* trans y
+    x :*>: y -> trans x *> trans y
+instance Applicable repr => Applicable (SomeComb repr) where
+  pure = SomeComb . Pure
+  (<*>) f = SomeComb . (:<*>:) f
+  (<*) x = SomeComb . (:<*:) x
+  (*>) x = SomeComb . (:*>:) x
+
+-- Alternable
+data instance Comb Alternable repr a where
+  Empty :: Comb Alternable repr a
+  (:<|>:) :: SomeComb repr a -> SomeComb repr a -> Comb Alternable repr a
+  Try :: SomeComb repr a -> Comb Alternable repr a
+infixl 3 :<|>:
+instance Alternable repr => Trans (Comb Alternable repr) repr where
+  trans = \case
+    Empty -> empty
+    f :<|>: x -> trans f <|> trans x
     Try x -> try (trans x)
+instance Alternable repr => Alternable (SomeComb repr) where
+  empty = SomeComb Empty
+  (<|>) f = SomeComb . (:<|>:) f
+  try = SomeComb . Try
+
+-- Selectable
+data instance Comb Selectable repr a where
+  Branch ::
+    SomeComb repr (Either a b) ->
+    SomeComb repr (a -> c) ->
+    SomeComb repr (b -> c) ->
+    Comb Selectable repr c
+instance Selectable repr => Trans (Comb Selectable repr) repr where
+  trans = \case
+    Branch lr l r -> branch (trans lr) (trans l) (trans r)
+instance Selectable repr => Selectable (SomeComb repr) where
+  branch lr l = SomeComb . Branch lr l
+
+-- Matchable
+data instance Comb Matchable repr a where
+  Conditional :: Eq a =>
+    SomeComb repr a ->
+    [TermGrammar (a -> Bool)] ->
+    [SomeComb repr b] ->
+    SomeComb repr b ->
+    Comb Matchable repr b
+instance Matchable repr => Trans (Comb Matchable repr) repr where
+  trans = \case
+    Conditional a ps bs b -> conditional (trans a) ps (trans Functor.<$> bs) (trans b)
+instance Matchable repr => Matchable (SomeComb repr) where
+  conditional a ps bs = SomeComb . Conditional a ps bs
+
+-- Foldable
+data instance Comb Foldable repr a where
+  ChainPreC :: SomeComb repr (a -> a) -> SomeComb repr a -> Comb Foldable repr a
+  ChainPostC :: SomeComb repr a -> SomeComb repr (a -> a) -> Comb Foldable repr a
+instance Foldable repr => Trans (Comb Foldable repr) repr where
+  trans = \case
+    ChainPreC x y -> chainPre (trans x) (trans y)
+    ChainPostC x y -> chainPost (trans x) (trans y)
+instance Foldable repr => Foldable (SomeComb repr) where
+  chainPre x = SomeComb . ChainPreC x
+  chainPost x = SomeComb . ChainPostC x
+
+-- Lookable
+data instance Comb Lookable repr a where
+  Look :: SomeComb repr a -> Comb Lookable repr a
+  NegLook :: SomeComb repr a -> Comb Lookable repr ()
+  Eof :: Comb Lookable repr ()
+instance Lookable repr => Trans (Comb Lookable repr) repr where
+  trans = \case
     Look x -> look (trans x)
     NegLook x -> negLook (trans x)
     Eof -> eof
-    x :<* y -> trans x <* trans y
-    x :*> y -> trans x *> trans y
-    x :<*> y -> trans x <*> trans y
-    x :<|> y -> trans x <|> trans y
-    Empty -> empty
-    Branch lr l r -> branch (trans lr) (trans l) (trans r)
-    Match a ps bs b -> conditional (trans a) ps (trans Functor.<$> bs) (trans b)
-    ChainPre x y -> chainPre (trans x) (trans y)
-    ChainPost x y -> chainPost (trans x) (trans y)
-    Def n x -> def n (trans x)
-    Ref r n -> ref r n
+instance Lookable repr => Lookable (SomeComb repr) where
+  look = SomeComb . Look
+  negLook = SomeComb . NegLook
+  eof = SomeComb Eof
 
-{-
--- * Type 'OptimizeHaskell'
-newtype OptimizeHaskell letName repr a =
-        OptimizeHaskell { unOptimizeHaskell :: Comb repr a }
+-- Satisfiable
+data instance Comb (Satisfiable tok) repr a where
+  Satisfy ::
+    Satisfiable tok repr =>
+    [ErrorItem tok] ->
+    TermGrammar (tok -> Bool) ->
+    Comb (Satisfiable tok) repr tok
+  Item ::
+    Satisfiable tok repr =>
+    Comb (Satisfiable tok) repr tok
+instance Satisfiable tok repr => Trans (Comb (Satisfiable tok) repr) repr where
+  trans = \case
+    Satisfy es p -> satisfy es p
+    Item -> item
 instance
-  Letable letName (Comb repr) =>
-  Letable letName (OptimizeGrammar letName repr)
-instance Comb.Applicable (OptimizeGrammar letName repr) where
-  pure a = pure (optimizeTerm a)
-instance Comb.Alternable (OptimizeGrammar letName repr)
-instance Comb.Satisfiable repr tok =>
-         Comb.Satisfiable (OptimizeGrammar letName repr) tok
-instance Comb.Selectable (OptimizeGrammar letName repr)
-instance Comb.Matchable (OptimizeGrammar letName repr)
-instance Comb.Lookable (OptimizeGrammar letName repr)
-instance Comb.Foldable (OptimizeGrammar letName repr)
--}
+  (Satisfiable tok repr, Typeable tok) =>
+  Satisfiable tok (SomeComb repr) where
+  satisfy es = SomeComb . Satisfy es
+  item = SomeComb Item
+
+-- Letable
+data instance Comb (Letable letName) repr a where
+  Def :: letName -> SomeComb repr a -> Comb (Letable letName) repr a
+  Ref :: Bool -> letName -> Comb (Letable letName) repr a
+instance Letable letName repr => Trans (Comb (Letable letName) repr) repr where
+  trans = \case
+    Def n v -> def n (trans v)
+    Ref isRec n -> ref isRec n
+instance
+  (Letable letName repr, Typeable letName) =>
+  Letable letName (SomeComb repr) where
+  def n = SomeComb . Def n
+  ref isRec = SomeComb . Ref isRec
+instance MakeLetName TH.Name where
+  makeLetName _ = TH.qNewName "name"
 
 -- * Type 'OptimizeGrammar'
--- | Bottom-up application of 'optimizeCombNode'.
-newtype OptimizeGrammar letName repr a =
-        OptimizeGrammar { unOptimizeGrammar :: Comb repr a }
+type OptimizeGrammar = OptComb
 
 optimizeGrammar ::
-  Trans (OptimizeGrammar TH.Name repr) repr =>
-  OptimizeGrammar TH.Name repr a -> repr a
+  Trans (OptComb TH.Name repr) repr =>
+  OptComb TH.Name repr a -> repr a
 optimizeGrammar = trans
-instance
-  Trans (Comb repr) repr =>
-  Trans (OptimizeGrammar letName repr) repr where
-  trans = trans . unOptimizeGrammar
-
-type instance Output (OptimizeGrammar _letName repr) = Comb repr
-instance Trans (OptimizeGrammar letName repr) (Comb repr) where
-  trans = unOptimizeGrammar
-instance Trans (Comb repr) (OptimizeGrammar letName repr) where
-  trans = OptimizeGrammar . optimizeCombNode
-instance Trans1 (Comb repr) (OptimizeGrammar letName repr)
-instance Trans2 (Comb repr) (OptimizeGrammar letName repr)
-instance Trans3 (Comb repr) (OptimizeGrammar letName repr)
 
+-- ** Type 'OptComb'
+newtype OptComb letName repr a =
+        OptComb { unOptComb :: SomeComb repr a }
+-- | Matching an 'OptComb'.
+pattern OptC :: Typeable comb => Comb comb repr a -> OptComb letName repr a
+pattern OptC x <- (unSomeComb . unOptComb -> Just x)
 instance
-  Letable letName (Comb repr) =>
-  Letable letName (OptimizeGrammar letName repr) where
-  -- Disable useless calls to 'optimizeCombNode'
-  -- because 'Def' or 'Ref' have no matching in it.
-  def n = OptimizeGrammar . def n . unOptimizeGrammar
-  ref r n = OptimizeGrammar (ref r n)
-instance Comb.Applicable (OptimizeGrammar letName repr)
-instance Comb.Alternable (OptimizeGrammar letName repr)
-instance Comb.Satisfiable repr tok =>
-         Comb.Satisfiable (OptimizeGrammar letName repr) tok
-instance Comb.Selectable (OptimizeGrammar letName repr)
-instance Comb.Matchable (OptimizeGrammar letName repr)
-instance Comb.Lookable (OptimizeGrammar letName repr)
-instance Comb.Foldable (OptimizeGrammar letName repr)
-
-
-optimizeCombNode :: Comb repr a -> Comb repr a
+  Trans (SomeComb repr) repr =>
+  Trans (OptComb letName repr) repr where
+  trans = trans . unOptComb
 
-----------------------------------------------
--- Destructive optimizations
-----------------------------------------------
-
-optimizeCombNode (Empty :<*> _) =
-  -- trace "App Right Absorption Law" $
-  Empty
-optimizeCombNode (u :<*> Empty) =
-  -- trace "App Failure Weakening Law" $
-  optimizeCombNode (u :*> Empty)
-optimizeCombNode (Empty :*> _) =
-  -- trace "App Right Absorption Law" $
-  Empty
-optimizeCombNode (Empty :<* _) =
-  -- trace "App Right Absorption Law" $
-  Empty
-optimizeCombNode (u :<* Empty) =
-  -- trace "App Failure Weakening Law" $
-  optimizeCombNode (u :*> Empty)
-optimizeCombNode (Branch Empty _ _) =
-  -- trace "Branch Absorption Law" $
-  Empty
-optimizeCombNode (Branch b Empty Empty) =
-  -- trace "Branch Weakening Law" $
-  optimizeCombNode (b :*> Empty)
-optimizeCombNode (Match Empty _ _ d) =
-  -- trace "Match Absorption Law" $
-  d
-optimizeCombNode (Match p _ qs Empty)
-  | Foldable.all (\case {Empty -> True; _ -> False}) qs =
-  -- trace "Match Weakening Law" $
-  optimizeCombNode (p :*> Empty)
+instance
+  ( Applicable repr
+  , Alternable repr
+  , Lookable repr
+  , Selectable repr
+  , Matchable repr
+  ) => Applicable (OptComb letName repr) where
+  pure = OptComb . pure
 
+  f <$> OptC (Branch b l r) =
+    branch (OptComb b)
+      ((H..) H..@ f <$> OptComb l)
+      ((H..) H..@ f <$> OptComb r)
+    -- & trace "Branch Distributivity Law"
+  f <$> OptC (Conditional a ps bs d) =
+    conditional (OptComb a) ps
+      ((f <$>) . OptComb Functor.<$> bs)
+      (f <$> OptComb d)
+    -- & trace "Conditional Distributivity Law"
+  -- Being careful here to use (<*>),
+  -- instead of OptComb (f <$> unOptComb x),
+  -- in order to apply the optimizations of (<*>).
+  f <$> x = pure f <*> x
 
-----------------------------------------------
--- Applicative optimizations
-----------------------------------------------
+  x <$ u = u $> x
+    -- & trace "Commutativity Law"
 
-{- Those laws require to pattern match on some singled-out pure constructors,
- - but 'optimizeHaskellNode' is normalizing them using lambda abstractions
- - and thus they will no longer match.
+  OptC Empty <*> _ = empty
+    -- & trace "App Right Absorption Law"
+  u <*> OptC Empty = u *> empty
+    -- & trace "App Failure Weakening Law"
+  OptC (Pure f) <*> OptC (Pure x) = pure (f H..@ x)
+    -- & trace "Homomorphism Law"
+  OptC (Pure f) <*> OptC (g :<$>: p) =
+    -- This is basically a shortcut,
+    -- it can be caught by the Composition Law
+    -- and Homomorphism Law.
+    (H..) H..@ f H..@ g <$> OptComb p
+    -- & trace "Functor Composition Law"
+  u <*> OptC (v :<*>: w) =
+    (((H..) <$> u) <*> OptComb v) <*> OptComb w
+    -- & trace "Composition Law"
+  u <*> OptC (Pure x) =
+    H.flip H..@ (H.$) H..@ x <$> u
+    -- & trace "Interchange Law"
+  OptC (u :*>: v) <*> w =
+    OptComb u *> (OptComb v <*> w)
+    -- & trace "Reassociation Law 1"
+  u <*> OptC (v :<*: w) =
+    (u <*> OptComb v) <* OptComb w
+    -- & trace "Reassociation Law 2"
+  u <*> OptC (v :$>: x) =
+    (u <*> pure x) <* OptComb v
+    -- & trace "Reassociation Law 3"
+  p <*> OptC (NegLook q) =
+    (p <*> pure H.unit) <* negLook (OptComb q)
+    -- & trace "Absorption Law"
+  OptComb x <*> OptComb y = OptComb (x <*> y)
 
-optimizeCombNode (H.Id :<$> u) =
-  -- trace "Identity Law" $
-  u
-optimizeCombNode ((H.Flip H.:@ H.Const) :<$> u) =
-  -- trace "Flip Const Optimisation" $
-  optimizeCombNode (u :*> Pure H.id)
-optimizeCombNode (((H.Flip H.:@ H.Const) :<$> p) :<*> q) =
-  -- trace "Definition of *>" $
-  p :*> q
-optimizeCombNode ((H.Const :<$> p) :<*> q) =
-  -- trace "Definition of <*" $
-  p :<* q
--}
-optimizeCombNode (f :<$> Pure x) =
-  -- trace "Homomorphism Law" $
-  Pure (f H..@ x)
-optimizeCombNode (f :<$> (g :<$> p)) =
-  -- NOTE: This is basically a shortcut, it can be caught by the Composition Law and Homomorphism Law
-  -- trace "Functor Composition Law" $
-  optimizeCombNode ((H..) H..@ f H..@ g :<$> p)
-optimizeCombNode (u :<*> (v :<*> w)) =
-  -- trace "Composition Law" $
-  optimizeCombNode (optimizeCombNode (optimizeCombNode ((H..) :<$> u) :<*> v) :<*> w)
-optimizeCombNode ((u :*> v) :<*> w) =
-  -- trace "Reassociation Law 1" $
-  optimizeCombNode (u :*> (optimizeCombNode (v :<*> w)))
-optimizeCombNode (u :<*> (Pure x)) =
-  -- trace "Interchange Law" $
-  optimizeCombNode (H.flip H..@ (H.$) H..@ x :<$> u)
-optimizeCombNode ((_ :<$> p) :*> q) =
-  -- trace "Right Absorption Law" $
-  p :*> q
-optimizeCombNode (p :<* (_ :<$> q)) =
-  -- trace "Left Absorption Law"
-  p :<* q
-optimizeCombNode (u :<*> (v :<* w)) =
-  -- trace "Reassociation Law 2" $
-  optimizeCombNode (optimizeCombNode (u :<*> v) :<* w)
-optimizeCombNode (u :<*> (v :$> x)) =
-  -- trace "Reassociation Law 3" $
-  optimizeCombNode (optimizeCombNode (u :<*> Pure x) :<* v)
+  OptC Empty *> _ = empty
+    -- & trace "App Right Absorption Law"
+  OptC (_ :<$>: p) *> q = OptComb p *> q
+    -- & trace "Right Absorption Law"
+  OptC Pure{} *> u = u
+    -- & trace "Identity Law"
+  OptC (u :$>: _) *> v = OptComb u *> v
+    -- & trace "Identity Law"
+  u *> OptC (v :*>: w) =
+    (u *> OptComb v) *> OptComb w
+    -- & trace "Associativity Law"
+  OptComb x *> OptComb y = OptComb (x *> y)
 
-----------------------------------------------
--- Alternative optimizations
-----------------------------------------------
+  OptC Empty <* _ = empty
+    -- & trace "App Right Absorption Law"
+  u <* OptC Empty = u *> empty
+    -- & trace "App Failure Weakening Law"
+  p <* OptC (_ :<$>: q) = p <* OptComb q
+    -- & trace "Left Absorption Law"
+  u <* OptC Pure{} = u
+    -- & trace "Identity Law"
+  u <* OptC (v :$>: _) = u <* OptComb v
+    -- & trace "Identity Law"
+  OptC (u :<*: v) <* w = OptComb u <* (OptComb v <* w)
+    -- & trace "Associativity Law"
+  OptComb x <* OptComb y = OptComb (x <* y)
+instance
+  ( Applicable repr
+  , Alternable repr
+  , Lookable repr
+  , Selectable repr
+  , Matchable repr
+  ) => Alternable (OptComb letName repr) where
+  empty = OptComb empty
 
-optimizeCombNode (p@Pure{} :<|> _) =
-  -- trace "Left Catch Law" $
-  p
-optimizeCombNode (Empty :<|> u) =
-  -- trace "Left Neutral Law" $
-  u
-optimizeCombNode (u :<|> Empty) =
-  -- trace "Right Neutral Law" $
-  u
-optimizeCombNode ((u :<|> v) :<|> w) =
-  -- trace "Associativity Law" $
-  u :<|> optimizeCombNode (v :<|> w)
+  p@(OptC Pure{}) <|> _ = p
+    -- & trace "Left Catch Law"
+  OptC Empty <|> u = u
+    -- & trace "Left Neutral Law"
+  u <|> OptC Empty = u
+    -- & trace "Right Neutral Law"
+  OptC (u :<|>: v) <|> w = OptComb u <|> (OptComb v <|> w)
+    -- & trace "Associativity Law"
+  OptC (Look p) <|> OptC (Look q) =
+    look (try (OptComb p) <|> OptComb q)
+    -- & trace "Distributivity Law"
+  OptComb x <|> OptComb y = OptComb (x <|> y)
 
-----------------------------------------------
--- Sequencing optimizations
-----------------------------------------------
+  try (OptC (p :$>: x)) = try (OptComb p) $> x
+    -- & trace "Try Interchange Law"
+  try (OptC (f :<$>: p)) = f <$> try (OptComb p)
+    -- & trace "Try Interchange Law"
+  try (OptComb x) = OptComb (try x)
+instance
+  ( Applicable repr
+  , Alternable repr
+  , Lookable repr
+  , Selectable repr
+  , Matchable repr
+  ) => Lookable (OptComb letName repr) where
+  look p@(OptC Pure{}) = p
+    -- & trace "Pure Look Law"
+  look p@(OptC Empty) = p
+    -- & trace "Dead Look Law"
+  look (OptC (Look x)) = look (OptComb x)
+    -- & trace "Idempotence Law"
+  look (OptC (NegLook x)) = negLook (OptComb x)
+    -- & trace "Left Identity Law"
+  look (OptC (p :$>: x)) = look (OptComb p) $> x
+    -- & trace "Interchange Law"
+  look (OptC (f :<$>: p)) = f <$> look (OptComb p)
+    -- & trace "Interchange Law"
+  look (OptComb x) = OptComb (look x)
 
-optimizeCombNode ((Pure _) :*> u) =
-  -- trace "Identity Law" $
-  u
-optimizeCombNode ((u :$> _) :*> v) =
-  -- trace "Identity Law" $
-  u :*> v
-optimizeCombNode (u :*> (v :*> w)) =
-  -- trace "Associativity Law" $
-  optimizeCombNode (optimizeCombNode (u :*> v) :*> w)
-optimizeCombNode (u :<* (Pure _)) =
-  -- trace "Identity Law" $
-  u
-optimizeCombNode (u :<* (v :$> _)) =
-  -- trace "Identity Law" $
-  optimizeCombNode (u :<* v)
-optimizeCombNode (x :<$ u) =
-  -- trace "Commutativity Law" $
-  optimizeCombNode (u :$> x)
-optimizeCombNode ((u :<* v) :<* w) =
-  -- trace "Associativity Law" $
-  optimizeCombNode (u :<* optimizeCombNode (v :<* w))
-optimizeCombNode (Look p@Pure{}) =
-  -- trace "Pure Look Law" $
-  p
-optimizeCombNode (Look p@Empty) =
-  -- trace "Dead Look Law" $
-  p
-optimizeCombNode (NegLook Pure{}) =
-  -- trace "Pure Negative-Look" $
-  Empty
-optimizeCombNode (NegLook Empty) =
-  -- trace "Dead Negative-Look" $
-  Pure H.unit
-optimizeCombNode (NegLook (NegLook p)) =
-  -- trace "Double Negation Law" $
-  optimizeCombNode (Look (Try p :*> Pure H.unit))
-optimizeCombNode (NegLook (Try p)) =
-  -- trace "Zero Consumption Law" $
-  optimizeCombNode (NegLook p)
-optimizeCombNode (Look (Look p)) =
-  -- trace "Idempotence Law" $
-  Look p
-optimizeCombNode (NegLook (Look p)) =
-  -- trace "Right Identity Law" $
-  optimizeCombNode (NegLook p)
-optimizeCombNode (Look (NegLook p)) =
-  -- trace "Left Identity Law" $
-  NegLook p
-optimizeCombNode (NegLook (Try p :<|> q)) =
-  -- trace "Transparency Law" $
-  optimizeCombNode (optimizeCombNode (NegLook p) :*> optimizeCombNode (NegLook q))
-optimizeCombNode (Look p :<|> Look q) =
-  -- trace "Distributivity Law" $
-  optimizeCombNode (Look (optimizeCombNode ((Try p) :<|> q)))
-optimizeCombNode (Look (p :$> x)) =
-  -- trace "Interchange Law" $
-  optimizeCombNode (optimizeCombNode (Look p) :$> x)
-optimizeCombNode (Look (f :<$> p)) =
-  -- trace "Interchange Law" $
-  optimizeCombNode (f :<$> optimizeCombNode (Look p))
-optimizeCombNode (p :<*> NegLook q) =
-  -- trace "Absorption Law" $
-  optimizeCombNode (optimizeCombNode (p :<*> Pure H.unit) :<* NegLook q)
-optimizeCombNode (NegLook ((p :$> _))) =
-  -- trace "NegLookIdempotence Law" $
-  optimizeCombNode (NegLook p)
-optimizeCombNode (NegLook ((_ :<$> p))) =
-  -- trace "NegLook Idempotence Law" $
-  optimizeCombNode (NegLook p)
-optimizeCombNode (Try (p :$> x)) =
-  -- trace "Try Interchange Law" $
-  optimizeCombNode (optimizeCombNode (Try p) :$> x)
-optimizeCombNode (Try (f :<$> p)) =
-  -- trace "Try Interchange Law" $
-  optimizeCombNode (f :<$> optimizeCombNode (Try p))
-optimizeCombNode (Branch (Pure (trans -> lr)) l r) =
-  -- trace "Branch Pure Left/Right Law" $
-  case H.value lr of
-    Left value -> optimizeCombNode (l :<*> Pure (trans H.ValueCode{..}))
-      where code = [|| case $$(H.code lr) of Left x -> x ||]
-    Right value -> optimizeCombNode (r :<*> Pure (trans H.ValueCode{..}))
-      where code = [|| case $$(H.code lr) of Right x -> x ||]
-optimizeCombNode (Branch b (Pure (trans -> l)) (Pure (trans -> r))) =
-  -- trace "Branch Generalised Identity Law" $
-  optimizeCombNode (trans H.ValueCode{..} :<$> b)
-  where
-  value = either (H.value l) (H.value r)
-  code = [|| either $$(H.code l) $$(H.code r) ||]
-optimizeCombNode (Branch (x :*> y) p q) =
-  -- trace "Interchange Law" $
-  optimizeCombNode (x :*> optimizeCombNode (Branch y p q))
-optimizeCombNode (Branch b l Empty) =
-  -- trace "Negated Branch Law" $
-  Branch (Pure (trans (H.ValueCode{..})) :<*> b) Empty l
-  where
-  value = either Right Left
-  code = [||either Right Left||]
-optimizeCombNode (Branch (Branch b Empty (Pure (trans -> lr))) Empty br) =
-  -- trace "Branch Fusion Law" $
-  optimizeCombNode (Branch (optimizeCombNode (Pure (trans H.ValueCode{..}) :<*> b)) Empty br)
-  where
-  value Left{} = Left ()
-  value (Right r) = case H.value lr r of
-                      Left _ -> Left ()
-                      Right rr -> Right rr
-  code = [|| \case Left{} -> Left ()
-                   Right r -> case $$(H.code lr) r of
-                                Left _ -> Left ()
-                                Right rr -> Right rr ||]
-optimizeCombNode (f :<$> Branch b l r) =
-  -- trace "Branch Distributivity Law" $
-  optimizeCombNode (Branch b (optimizeCombNode ((H..) H..@ f :<$> l))
-                             (optimizeCombNode ((H..) H..@ f :<$> r)))
-optimizeCombNode (Match a _ps bs Empty)
-  | Foldable.all (\case { Empty -> True; _ -> False }) bs =
-    -- trace "Match Weakening Law" $
-    optimizeCombNode (a :*> Empty)
-optimizeCombNode (Match (Pure (trans -> a)) ps bs d) =
-  -- trace "Match Pure Law" $
-  Foldable.foldr (\(trans -> p, b) next ->
-    if H.value p (H.value a) then b else next
-  ) d (List.zip ps bs)
-optimizeCombNode (f :<$> Match a ps bs d) =
-  -- trace "Match Distributivity Law" $
-  Match a ps (optimizeCombNode . (f :<$>) Functor.<$> bs)
-            (optimizeCombNode (f :<$> d))
+  negLook (OptC Pure{}) = empty
+    -- & trace "Pure Negative-Look"
+  negLook (OptC Empty) = pure H.unit
+    -- & trace "Dead Negative-Look"
+  negLook (OptC (NegLook x)) =
+    look (try (OptComb x) *> pure H.unit)
+    -- & trace "Double Negation Law"
+  negLook (OptC (Try x)) = negLook (OptComb x)
+    -- & trace "Zero Consumption Law"
+  negLook (OptC (Look x)) = negLook (OptComb x)
+    -- & trace "Right Identity Law"
+  negLook (OptC (Comb (Try p) :<|>: q)) =
+    negLook (OptComb p) *> negLook (OptComb q)
+    -- & trace "Transparency Law"
+  negLook (OptC (p :$>: _)) = negLook (OptComb p)
+    -- & trace "NegLook Idempotence Law"
+  negLook (OptComb x) = OptComb (negLook x)
 
-optimizeCombNode x = x
+  eof = OptComb eof
+instance
+  ( Applicable repr
+  , Alternable repr
+  , Lookable repr
+  , Selectable repr
+  , Matchable repr
+  ) => Selectable (OptComb letName repr) where
+  branch (OptC Empty) _ _ = empty
+    -- & trace "Branch Absorption Law"
+  branch b (OptC Empty) (OptC Empty) = b *> empty
+    -- & trace "Branch Weakening Law"
+  branch (OptC (Pure (trans -> lr))) l r =
+    case H.value lr of
+      Left value -> l <*> pure (trans H.ValueCode{..})
+        where code = [|| case $$(H.code lr) of Left x -> x ||]
+      Right value -> r <*> pure (trans H.ValueCode{..})
+        where code = [|| case $$(H.code lr) of Right x -> x ||]
+    -- & trace "Branch Pure Left/Right Law" $
+  branch b (OptC (Pure (trans -> l))) (OptC (Pure (trans -> r))) =
+    trans H.ValueCode{..} <$> b
+    -- & trace "Branch Generalised Identity Law"
+    where
+    value = either (H.value l) (H.value r)
+    code = [|| either $$(H.code l) $$(H.code r) ||]
+  branch (OptC (x :*>: y)) p q =
+    OptComb x *> branch (OptComb y) p q
+    -- & trace "Interchange Law"
+  branch b l (OptC Empty) =
+    branch (pure (trans (H.ValueCode{..})) <*> b) empty l
+    -- & trace "Negated Branch Law"
+    where
+    value = either Right Left
+    code = [||either Right Left||]
+  branch (OptC (Branch b (Comb Empty) (Comb (Pure (trans -> lr))))) (OptC Empty) br =
+    branch (pure (trans H.ValueCode{..}) <*> OptComb b) empty br
+    -- & trace "Branch Fusion Law"
+    where
+    value Left{} = Left ()
+    value (Right r) = case H.value lr r of
+                        Left _ -> Left ()
+                        Right rr -> Right rr
+    code = [|| \case Left{} -> Left ()
+                     Right r -> case $$(H.code lr) r of
+                                  Left _ -> Left ()
+                                  Right rr -> Right rr ||]
+  branch (OptComb b) (OptComb l) (OptComb r) =
+    OptComb (branch b l r)
+instance
+  ( Applicable repr
+  , Alternable repr
+  , Lookable repr
+  , Selectable repr
+  , Matchable repr
+  ) => Matchable (OptComb letName repr) where
+  conditional (OptC Empty) _ _ d = d
+    -- & trace "Conditional Absorption Law"
+  conditional p _ qs (OptC Empty)
+    | Foldable.all (\case { OptC Empty -> True; _ -> False }) qs = p *> empty
+      -- & trace "Conditional Weakening Law"
+  conditional a _ps bs (OptC Empty)
+    | Foldable.all (\case { OptC Empty -> True; _ -> False }) bs = a *> empty
+      -- & trace "Conditional Weakening Law"
+  conditional (OptC (Pure (trans -> a))) ps bs d =
+    Foldable.foldr (\(trans -> p, b) next ->
+      if H.value p (H.value a) then b else next
+    ) d (List.zip ps bs)
+    -- & trace "Conditional Pure Law"
+  conditional (OptComb a) ps bs (OptComb d) =
+    OptComb (conditional a ps (unOptComb Functor.<$> bs) d)
+instance
+  (Letable letName repr, Typeable letName) =>
+  Letable letName (OptComb letName repr) where
+  def n (OptComb x) = OptComb (def n x)
+  ref isRec n = OptComb (ref isRec n)
+instance
+  Foldable repr =>
+  Foldable (OptComb letName repr) where
+  chainPre (OptComb f) (OptComb x) = OptComb (chainPre f x)
+  chainPost (OptComb x) (OptComb f) = OptComb (chainPost x f)
+instance
+  (Satisfiable tok repr, Typeable tok) =>
+  Satisfiable tok (OptComb letName repr) where
+  satisfy es p = OptComb (satisfy es p)
index 5fcca0456c22e326aa7ea371b16e8e0c130fdd7c..aca4fb42eb98a8246d225847c9faf6dfc10df991 100644 (file)
@@ -50,7 +50,7 @@ instance Alternable ViewGrammar where
   empty = ViewGrammar $ Tree.Node "empty" []
   x <|> y = ViewGrammar $ Tree.Node "<|>" [unViewGrammar x, unViewGrammar y]
   try x = ViewGrammar $ Tree.Node "try" [unViewGrammar x]
-instance Satisfiable ViewGrammar tok where
+instance Satisfiable tok ViewGrammar where
   satisfy _es _p = ViewGrammar $ Tree.Node "satisfy" []
 instance Selectable ViewGrammar where
   branch lr l r = ViewGrammar $ Tree.Node "branch"
index e0c1d7338b5a70721bc6a46607498e6b6c3c2dd6..aab3e8fc285cc0ca71a7717a871a7fc378602acc 100644 (file)
@@ -103,7 +103,7 @@ instance Alternable WriteComb where
      , writeCombInh_pair = pairParen
      }
     where op = infixB SideL 3
-instance Satisfiable WriteComb tok where
+instance Satisfiable tok WriteComb where
   satisfy _es _f = "satisfy"
 instance Selectable WriteComb where
   branch lr l r = WriteComb $ \inh ->
index b0bc9d5c256e1b8221b690e517f095f289f1faae..b4d592ae7071b63fc2fba32742246564fb7c5ed7 100644 (file)
@@ -24,15 +24,15 @@ type Parser inp = ParserRepr Gen inp
 type ParserRepr repr inp =
   ObserveSharing TH.Name
                  (OptimizeGrammar TH.Name
-                               (Machine repr inp))
+                                  (Machine repr inp))
 
 -- | Build a 'Machine' able to 'generate' the given 'Parser'.
 machine :: forall inp repr a.
   Ord (InputToken inp) =>
   Show (InputToken inp) =>
   TH.Lift (InputToken inp) =>
+  Grammar (InputToken inp) (Machine repr inp) =>
   Executable (InputToken inp) repr =>
-  Grammar (Machine repr inp) =>
   ParserRepr repr inp a ->
   repr inp '[] ('Succ 'Zero) a
 machine = runMachine . optimizeGrammar . observeSharing
index 7b4afeec6295bae353a64c816d4233fa9645a62a..ea1737bdce290f7f707bdbdcd45ff848f772252a 100644 (file)
@@ -1,5 +1,7 @@
 {-# LANGUAGE ConstraintKinds #-} -- For Executable
 {-# LANGUAGE DerivingStrategies #-} -- For Show (LetName a)
+{-# LANGUAGE PatternSynonyms #-} -- For Instr
+{-# LANGUAGE ViewPatterns #-} -- For unSomeInstr
 module Symantic.Parser.Machine.Instructions where
 
 import Data.Bool (Bool(..))
@@ -46,21 +48,17 @@ data family Instr
   (repr :: ReprInstr)
   :: ReprInstr
 
--- | @(isInstr @instr i)@ returns a proof
--- that @(i)@ is within the extension @(instr)@
--- of the 'Instr' data-type, or 'Nothing' if it is not.
-isInstr ::
-  forall (instr0 :: ReprInstr -> Constraint) instr1 repr inp vs es a.
-  Typeable instr0 =>
-  Typeable instr1 =>
-  Instr instr1 repr inp vs es a -> Maybe (instr0:~~:instr1)
-isInstr _i = eqTypeRep (typeRep @instr0) (typeRep @instr1)
+-- | Convenient utility to pattern-match a 'SomeInstr'.
+pattern Instr :: Typeable comb =>
+  Instr comb repr inp vs es a ->
+  SomeInstr repr inp vs es a
+pattern Instr x <- (unSomeInstr -> Just x)
 
 -- ** Type 'ReprInstr'
 type ReprInstr = Type -> [Type] -> Peano -> Type -> Type
 
 -- ** Type 'SomeInstr'
--- | Some 'Instr'uction existentialized over the actual instruction data-type.
+-- | Some 'Instr'uction existantialized over the actual instruction symantic class.
 -- Useful to handle a list of 'Instr'uctions
 -- without requiring impredicative quantification.
 -- Must be used by pattern-matching
@@ -74,6 +72,19 @@ data SomeInstr repr inp vs es a =
 instance Trans (SomeInstr repr inp vs es) (repr inp vs es) where
   trans (SomeInstr x) = trans x
 
+-- | @(unSomeInstr i :: 'Maybe' ('Instr' comb repr inp vs es a))@
+-- extract the data-constructor from the given 'SomeInstr'
+-- iif. it belongs to the @('Instr' comb repr a)@ data-instance.
+unSomeInstr ::
+  forall instr repr inp vs es a.
+  Typeable instr =>
+  SomeInstr repr inp vs es a ->
+  Maybe (Instr instr repr inp vs es a)
+unSomeInstr (SomeInstr (i::Instr i repr inp vs es a)) =
+  case typeRep @instr `eqTypeRep` typeRep @i of
+    Just HRefl -> Just i
+    Nothing -> Nothing
+
 -- ** Type 'LetName'
 newtype LetName a = LetName { unLetName :: TH.Name }
   deriving (Eq)
index e47594d2fcdf4ac276ad433b49515c375848b209..898857019db2856726c62913cc4a2e3277f50bf8 100644 (file)
@@ -16,8 +16,8 @@ newtype ViewMachine inp (vs:: [Type]) (es::Peano) a
   =     ViewMachine { unViewMachine ::
   Tree.Forest String -> Tree.Forest String }
 
-viewInstr :: ViewMachine inp vs es a -> ViewMachine inp vs es a
-viewInstr = id
+viewMachine :: ViewMachine inp vs es a -> ViewMachine inp vs es a
+viewMachine = id
 
 -- | Helper to view a command.
 viewInstrCmd :: String -> Tree.Forest String -> Tree.Tree String
index 65bf1b2eeaa7aaf97ff8c7f21e835d354618b7d2..f1ac47ca90dac671ca6961129cc8d6eabf9e0625 100644 (file)
@@ -55,8 +55,7 @@ goldensGrammar = testGroup "Grammar"
         P.viewGrammar $ P.optimizeGrammar $ P.observeSharing repr
   ]
   where
-  tests :: P.Grammar repr =>
-           P.Satisfiable repr Char =>
+  tests :: P.Grammar Char repr =>
            (forall a. String -> repr a -> TestTree) -> [TestTree]
   tests test =
     [ test "unit" $ P.unit
@@ -79,7 +78,7 @@ goldensMachine = testGroup "Machine"
     goldenVsStringDiff file diffGolden file $ do
       resetTHNameCounter
       return $ fromString $ show $
-        P.viewInstr $ {-P.machine @() $ -}repr
+        P.viewMachine repr
   ]
   where
   tests ::
index b84160c627bacb574ee789678d6190149c6cddbd..031140102bd872db98b73cc6cf6ae517e3aa67a2 100644 (file)
@@ -5,32 +5,32 @@
 | | | + <*>
 | | | | + <*>
 | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (u4 u5) u6))))))
-| | | | | ` def name_6
+| | | | | ` def name_7
 | | | | |   ` pure (\u1 -> (\u2 -> u2))
-| | | | ` def name_3
+| | | | ` def name_4
 | | | |   ` <*>
 | | | |     + <*>
-| | | |     | + def name_2
+| | | |     | + def name_3
 | | | |     | | ` pure (\u1 -> (\u2 -> u2))
-| | | |     | ` def name_1
+| | | |     | ` def name_2
 | | | |     |   ` <*>
 | | | |     |     + <*>
 | | | |     |     | + pure (\u1 -> (\u2 -> u2))
-| | | |     |     | ` rec name_3
-| | | |     |     ` rec name_1
-| | | |     ` rec name_3
-| | | ` def name_7
+| | | |     |     | ` rec name_4
+| | | |     |     ` rec name_2
+| | | |     ` rec name_4
+| | | ` def name_1
 | | |   ` pure Term
-| | ` ref name_6
-| ` def name_5
+| | ` ref name_7
+| ` def name_6
 |   ` <*>
 |     + <*>
-|     | + ref name_2
-|     | ` def name_4
+|     | + ref name_3
+|     | ` def name_5
 |     |   ` <*>
 |     |     + <*>
 |     |     | + pure (\u1 -> (\u2 -> u2))
-|     |     | ` rec name_5
-|     |     ` rec name_4
-|     ` rec name_5
-` ref name_7
+|     |     | ` rec name_6
+|     |     ` rec name_5
+|     ` rec name_6
+` ref name_1
index 1a9ed641a9bc22d457a049ab7f946927c0cf63e2..d4589a4db38cd3515d06fb7544ed36affb6845a9 100644 (file)
@@ -3,34 +3,33 @@
 | + <*>
 | | + pure (\u1 -> (\u2 -> u1))
 | | ` pure (\u1 -> u1)
-| ` <*>
-|   + <*>
-|   | + <*>
-|   | | + pure (\u1 -> (\u2 -> u1))
-|   | | ` pure (\u1 -> u1)
-|   | ` <*>
-|   |   + <*>
-|   |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|   |   | ` def name_6
-|   |   |   ` pure Term
-|   |   ` def name_7
-|   |     ` <|>
-|   |       + <*>
-|   |       | + <*>
-|   |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
-|   |       | | ` <*>
-|   |       | |   + def name_2
-|   |       | |   | ` <*>
-|   |       | |   |   + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))
-|   |       | |   |   ` pure (\u1 -> (\u2 -> u1))
-|   |       | |   ` def name_1
-|   |       | |     ` satisfy
-|   |       | ` rec name_7
-|   |       ` pure (\u1 -> u1)
-|   ` ref name_6
-` def name_4
+| ` def name_2
+|   ` <*>
+|     + <*>
+|     | + <*>
+|     | | + pure (\u1 -> (\u2 -> u1))
+|     | | ` pure (\u1 -> u1)
+|     | ` <*>
+|     |   + <*>
+|     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
+|     |   | ` pure Term
+|     |   ` def name_5
+|     |     ` <|>
+|     |       + <*>
+|     |       | + <*>
+|     |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
+|     |       | | ` <*>
+|     |       | |   + <*>
+|     |       | |   | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))
+|     |       | |   | ` pure (\u1 -> (\u2 -> u1))
+|     |       | |   ` def name_1
+|     |       | |     ` satisfy
+|     |       | ` rec name_5
+|     |       ` pure (\u1 -> u1)
+|     ` pure Term
+` def name_3
   ` <*>
-    + def name_5
+    + def name_4
     | ` <|>
     |   + <*>
     |   | + <*>
     |   | |     |   |   |   |   + <*>
     |   | |     |   |   |   |   | + pure (\u1 -> (\u2 -> u1))
     |   | |     |   |   |   |   | ` ref name_1
-    |   | |     |   |   |   |   ` <*>
-    |   | |     |   |   |   |     + <*>
-    |   | |     |   |   |   |     | + <*>
-    |   | |     |   |   |   |     | | + pure (\u1 -> (\u2 -> u1))
-    |   | |     |   |   |   |     | | ` pure (\u1 -> u1)
-    |   | |     |   |   |   |     | ` <*>
-    |   | |     |   |   |   |     |   + <*>
-    |   | |     |   |   |   |     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-    |   | |     |   |   |   |     |   | ` ref name_6
-    |   | |     |   |   |   |     |   ` def name_8
-    |   | |     |   |   |   |     |     ` <|>
-    |   | |     |   |   |   |     |       + <*>
-    |   | |     |   |   |   |     |       | + <*>
-    |   | |     |   |   |   |     |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
-    |   | |     |   |   |   |     |       | | ` <*>
-    |   | |     |   |   |   |     |       | |   + ref name_2
-    |   | |     |   |   |   |     |       | |   ` ref name_1
-    |   | |     |   |   |   |     |       | ` rec name_8
-    |   | |     |   |   |   |     |       ` pure (\u1 -> u1)
-    |   | |     |   |   |   |     ` ref name_6
+    |   | |     |   |   |   |   ` ref name_2
     |   | |     |   |   |   ` <*>
     |   | |     |   |   |     + pure Term
-    |   | |     |   |   |     ` rec name_4
+    |   | |     |   |   |     ` rec name_3
     |   | |     |   |   ` <*>
     |   | |     |   |     + <*>
     |   | |     |   |     | + pure (\u1 -> (\u2 -> u1))
     |   | |     |   |     | ` pure ']'
     |   | |     |   |     ` ref name_1
     |   | |     |   ` empty
-    |   | |     ` <*>
-    |   | |       + <*>
-    |   | |       | + <*>
-    |   | |       | | + pure (\u1 -> (\u2 -> u1))
-    |   | |       | | ` pure (\u1 -> u1)
-    |   | |       | ` <*>
-    |   | |       |   + <*>
-    |   | |       |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-    |   | |       |   | ` ref name_6
-    |   | |       |   ` def name_3
-    |   | |       |     ` <|>
-    |   | |       |       + <*>
-    |   | |       |       | + <*>
-    |   | |       |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
-    |   | |       |       | | ` <*>
-    |   | |       |       | |   + ref name_2
-    |   | |       |       | |   ` ref name_1
-    |   | |       |       | ` rec name_3
-    |   | |       |       ` pure (\u1 -> u1)
-    |   | |       ` ref name_6
-    |   | ` rec name_5
+    |   | |     ` ref name_2
+    |   | ` rec name_4
     |   ` pure (\u1 -> u1)
     ` pure Term
index b5cc0061d1bbafce2e93f21c91fc2bb7fcfa3829..e906a410829ecfb05275b3cb1a48e1e55d97edb4 100644 (file)
@@ -1,87 +1,58 @@
 <*>
 + <*>
-| + <*>
-| | + <*>
-| | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))
-| | | ` def name_3
-| | |   ` pure Term
-| | ` def name_2
-| |   ` <|>
-| |     + <*>
-| |     | + <*>
-| |     | | + <*>
-| |     | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
-| |     | | | ` def name_7
-| |     | | |   ` pure (\u1 -> (\u2 -> u2))
-| |     | | ` satisfy
-| |     | ` rec name_2
-| |     ` pure (\u1 -> u1)
-| ` ref name_3
-` def name_5
+| + pure (\u1 -> (\u2 -> u2))
+| ` def name_1
+|   ` <*>
+|     + pure (\u1 -> Term)
+|     ` def name_2
+|       ` <|>
+|         + <*>
+|         | + <*>
+|         | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))
+|         | | ` satisfy
+|         | ` rec name_2
+|         ` pure (\u1 -> u1)
+` def name_4
   ` <*>
     + pure (\u1 -> u1 Term)
-    ` def name_4
+    ` def name_3
       ` <|>
         + <*>
         | + <*>
         | | + <*>
-        | | | + <*>
-        | | | | + conditional
-        | | | | | + look
-        | | | | | | ` satisfy
-        | | | | | + bs
-        | | | | | | + <*>
-        | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
-        | | | | | | | ` satisfy
-        | | | | | | + <*>
-        | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
-        | | | | | | | ` satisfy
-        | | | | | | + <*>
-        | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
-        | | | | | | | ` satisfy
-        | | | | | | + <*>
-        | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
-        | | | | | | | ` satisfy
-        | | | | | | + <*>
-        | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
-        | | | | | | | ` satisfy
-        | | | | | | + <*>
-        | | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
-        | | | | | | | ` satisfy
-        | | | | | | ` <*>
-        | | | | | |   + <*>
-        | | | | | |   | + <*>
-        | | | | | |   | | + <*>
-        | | | | | |   | | | + <*>
-        | | | | | |   | | | | + <*>
-        | | | | | |   | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> (\u11 -> Term u5 : u10 u11)))))))))))
-        | | | | | |   | | | | | ` satisfy
-        | | | | | |   | | | | ` ref name_3
-        | | | | | |   | | | ` def name_6
-        | | | | | |   | | |   ` <|>
-        | | | | | |   | | |     + <*>
-        | | | | | |   | | |     | + <*>
-        | | | | | |   | | |     | | + <*>
-        | | | | | |   | | |     | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
-        | | | | | |   | | |     | | | ` ref name_7
-        | | | | | |   | | |     | | ` satisfy
-        | | | | | |   | | |     | ` rec name_6
-        | | | | | |   | | |     ` pure (\u1 -> u1)
-        | | | | | |   | | ` ref name_3
-        | | | | | |   | ` rec name_5
-        | | | | | |   ` satisfy
-        | | | | | ` empty
-        | | | | ` ref name_3
-        | | | ` def name_1
-        | | |   ` <|>
-        | | |     + <*>
-        | | |     | + <*>
-        | | |     | | + <*>
-        | | |     | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
-        | | |     | | | ` ref name_7
-        | | |     | | ` satisfy
-        | | |     | ` rec name_1
-        | | |     ` pure (\u1 -> u1)
-        | | ` ref name_3
-        | ` rec name_4
+        | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
+        | | | ` conditional
+        | | |   + look
+        | | |   | ` satisfy
+        | | |   + bs
+        | | |   | + <*>
+        | | |   | | + pure (\u1 -> (\u2 -> cons Term))
+        | | |   | | ` satisfy
+        | | |   | + <*>
+        | | |   | | + pure (\u1 -> (\u2 -> cons Term))
+        | | |   | | ` satisfy
+        | | |   | + <*>
+        | | |   | | + pure (\u1 -> (\u2 -> cons Term))
+        | | |   | | ` satisfy
+        | | |   | + <*>
+        | | |   | | + pure (\u1 -> (\u2 -> cons Term))
+        | | |   | | ` satisfy
+        | | |   | + <*>
+        | | |   | | + pure (\u1 -> (\u2 -> cons Term))
+        | | |   | | ` satisfy
+        | | |   | + <*>
+        | | |   | | + pure (\u1 -> (\u2 -> cons Term))
+        | | |   | | ` satisfy
+        | | |   | ` <*>
+        | | |   |   + <*>
+        | | |   |   | + <*>
+        | | |   |   | | + <*>
+        | | |   |   | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> cons (Term u3))))))
+        | | |   |   | | | ` satisfy
+        | | |   |   | | ` ref name_1
+        | | |   |   | ` rec name_4
+        | | |   |   ` satisfy
+        | | |   ` empty
+        | | ` ref name_1
+        | ` rec name_3
         ` pure (\u1 -> u1)
index 787b5a48fcf0d9056688754c8274e544b4f97b10..72ea8c7597429a99fcf37d26e126f05810dc3175 100644 (file)
@@ -6,7 +6,7 @@
 |   | + <*>
 |   | | + pure (\u1 -> (\u2 -> u1))
 |   | | ` pure (\u1 -> u1)
-|   | ` def name_4
+|   | ` def name_11
 |   |   ` <*>
 |   |     + <*>
 |   |     | + <*>
@@ -15,9 +15,9 @@
 |   |     | ` <*>
 |   |     |   + <*>
 |   |     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|   |     |   | ` def name_21
+|   |     |   | ` def name_27
 |   |     |   |   ` pure Term
-|   |     |   ` def name_22
+|   |     |   ` def name_28
 |   |     |     ` <|>
 |   |     |       + <*>
 |   |     |       | + <*>
 |   |     |       | |     | | + <*>
 |   |     |       | |     | | | + pure (\u1 -> (\u2 -> u1))
 |   |     |       | |     | | | ` pure (\u1 -> u1)
-|   |     |       | |     | | ` def name_17
+|   |     |       | |     | | ` def name_26
 |   |     |       | |     | |   ` <*>
 |   |     |       | |     | |     + <*>
 |   |     |       | |     | |     | + <*>
 |   |     |       | |     | |     | | + pure (\u1 -> (\u2 -> u1))
 |   |     |       | |     | |     | | ` pure (\u1 -> u1)
-|   |     |       | |     | |     | ` def name_5
+|   |     |       | |     | |     | ` def name_2
 |   |     |       | |     | |     |   ` satisfy
-|   |     |       | |     | |     ` ref name_21
+|   |     |       | |     | |     ` ref name_27
 |   |     |       | |     | ` <*>
 |   |     |       | |     |   + <*>
 |   |     |       | |     |   | + <*>
@@ -50,7 +50,7 @@
 |   |     |       | |     |   |   + <*>
 |   |     |       | |     |   |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
 |   |     |       | |     |   |   | ` pure Term
-|   |     |       | |     |   |   ` def name_14
+|   |     |       | |     |   |   ` def name_20
 |   |     |       | |     |   |     ` <|>
 |   |     |       | |     |   |       + <*>
 |   |     |       | |     |   |       | + <*>
@@ -59,8 +59,8 @@
 |   |     |       | |     |   |       | |   + <*>
 |   |     |       | |     |   |       | |   | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))
 |   |     |       | |     |   |       | |   | ` pure (\u1 -> (\u2 -> u1))
-|   |     |       | |     |   |       | |   ` ref name_17
-|   |     |       | |     |   |       | ` rec name_14
+|   |     |       | |     |   |       | |   ` ref name_26
+|   |     |       | |     |   |       | ` rec name_20
 |   |     |       | |     |   |       ` pure (\u1 -> u1)
 |   |     |       | |     |   ` pure Term
 |   |     |       | |     ` <*>
@@ -81,7 +81,7 @@
 |   |     |       | |       |   |     |   + <*>
 |   |     |       | |       |   |     |   | + pure (\u1 -> (\u2 -> u1))
 |   |     |       | |       |   |     |   | ` pure '/'
-|   |     |       | |       |   |     |   ` ref name_5
+|   |     |       | |       |   |     |   ` ref name_2
 |   |     |       | |       |   |     ` <*>
 |   |     |       | |       |   |       + <*>
 |   |     |       | |       |   |       | + pure cons
@@ -89,7 +89,7 @@
 |   |     |       | |       |   |       |   + <*>
 |   |     |       | |       |   |       |   | + pure (\u1 -> (\u2 -> u1))
 |   |     |       | |       |   |       |   | ` pure '/'
-|   |     |       | |       |   |       |   ` ref name_5
+|   |     |       | |       |   |       |   ` ref name_2
 |   |     |       | |       |   |       ` pure Term
 |   |     |       | |       |   ` <*>
 |   |     |       | |       |     + <*>
@@ -99,8 +99,8 @@
 |   |     |       | |       |     | ` <*>
 |   |     |       | |       |     |   + <*>
 |   |     |       | |       |     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|   |     |       | |       |     |   | ` ref name_21
-|   |     |       | |       |     |   ` def name_7
+|   |     |       | |       |     |   | ` ref name_27
+|   |     |       | |       |     |   ` def name_12
 |   |     |       | |       |     |     ` <|>
 |   |     |       | |       |     |       + <*>
 |   |     |       | |       |     |       | + <*>
 |   |     |       | |       |     |       | |   + <*>
 |   |     |       | |       |     |       | |   | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))
 |   |     |       | |       |     |       | |   | ` pure (\u1 -> (\u2 -> u1))
-|   |     |       | |       |     |       | |   ` ref name_5
-|   |     |       | |       |     |       | ` rec name_7
+|   |     |       | |       |     |       | |   ` ref name_2
+|   |     |       | |       |     |       | ` rec name_12
 |   |     |       | |       |     |       ` pure (\u1 -> u1)
-|   |     |       | |       |     ` ref name_21
-|   |     |       | |       ` ref name_21
-|   |     |       | ` rec name_22
+|   |     |       | |       |     ` ref name_27
+|   |     |       | |       ` ref name_27
+|   |     |       | ` rec name_28
 |   |     |       ` pure (\u1 -> u1)
-|   |     ` ref name_21
+|   |     ` ref name_27
 |   ` <*>
 |     + <*>
 |     | + <*>
 |     | ` <*>
 |     |   + <*>
 |     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |   | ` ref name_21
-|     |   ` def name_10
+|     |   | ` ref name_27
+|     |   ` def name_15
 |     |     ` <|>
 |     |       + <*>
 |     |       | + <*>
 |     |       | |     |   |   |   |     |     |   + <*>
 |     |       | |     |   |   |   |     |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |     |   | ` pure 'f'
-|     |       | |     |   |   |   |     |     |   ` ref name_5
+|     |       | |     |   |   |   |     |     |   ` ref name_2
 |     |       | |     |   |   |   |     |     ` <*>
 |     |       | |     |   |   |   |     |       + <*>
 |     |       | |     |   |   |   |     |       | + pure cons
 |     |       | |     |   |   |   |     |       |   + <*>
 |     |       | |     |   |   |   |     |       |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |       |   | ` pure 'u'
-|     |       | |     |   |   |   |     |       |   ` ref name_5
+|     |       | |     |   |   |   |     |       |   ` ref name_2
 |     |       | |     |   |   |   |     |       ` <*>
 |     |       | |     |   |   |   |     |         + <*>
 |     |       | |     |   |   |   |     |         | + pure cons
 |     |       | |     |   |   |   |     |         |   + <*>
 |     |       | |     |   |   |   |     |         |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |         |   | ` pure 'n'
-|     |       | |     |   |   |   |     |         |   ` ref name_5
+|     |       | |     |   |   |   |     |         |   ` ref name_2
 |     |       | |     |   |   |   |     |         ` <*>
 |     |       | |     |   |   |   |     |           + <*>
 |     |       | |     |   |   |   |     |           | + pure cons
 |     |       | |     |   |   |   |     |           |   + <*>
 |     |       | |     |   |   |   |     |           |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |           |   | ` pure 'c'
-|     |       | |     |   |   |   |     |           |   ` ref name_5
+|     |       | |     |   |   |   |     |           |   ` ref name_2
 |     |       | |     |   |   |   |     |           ` <*>
 |     |       | |     |   |   |   |     |             + <*>
 |     |       | |     |   |   |   |     |             | + pure cons
 |     |       | |     |   |   |   |     |             |   + <*>
 |     |       | |     |   |   |   |     |             |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |             |   | ` pure 't'
-|     |       | |     |   |   |   |     |             |   ` ref name_5
+|     |       | |     |   |   |   |     |             |   ` ref name_2
 |     |       | |     |   |   |   |     |             ` <*>
 |     |       | |     |   |   |   |     |               + <*>
 |     |       | |     |   |   |   |     |               | + pure cons
 |     |       | |     |   |   |   |     |               |   + <*>
 |     |       | |     |   |   |   |     |               |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |               |   | ` pure 'i'
-|     |       | |     |   |   |   |     |               |   ` ref name_5
+|     |       | |     |   |   |   |     |               |   ` ref name_2
 |     |       | |     |   |   |   |     |               ` <*>
 |     |       | |     |   |   |   |     |                 + <*>
 |     |       | |     |   |   |   |     |                 | + pure cons
 |     |       | |     |   |   |   |     |                 |   + <*>
 |     |       | |     |   |   |   |     |                 |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |                 |   | ` pure 'o'
-|     |       | |     |   |   |   |     |                 |   ` ref name_5
+|     |       | |     |   |   |   |     |                 |   ` ref name_2
 |     |       | |     |   |   |   |     |                 ` <*>
 |     |       | |     |   |   |   |     |                   + <*>
 |     |       | |     |   |   |   |     |                   | + pure cons
 |     |       | |     |   |   |   |     |                   |   + <*>
 |     |       | |     |   |   |   |     |                   |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |   |   |     |                   |   | ` pure 'n'
-|     |       | |     |   |   |   |     |                   |   ` ref name_5
-|     |       | |     |   |   |   |     |                   ` def name_28
+|     |       | |     |   |   |   |     |                   |   ` ref name_2
+|     |       | |     |   |   |   |     |                   ` def name_5
 |     |       | |     |   |   |   |     |                     ` pure Term
-|     |       | |     |   |   |   |     ` def name_30
+|     |       | |     |   |   |   |     ` def name_7
 |     |       | |     |   |   |   |       ` negLook
-|     |       | |     |   |   |   |         ` ref name_5
-|     |       | |     |   |   |   ` ref name_4
-|     |       | |     |   |   ` def name_2
+|     |       | |     |   |   |   |         ` ref name_2
+|     |       | |     |   |   |   ` ref name_11
+|     |       | |     |   |   ` def name_9
 |     |       | |     |   |     ` <*>
 |     |       | |     |   |       + <*>
 |     |       | |     |   |       | + <*>
 |     |       | |     |   |       |     | + <*>
 |     |       | |     |   |       |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |   |       |     | | ` pure (\u1 -> u1)
-|     |       | |     |   |       |     | ` ref name_5
+|     |       | |     |   |       |     | ` ref name_2
 |     |       | |     |   |       |     ` <*>
 |     |       | |     |   |       |       + <*>
 |     |       | |     |   |       |       | + <*>
 |     |       | |     |   |       |       | ` <*>
 |     |       | |     |   |       |       |   + <*>
 |     |       | |     |   |       |       |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |       | |     |   |       |       |   | ` ref name_21
-|     |       | |     |   |       |       |   ` def name_11
+|     |       | |     |   |       |       |   | ` ref name_27
+|     |       | |     |   |       |       |   ` def name_16
 |     |       | |     |   |       |       |     ` <|>
 |     |       | |     |   |       |       |       + <*>
 |     |       | |     |   |       |       |       | + <*>
 |     |       | |     |   |       |       |       | |   + <*>
 |     |       | |     |   |       |       |       | |   | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))
 |     |       | |     |   |       |       |       | |   | ` pure (\u1 -> (\u2 -> u1))
-|     |       | |     |   |       |       |       | |   ` ref name_5
-|     |       | |     |   |       |       |       | ` rec name_11
+|     |       | |     |   |       |       |       | |   ` ref name_2
+|     |       | |     |   |       |       |       | ` rec name_16
 |     |       | |     |   |       |       |       ` pure (\u1 -> u1)
-|     |       | |     |   |       |       ` ref name_21
-|     |       | |     |   |       ` ref name_4
+|     |       | |     |   |       |       ` ref name_27
+|     |       | |     |   |       ` ref name_11
 |     |       | |     |   ` <*>
 |     |       | |     |     + <*>
 |     |       | |     |     | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |   | + <*>
 |     |       | |     |     |   | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |   | | ` pure (\u1 -> u1)
-|     |       | |     |     |   | ` def name_12
+|     |       | |     |     |   | ` def name_18
 |     |       | |     |     |   |   ` <*>
 |     |       | |     |     |   |     + <*>
 |     |       | |     |     |   |     | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |   |     |   + <*>
 |     |       | |     |     |   |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |   |     |   | ` pure '('
-|     |       | |     |     |   |     |   ` ref name_5
-|     |       | |     |     |   |     ` ref name_4
+|     |       | |     |     |   |     |   ` ref name_2
+|     |       | |     |     |   |     ` ref name_11
 |     |       | |     |     |   ` <*>
 |     |       | |     |     |     + <*>
 |     |       | |     |     |     | + <*>
 |     |       | |     |     |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     | | ` pure (\u1 -> u1)
-|     |       | |     |     |     | ` def name_3
+|     |       | |     |     |     | ` def name_10
 |     |       | |     |     |     |   ` <|>
 |     |       | |     |     |     |     + <*>
 |     |       | |     |     |     |     | + <*>
 |     |       | |     |     |     |     |   | + <*>
 |     |       | |     |     |     |     |   | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |   | | ` pure (\u1 -> u1)
-|     |       | |     |     |     |     |   | ` def name_24
+|     |       | |     |     |     |     |   | ` def name_30
 |     |       | |     |     |     |     |   |   ` <*>
 |     |       | |     |     |     |     |   |     + <*>
 |     |       | |     |     |     |     |   |     | + <*>
 |     |       | |     |     |     |     |   |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |   |     | | ` pure (\u1 -> u1)
-|     |       | |     |     |     |     |   |     | ` ref name_2
+|     |       | |     |     |     |     |   |     | ` ref name_9
 |     |       | |     |     |     |     |   |     ` <|>
 |     |       | |     |     |     |     |   |       + <*>
 |     |       | |     |     |     |     |   |       | + <*>
 |     |       | |     |     |     |     |   |       | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |   |       | | ` pure Term
-|     |       | |     |     |     |     |   |       | ` def name_13
+|     |       | |     |     |     |     |   |       | ` def name_19
 |     |       | |     |     |     |     |   |       |   ` <*>
 |     |       | |     |     |     |     |   |       |     + <*>
 |     |       | |     |     |     |     |   |       |     | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |   |       |     |   |   |   + <*>
 |     |       | |     |     |     |     |   |       |     |   |   |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |   |       |     |   |   |   | ` pure '['
-|     |       | |     |     |     |     |   |       |     |   |   |   ` ref name_5
-|     |       | |     |     |     |     |   |       |     |   |   ` ref name_4
+|     |       | |     |     |     |     |   |       |     |   |   |   ` ref name_2
+|     |       | |     |     |     |     |   |       |     |   |   ` ref name_11
 |     |       | |     |     |     |     |   |       |     |   ` <*>
 |     |       | |     |     |     |     |   |       |     |     + <*>
 |     |       | |     |     |     |     |   |       |     |     | + <*>
 |     |       | |     |     |     |     |   |       |     |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |   |       |     |     | | ` pure (\u1 -> u1)
-|     |       | |     |     |     |     |   |       |     |     | ` ref name_5
+|     |       | |     |     |     |     |   |       |     |     | ` ref name_2
 |     |       | |     |     |     |     |   |       |     |     ` <*>
 |     |       | |     |     |     |     |   |       |     |       + <*>
 |     |       | |     |     |     |     |   |       |     |       | + <*>
 |     |       | |     |     |     |     |   |       |     |       |   + <*>
 |     |       | |     |     |     |     |   |       |     |       |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
 |     |       | |     |     |     |     |   |       |     |       |   | ` pure Term
-|     |       | |     |     |     |     |   |       |     |       |   ` def name_6
+|     |       | |     |     |     |     |   |       |     |       |   ` def name_13
 |     |       | |     |     |     |     |   |       |     |       |     ` <|>
 |     |       | |     |     |     |     |   |       |     |       |       + <*>
 |     |       | |     |     |     |     |   |       |     |       |       | + <*>
 |     |       | |     |     |     |     |   |       |     |       |       | |   + <*>
 |     |       | |     |     |     |     |   |       |     |       |       | |   | + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))
 |     |       | |     |     |     |     |   |       |     |       |       | |   | ` pure (\u1 -> (\u2 -> u1))
-|     |       | |     |     |     |     |   |       |     |       |       | |   ` ref name_5
-|     |       | |     |     |     |     |   |       |     |       |       | ` rec name_6
+|     |       | |     |     |     |     |   |       |     |       |       | |   ` ref name_2
+|     |       | |     |     |     |     |   |       |     |       |       | ` rec name_13
 |     |       | |     |     |     |     |   |       |     |       |       ` pure (\u1 -> u1)
 |     |       | |     |     |     |     |   |       |     |       ` pure Term
 |     |       | |     |     |     |     |   |       |     ` <*>
 |     |       | |     |     |     |     |   |       |       |   + <*>
 |     |       | |     |     |     |     |   |       |       |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |   |       |       |   | ` pure ']'
-|     |       | |     |     |     |     |   |       |       |   ` ref name_5
-|     |       | |     |     |     |     |   |       |       ` ref name_4
-|     |       | |     |     |     |     |   |       ` ref name_21
+|     |       | |     |     |     |     |   |       |       |   ` ref name_2
+|     |       | |     |     |     |     |   |       |       ` ref name_11
+|     |       | |     |     |     |     |   |       ` ref name_27
 |     |       | |     |     |     |     |   ` <*>
 |     |       | |     |     |     |     |     + <*>
 |     |       | |     |     |     |     |     | + <*>
 |     |       | |     |     |     |     |     | ` <*>
 |     |       | |     |     |     |     |     |   + <*>
 |     |       | |     |     |     |     |     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |       | |     |     |     |     |     |   | ` ref name_21
-|     |       | |     |     |     |     |     |   ` def name_23
+|     |       | |     |     |     |     |     |   | ` ref name_27
+|     |       | |     |     |     |     |     |   ` def name_29
 |     |       | |     |     |     |     |     |     ` <|>
 |     |       | |     |     |     |     |     |       + <*>
 |     |       | |     |     |     |     |     |       | + <*>
 |     |       | |     |     |     |     |     |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
 |     |       | |     |     |     |     |     |       | | ` <*>
-|     |       | |     |     |     |     |     |       | |   + def name_29
+|     |       | |     |     |     |     |     |       | |   + def name_6
 |     |       | |     |     |     |     |     |       | |   | ` <*>
 |     |       | |     |     |     |     |     |       | |   |   + pure (\u1 -> (\u2 -> (\u3 -> (u1 u3) u2)))
 |     |       | |     |     |     |     |     |       | |   |   ` pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |     |       | |     | + <*>
 |     |       | |     |     |     |     |     |       | |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |     |       | |     | | ` pure (\u1 -> u1)
-|     |       | |     |     |     |     |     |       | |     | ` def name_18
+|     |       | |     |     |     |     |     |       | |     | ` def name_23
 |     |       | |     |     |     |     |     |       | |     |   ` <*>
 |     |       | |     |     |     |     |     |       | |     |     + <*>
 |     |       | |     |     |     |     |     |       | |     |     | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |     |       | |     |     |   + <*>
 |     |       | |     |     |     |     |     |       | |     |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |     |     |     |       | |     |     |   | ` pure ','
-|     |       | |     |     |     |     |     |       | |     |     |   ` ref name_5
-|     |       | |     |     |     |     |     |       | |     |     ` ref name_4
-|     |       | |     |     |     |     |     |       | |     ` ref name_24
-|     |       | |     |     |     |     |     |       | ` rec name_23
+|     |       | |     |     |     |     |     |       | |     |     |   ` ref name_2
+|     |       | |     |     |     |     |     |       | |     |     ` ref name_11
+|     |       | |     |     |     |     |     |       | |     ` ref name_30
+|     |       | |     |     |     |     |     |       | ` rec name_29
 |     |       | |     |     |     |     |     |       ` pure (\u1 -> u1)
-|     |       | |     |     |     |     |     ` ref name_21
-|     |       | |     |     |     |     ` ref name_21
+|     |       | |     |     |     |     |     ` ref name_27
+|     |       | |     |     |     |     ` ref name_27
 |     |       | |     |     |     ` <|>
 |     |       | |     |     |       + <*>
 |     |       | |     |     |       | + <*>
 |     |       | |     |     |       |   |   |   + <*>
 |     |       | |     |     |       |   |   |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |     |       |   |   |   | ` pure ':'
-|     |       | |     |     |       |   |   |   ` ref name_5
-|     |       | |     |     |       |   |   ` ref name_4
-|     |       | |     |     |       |   ` ref name_3
-|     |       | |     |     |       ` ref name_21
-|     |       | |     |     ` def name_1
+|     |       | |     |     |       |   |   |   ` ref name_2
+|     |       | |     |     |       |   |   ` ref name_11
+|     |       | |     |     |       |   ` ref name_10
+|     |       | |     |     |       ` ref name_27
+|     |       | |     |     ` def name_8
 |     |       | |     |       ` <*>
 |     |       | |     |         + <*>
 |     |       | |     |         | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |         |   + <*>
 |     |       | |     |         |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |     |         |   | ` pure ')'
-|     |       | |     |         |   ` ref name_5
-|     |       | |     |         ` ref name_4
-|     |       | |     ` def name_19
+|     |       | |     |         |   ` ref name_2
+|     |       | |     |         ` ref name_11
+|     |       | |     ` def name_24
 |     |       | |       ` <*>
 |     |       | |         + <*>
 |     |       | |         | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |   |   |   + <*>
 |     |       | |         |   |   |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |   |   |   | ` pure '{'
-|     |       | |         |   |   |   ` ref name_5
-|     |       | |         |   |   ` ref name_4
+|     |       | |         |   |   |   ` ref name_2
+|     |       | |         |   |   ` ref name_11
 |     |       | |         |   ` <*>
 |     |       | |         |     + <*>
 |     |       | |         |     | + <*>
 |     |       | |         |     | ` <*>
 |     |       | |         |     |   + <*>
 |     |       | |         |     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |       | |         |     |   | ` ref name_21
-|     |       | |         |     |   ` def name_27
+|     |       | |         |     |   | ` ref name_27
+|     |       | |         |     |   ` def name_4
 |     |       | |         |     |     ` <|>
 |     |       | |         |     |       + <*>
 |     |       | |         |     |       | + <*>
 |     |       | |         |     |       | |     | | | |   |   |   |     |     |   + <*>
 |     |       | |         |     |       | |     | | | |   |   |   |     |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |   |   |     |     |   | ` pure 'i'
-|     |       | |         |     |       | |     | | | |   |   |   |     |     |   ` ref name_5
+|     |       | |         |     |       | |     | | | |   |   |   |     |     |   ` ref name_2
 |     |       | |         |     |       | |     | | | |   |   |   |     |     ` <*>
 |     |       | |         |     |       | |     | | | |   |   |   |     |       + <*>
 |     |       | |         |     |       | |     | | | |   |   |   |     |       | + pure cons
 |     |       | |         |     |       | |     | | | |   |   |   |     |       |   + <*>
 |     |       | |         |     |       | |     | | | |   |   |   |     |       |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |   |   |     |       |   | ` pure 'f'
-|     |       | |         |     |       | |     | | | |   |   |   |     |       |   ` ref name_5
-|     |       | |         |     |       | |     | | | |   |   |   |     |       ` ref name_28
-|     |       | |         |     |       | |     | | | |   |   |   |     ` ref name_30
-|     |       | |         |     |       | |     | | | |   |   |   ` ref name_4
-|     |       | |         |     |       | |     | | | |   |   ` def name_8
+|     |       | |         |     |       | |     | | | |   |   |   |     |       |   ` ref name_2
+|     |       | |         |     |       | |     | | | |   |   |   |     |       ` ref name_5
+|     |       | |         |     |       | |     | | | |   |   |   |     ` ref name_7
+|     |       | |         |     |       | |     | | | |   |   |   ` ref name_11
+|     |       | |         |     |       | |     | | | |   |   ` def name_14
 |     |       | |         |     |       | |     | | | |   |     ` <*>
 |     |       | |         |     |       | |     | | | |   |       + <*>
 |     |       | |         |     |       | |     | | | |   |       | + <*>
 |     |       | |         |     |       | |     | | | |   |       | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       | ` def name_20
+|     |       | |         |     |       | |     | | | |   |       | ` def name_25
 |     |       | |         |     |       | |     | | | |   |       |   ` <|>
 |     |       | |         |     |       | |     | | | |   |       |     + <|>
 |     |       | |         |     |       | |     | | | |   |       |     | + <*>
 |     |       | |         |     |       | |     | | | |   |       |     | | |   | + <*>
 |     |       | |         |     |       | |     | | | |   |       |     | | |   | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     | | |   | | ` pure '0'
-|     |       | |         |     |       | |     | | | |   |       |     | | |   | ` ref name_5
+|     |       | |         |     |       | |     | | | |   |       |     | | |   | ` ref name_2
 |     |       | |         |     |       | |     | | | |   |       |     | | |   ` <*>
 |     |       | |         |     |       | |     | | | |   |       |     | | |     + <*>
 |     |       | |         |     |       | |     | | | |   |       |     | | |     | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     | | |     | ` pure '1'
-|     |       | |         |     |       | |     | | | |   |       |     | | |     ` ref name_5
-|     |       | |         |     |       | |     | | | |   |       |     | | ` ref name_4
+|     |       | |         |     |       | |     | | | |   |       |     | | |     ` ref name_2
+|     |       | |         |     |       | |     | | | |   |       |     | | ` ref name_11
 |     |       | |         |     |       | |     | | | |   |       |     | ` <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     |   |   |   + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |   |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     |   |   |   | ` pure '\''
-|     |       | |         |     |       | |     | | | |   |       |     |   |   |   ` ref name_5
+|     |       | |         |     |       | |     | | | |   |       |     |   |   |   ` ref name_2
 |     |       | |         |     |       | |     | | | |   |       |     |   |   ` <|>
 |     |       | |         |     |       | |     | | | |   |       |     |   |     + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |     | + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |     | | + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |     | | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     |   |     | | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       |     |   |     | | ` ref name_5
-|     |       | |         |     |       | |     | | | |   |       |     |   |     | ` ref name_21
+|     |       | |         |     |       | |     | | | |   |       |     |   |     | | ` ref name_2
+|     |       | |         |     |       | |     | | | |   |       |     |   |     | ` ref name_27
 |     |       | |         |     |       | |     | | | |   |       |     |   |     ` <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |       + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |       | + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |       |   + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |       |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     |   |       |   | ` pure '\\'
-|     |       | |         |     |       | |     | | | |   |       |     |   |       |   ` ref name_5
+|     |       | |         |     |       | |     | | | |   |       |     |   |       |   ` ref name_2
 |     |       | |         |     |       | |     | | | |   |       |     |   |       ` <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |         + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |         | + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |   |         | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     |   |         | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       |     |   |         | ` ref name_5
-|     |       | |         |     |       | |     | | | |   |       |     |   |         ` ref name_21
+|     |       | |         |     |       | |     | | | |   |       |     |   |         | ` ref name_2
+|     |       | |         |     |       | |     | | | |   |       |     |   |         ` ref name_27
 |     |       | |         |     |       | |     | | | |   |       |     |   ` <*>
 |     |       | |         |     |       | |     | | | |   |       |     |     + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |     | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     |     |   + <*>
 |     |       | |         |     |       | |     | | | |   |       |     |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |     |     |   | ` pure '\''
-|     |       | |         |     |       | |     | | | |   |       |     |     |   ` ref name_5
-|     |       | |         |     |       | |     | | | |   |       |     |     ` ref name_4
+|     |       | |         |     |       | |     | | | |   |       |     |     |   ` ref name_2
+|     |       | |         |     |       | |     | | | |   |       |     |     ` ref name_11
 |     |       | |         |     |       | |     | | | |   |       |     ` <*>
 |     |       | |         |     |       | |     | | | |   |       |       + <*>
 |     |       | |         |     |       | |     | | | |   |       |       | + <*>
 |     |       | |         |     |       | |     | | | |   |       |       | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |       | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       |       | ` ref name_2
+|     |       | |         |     |       | |     | | | |   |       |       | ` ref name_9
 |     |       | |         |     |       | |     | | | |   |       |       ` <|>
 |     |       | |         |     |       | |     | | | |   |       |         + <*>
 |     |       | |         |     |       | |     | | | |   |       |         | + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |   | + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |   | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |         |   | |   | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       |         |   | |   | ` ref name_12
+|     |       | |         |     |       | |     | | | |   |       |         |   | |   | ` ref name_18
 |     |       | |         |     |       | |     | | | |   |       |         |   | |   ` <|>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     | + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |   | + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |   | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |   | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |   | ` rec name_8
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |   | ` rec name_14
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |   ` <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     | + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     | ` <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |   + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |   | ` ref name_21
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |   ` def name_9
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |   | ` ref name_27
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |   ` def name_17
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |     ` <|>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | | ` <*>
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |   + ref name_29
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |   + ref name_6
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |   ` <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     | + <*>
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     | ` ref name_18
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     ` rec name_8
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | ` rec name_9
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     | ` ref name_23
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | |     ` rec name_14
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       | ` rec name_17
 |     |       | |         |     |       | |     | | | |   |       |         |   | |     |     |       ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     ` ref name_21
-|     |       | |         |     |       | |     | | | |   |       |         |   | |     ` ref name_21
-|     |       | |         |     |       | |     | | | |   |       |         |   | ` ref name_1
-|     |       | |         |     |       | |     | | | |   |       |         |   ` ref name_13
-|     |       | |         |     |       | |     | | | |   |       |         ` ref name_21
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     |     ` ref name_27
+|     |       | |         |     |       | |     | | | |   |       |         |   | |     ` ref name_27
+|     |       | |         |     |       | |     | | | |   |       |         |   | ` ref name_8
+|     |       | |         |     |       | |     | | | |   |       |         |   ` ref name_19
+|     |       | |         |     |       | |     | | | |   |       |         ` ref name_27
 |     |       | |         |     |       | |     | | | |   |       ` <*>
 |     |       | |         |     |       | |     | | | |   |         + <*>
 |     |       | |         |     |       | |     | | | |   |         | + <*>
 |     |       | |         |     |       | |     | | | |   |         | ` <*>
 |     |       | |         |     |       | |     | | | |   |         |   + <*>
 |     |       | |         |     |       | |     | | | |   |         |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |       | |         |     |       | |     | | | |   |         |   | ` ref name_21
-|     |       | |         |     |       | |     | | | |   |         |   ` def name_16
+|     |       | |         |     |       | |     | | | |   |         |   | ` ref name_27
+|     |       | |         |     |       | |     | | | |   |         |   ` def name_22
 |     |       | |         |     |       | |     | | | |   |         |     ` <|>
 |     |       | |         |     |       | |     | | | |   |         |       + <*>
 |     |       | |         |     |       | |     | | | |   |         |       | + <*>
 |     |       | |         |     |       | |     | | | |   |         |       | |     |   |   + <*>
 |     |       | |         |     |       | |     | | | |   |         |       | |     |   |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | | |   |         |       | |     |   |   | ` pure '!'
-|     |       | |         |     |       | |     | | | |   |         |       | |     |   |   ` ref name_5
-|     |       | |         |     |       | |     | | | |   |         |       | |     |   ` ref name_4
-|     |       | |         |     |       | |     | | | |   |         |       | |     ` ref name_20
-|     |       | |         |     |       | |     | | | |   |         |       | ` rec name_16
+|     |       | |         |     |       | |     | | | |   |         |       | |     |   |   ` ref name_2
+|     |       | |         |     |       | |     | | | |   |         |       | |     |   ` ref name_11
+|     |       | |         |     |       | |     | | | |   |         |       | |     ` ref name_25
+|     |       | |         |     |       | |     | | | |   |         |       | ` rec name_22
 |     |       | |         |     |       | |     | | | |   |         |       ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     | | | |   |         ` ref name_21
-|     |       | |         |     |       | |     | | | |   ` rec name_19
+|     |       | |         |     |       | |     | | | |   |         ` ref name_27
+|     |       | |         |     |       | |     | | | |   ` rec name_24
 |     |       | |         |     |       | |     | | | ` <|>
 |     |       | |         |     |       | |     | | |   + <*>
 |     |       | |         |     |       | |     | | |   | + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |     |   + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | |   |   |   |     |     |   | ` pure 'e'
-|     |       | |         |     |       | |     | | |   |   |   |     |     |   ` ref name_5
+|     |       | |         |     |       | |     | | |   |   |   |     |     |   ` ref name_2
 |     |       | |         |     |       | |     | | |   |   |   |     |     ` <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |       + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |       | + pure cons
 |     |       | |         |     |       | |     | | |   |   |   |     |       |   + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |       |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | |   |   |   |     |       |   | ` pure 'l'
-|     |       | |         |     |       | |     | | |   |   |   |     |       |   ` ref name_5
+|     |       | |         |     |       | |     | | |   |   |   |     |       |   ` ref name_2
 |     |       | |         |     |       | |     | | |   |   |   |     |       ` <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |         + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |         | + pure cons
 |     |       | |         |     |       | |     | | |   |   |   |     |         |   + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |         |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | |   |   |   |     |         |   | ` pure 's'
-|     |       | |         |     |       | |     | | |   |   |   |     |         |   ` ref name_5
+|     |       | |         |     |       | |     | | |   |   |   |     |         |   ` ref name_2
 |     |       | |         |     |       | |     | | |   |   |   |     |         ` <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |           + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |           | + pure cons
 |     |       | |         |     |       | |     | | |   |   |   |     |           |   + <*>
 |     |       | |         |     |       | |     | | |   |   |   |     |           |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | | |   |   |   |     |           |   | ` pure 'e'
-|     |       | |         |     |       | |     | | |   |   |   |     |           |   ` ref name_5
-|     |       | |         |     |       | |     | | |   |   |   |     |           ` ref name_28
-|     |       | |         |     |       | |     | | |   |   |   |     ` ref name_30
-|     |       | |         |     |       | |     | | |   |   |   ` ref name_4
-|     |       | |         |     |       | |     | | |   |   ` rec name_19
-|     |       | |         |     |       | |     | | |   ` ref name_21
+|     |       | |         |     |       | |     | | |   |   |   |     |           |   ` ref name_2
+|     |       | |         |     |       | |     | | |   |   |   |     |           ` ref name_5
+|     |       | |         |     |       | |     | | |   |   |   |     ` ref name_7
+|     |       | |         |     |       | |     | | |   |   |   ` ref name_11
+|     |       | |         |     |       | |     | | |   |   ` rec name_24
+|     |       | |         |     |       | |     | | |   ` ref name_27
 |     |       | |         |     |       | |     | | ` <*>
 |     |       | |         |     |       | |     | |   + <*>
 |     |       | |         |     |       | |     | |   | + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |     |   + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | |   |   |   |     |     |   | ` pure 'w'
-|     |       | |         |     |       | |     | |   |   |   |     |     |   ` ref name_5
+|     |       | |         |     |       | |     | |   |   |   |     |     |   ` ref name_2
 |     |       | |         |     |       | |     | |   |   |   |     |     ` <*>
 |     |       | |         |     |       | |     | |   |   |   |     |       + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |       | + pure cons
 |     |       | |         |     |       | |     | |   |   |   |     |       |   + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |       |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | |   |   |   |     |       |   | ` pure 'h'
-|     |       | |         |     |       | |     | |   |   |   |     |       |   ` ref name_5
+|     |       | |         |     |       | |     | |   |   |   |     |       |   ` ref name_2
 |     |       | |         |     |       | |     | |   |   |   |     |       ` <*>
 |     |       | |         |     |       | |     | |   |   |   |     |         + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |         | + pure cons
 |     |       | |         |     |       | |     | |   |   |   |     |         |   + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |         |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | |   |   |   |     |         |   | ` pure 'i'
-|     |       | |         |     |       | |     | |   |   |   |     |         |   ` ref name_5
+|     |       | |         |     |       | |     | |   |   |   |     |         |   ` ref name_2
 |     |       | |         |     |       | |     | |   |   |   |     |         ` <*>
 |     |       | |         |     |       | |     | |   |   |   |     |           + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |           | + pure cons
 |     |       | |         |     |       | |     | |   |   |   |     |           |   + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |           |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | |   |   |   |     |           |   | ` pure 'l'
-|     |       | |         |     |       | |     | |   |   |   |     |           |   ` ref name_5
+|     |       | |         |     |       | |     | |   |   |   |     |           |   ` ref name_2
 |     |       | |         |     |       | |     | |   |   |   |     |           ` <*>
 |     |       | |         |     |       | |     | |   |   |   |     |             + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |             | + pure cons
 |     |       | |         |     |       | |     | |   |   |   |     |             |   + <*>
 |     |       | |         |     |       | |     | |   |   |   |     |             |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     | |   |   |   |     |             |   | ` pure 'e'
-|     |       | |         |     |       | |     | |   |   |   |     |             |   ` ref name_5
-|     |       | |         |     |       | |     | |   |   |   |     |             ` ref name_28
-|     |       | |         |     |       | |     | |   |   |   |     ` ref name_30
-|     |       | |         |     |       | |     | |   |   |   ` ref name_4
-|     |       | |         |     |       | |     | |   |   ` ref name_8
-|     |       | |         |     |       | |     | |   ` rec name_19
+|     |       | |         |     |       | |     | |   |   |   |     |             |   ` ref name_2
+|     |       | |         |     |       | |     | |   |   |   |     |             ` ref name_5
+|     |       | |         |     |       | |     | |   |   |   |     ` ref name_7
+|     |       | |         |     |       | |     | |   |   |   ` ref name_11
+|     |       | |         |     |       | |     | |   |   ` ref name_14
+|     |       | |         |     |       | |     | |   ` rec name_24
 |     |       | |         |     |       | |     | ` try
 |     |       | |         |     |       | |     |   ` <*>
 |     |       | |         |     |       | |     |     + <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |     |   + <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |     |   | ` pure 'v'
-|     |       | |         |     |       | |     |     |   |   |   |   |   |     |     |   ` ref name_5
+|     |       | |         |     |       | |     |     |   |   |   |   |   |     |     |   ` ref name_2
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |     ` <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |       + <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |       | + pure cons
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |       |   + <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |       |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |       |   | ` pure 'a'
-|     |       | |         |     |       | |     |     |   |   |   |   |   |     |       |   ` ref name_5
+|     |       | |         |     |       | |     |     |   |   |   |   |   |     |       |   ` ref name_2
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |       ` <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |         + <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |         | + pure cons
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |         |   + <*>
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |         |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |   |   |   |   |   |     |         |   | ` pure 'r'
-|     |       | |         |     |       | |     |     |   |   |   |   |   |     |         |   ` ref name_5
-|     |       | |         |     |       | |     |     |   |   |   |   |   |     |         ` ref name_28
-|     |       | |         |     |       | |     |     |   |   |   |   |   |     ` ref name_30
-|     |       | |         |     |       | |     |     |   |   |   |   |   ` ref name_4
-|     |       | |         |     |       | |     |     |   |   |   |   ` ref name_21
+|     |       | |         |     |       | |     |     |   |   |   |   |   |     |         |   ` ref name_2
+|     |       | |         |     |       | |     |     |   |   |   |   |   |     |         ` ref name_5
+|     |       | |         |     |       | |     |     |   |   |   |   |   |     ` ref name_7
+|     |       | |         |     |       | |     |     |   |   |   |   |   ` ref name_11
+|     |       | |         |     |       | |     |     |   |   |   |   ` ref name_27
 |     |       | |         |     |       | |     |     |   |   |   ` <*>
 |     |       | |         |     |       | |     |     |   |   |     + <*>
 |     |       | |         |     |       | |     |     |   |   |     | + <*>
 |     |       | |         |     |       | |     |     |   |   |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |   |   |     | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     |     |   |   |     | ` ref name_24
+|     |       | |         |     |       | |     |     |   |   |     | ` ref name_30
 |     |       | |         |     |       | |     |     |   |   |     ` <*>
 |     |       | |         |     |       | |     |     |   |   |       + <*>
 |     |       | |         |     |       | |     |     |   |   |       | + <*>
 |     |       | |         |     |       | |     |     |   |   |       | ` <*>
 |     |       | |         |     |       | |     |     |   |   |       |   + <*>
 |     |       | |         |     |       | |     |     |   |   |       |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |       | |         |     |       | |     |     |   |   |       |   | ` ref name_21
-|     |       | |         |     |       | |     |     |   |   |       |   ` def name_26
+|     |       | |         |     |       | |     |     |   |   |       |   | ` ref name_27
+|     |       | |         |     |       | |     |     |   |   |       |   ` def name_3
 |     |       | |         |     |       | |     |     |   |   |       |     ` <|>
 |     |       | |         |     |       | |     |     |   |   |       |       + <*>
 |     |       | |         |     |       | |     |     |   |   |       |       | + <*>
 |     |       | |         |     |       | |     |     |   |   |       |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
 |     |       | |         |     |       | |     |     |   |   |       |       | | ` <*>
-|     |       | |         |     |       | |     |     |   |   |       |       | |   + ref name_29
+|     |       | |         |     |       | |     |     |   |   |       |       | |   + ref name_6
 |     |       | |         |     |       | |     |     |   |   |       |       | |   ` <*>
 |     |       | |         |     |       | |     |     |   |   |       |       | |     + <*>
 |     |       | |         |     |       | |     |     |   |   |       |       | |     | + <*>
 |     |       | |         |     |       | |     |     |   |   |       |       | |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |   |   |       |       | |     | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     |     |   |   |       |       | |     | ` ref name_18
-|     |       | |         |     |       | |     |     |   |   |       |       | |     ` ref name_24
-|     |       | |         |     |       | |     |     |   |   |       |       | ` rec name_26
+|     |       | |         |     |       | |     |     |   |   |       |       | |     | ` ref name_23
+|     |       | |         |     |       | |     |     |   |   |       |       | |     ` ref name_30
+|     |       | |         |     |       | |     |     |   |   |       |       | ` rec name_3
 |     |       | |         |     |       | |     |     |   |   |       |       ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     |     |   |   |       ` ref name_21
+|     |       | |         |     |       | |     |     |   |   |       ` ref name_27
 |     |       | |         |     |       | |     |     |   |   ` <*>
 |     |       | |         |     |       | |     |     |   |     + <*>
 |     |       | |         |     |       | |     |     |   |     | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |   |     |   + <*>
 |     |       | |         |     |       | |     |     |   |     |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |   |     |   | ` pure '='
-|     |       | |         |     |       | |     |     |   |     |   ` ref name_5
-|     |       | |         |     |       | |     |     |   |     ` ref name_4
+|     |       | |         |     |       | |     |     |   |     |   ` ref name_2
+|     |       | |         |     |       | |     |     |   |     ` ref name_11
 |     |       | |         |     |       | |     |     |   ` <*>
 |     |       | |         |     |       | |     |     |     + <*>
 |     |       | |         |     |       | |     |     |     | + <*>
 |     |       | |         |     |       | |     |     |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |     | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     |     |     | ` ref name_8
+|     |       | |         |     |       | |     |     |     | ` ref name_14
 |     |       | |         |     |       | |     |     |     ` <*>
 |     |       | |         |     |       | |     |     |       + <*>
 |     |       | |         |     |       | |     |     |       | + <*>
 |     |       | |         |     |       | |     |     |       | ` <*>
 |     |       | |         |     |       | |     |     |       |   + <*>
 |     |       | |         |     |       | |     |     |       |   | + pure ((\u1 -> (\u2 -> (\u3 -> (u1 u3) u2))) (\u1 -> (\u2 -> u1 u2)))
-|     |       | |         |     |       | |     |     |       |   | ` ref name_21
-|     |       | |         |     |       | |     |     |       |   ` def name_25
+|     |       | |         |     |       | |     |     |       |   | ` ref name_27
+|     |       | |         |     |       | |     |     |       |   ` def name_1
 |     |       | |         |     |       | |     |     |       |     ` <|>
 |     |       | |         |     |       | |     |     |       |       + <*>
 |     |       | |         |     |       | |     |     |       |       | + <*>
 |     |       | |         |     |       | |     |     |       |       | | + pure (\u1 -> (\u2 -> (\u3 -> u1 (u2 u3))))
 |     |       | |         |     |       | |     |     |       |       | | ` <*>
-|     |       | |         |     |       | |     |     |       |       | |   + ref name_29
+|     |       | |         |     |       | |     |     |       |       | |   + ref name_6
 |     |       | |         |     |       | |     |     |       |       | |   ` <*>
 |     |       | |         |     |       | |     |     |       |       | |     + <*>
 |     |       | |         |     |       | |     |     |       |       | |     | + <*>
 |     |       | |         |     |       | |     |     |       |       | |     | | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |     |       |       | |     | | ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     |     |       |       | |     | ` ref name_18
-|     |       | |         |     |       | |     |     |       |       | |     ` ref name_8
-|     |       | |         |     |       | |     |     |       |       | ` rec name_25
+|     |       | |         |     |       | |     |     |       |       | |     | ` ref name_23
+|     |       | |         |     |       | |     |     |       |       | |     ` ref name_14
+|     |       | |         |     |       | |     |     |       |       | ` rec name_1
 |     |       | |         |     |       | |     |     |       |       ` pure (\u1 -> u1)
-|     |       | |         |     |       | |     |     |       ` ref name_21
-|     |       | |         |     |       | |     |     ` def name_15
+|     |       | |         |     |       | |     |     |       ` ref name_27
+|     |       | |         |     |       | |     |     ` def name_21
 |     |       | |         |     |       | |     |       ` <*>
 |     |       | |         |     |       | |     |         + <*>
 |     |       | |         |     |       | |     |         | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |         |   + <*>
 |     |       | |         |     |       | |     |         |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |         |     |       | |     |         |   | ` pure ';'
-|     |       | |         |     |       | |     |         |   ` ref name_5
-|     |       | |         |     |       | |     |         ` ref name_4
+|     |       | |         |     |       | |     |         |   ` ref name_2
+|     |       | |         |     |       | |     |         ` ref name_11
 |     |       | |         |     |       | |     ` <*>
 |     |       | |         |     |       | |       + <*>
 |     |       | |         |     |       | |       | + pure (\u1 -> (\u2 -> u1))
-|     |       | |         |     |       | |       | ` ref name_8
-|     |       | |         |     |       | |       ` ref name_15
-|     |       | |         |     |       | ` rec name_27
+|     |       | |         |     |       | |       | ` ref name_14
+|     |       | |         |     |       | |       ` ref name_21
+|     |       | |         |     |       | ` rec name_4
 |     |       | |         |     |       ` pure (\u1 -> u1)
-|     |       | |         |     ` ref name_21
+|     |       | |         |     ` ref name_27
 |     |       | |         ` <*>
 |     |       | |           + <*>
 |     |       | |           | + pure (\u1 -> (\u2 -> u1))
 |     |       | |           |   + <*>
 |     |       | |           |   | + pure (\u1 -> (\u2 -> u1))
 |     |       | |           |   | ` pure '}'
-|     |       | |           |   ` ref name_5
-|     |       | |           ` ref name_4
-|     |       | ` rec name_10
+|     |       | |           |   ` ref name_2
+|     |       | |           ` ref name_11
+|     |       | ` rec name_15
 |     |       ` pure (\u1 -> u1)
-|     ` ref name_21
+|     ` ref name_27
 ` eof
index 7714cd1a6c03cb7d41596701414568bd2b08efaf..c840a6c4403d116447c5182bfa2194019c81b1f0 100644 (file)
@@ -4,14 +4,14 @@
 | | + <*>
 | | | + <*>
 | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4)))))
-| | | | ` def name_15
+| | | | ` def name_20
 | | | |   ` <*>
 | | | |     + <*>
 | | | |     | + <*>
 | | | |     | | + pure (\u1 -> (\u2 -> (\u3 -> u3)))
-| | | |     | | ` def name_1
+| | | |     | | ` def name_7
 | | | |     | |   ` pure Term
-| | | |     | ` def name_2
+| | | |     | ` def name_8
 | | | |     |   ` <|>
 | | | |     |     + <*>
 | | | |     |     | + <*>
 | | | |     |     | |   + <*>
 | | | |     |     | |   | + <*>
 | | | |     |     | |   | | + pure (\u1 -> (\u2 -> Term))
-| | | |     |     | |   | | ` def name_29
+| | | |     |     | |   | | ` def name_5
 | | | |     |     | |   | |   ` <*>
 | | | |     |     | |   | |     + <*>
 | | | |     |     | |   | |     | + pure (\u1 -> (\u2 -> u2))
 | | | |     |     | |   | |     | ` satisfy
-| | | |     |     | |   | |     ` ref name_1
-| | | |     |     | |   | ` def name_27
+| | | |     |     | |   | |     ` ref name_7
+| | | |     |     | |   | ` def name_3
 | | | |     |     | |   |   ` <|>
 | | | |     |     | |   |     + <*>
 | | | |     |     | |   |     | + <*>
 | | | |     |     | |   |     | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))
-| | | |     |     | |   |     | | ` ref name_29
-| | | |     |     | |   |     | ` rec name_27
+| | | |     |     | |   |     | | ` ref name_5
+| | | |     |     | |   |     | ` rec name_3
 | | | |     |     | |   |     ` pure (\u1 -> u1)
 | | | |     |     | |   ` <*>
 | | | |     |     | |     + <*>
 | | | |     |     | |     | | | |     | + pure (\u1 -> (\u2 -> '/' : ('/' : Term)))
 | | | |     |     | |     | | | |     | ` satisfy
 | | | |     |     | |     | | | |     ` satisfy
-| | | |     |     | |     | | | ` ref name_1
-| | | |     |     | |     | | ` def name_24
+| | | |     |     | |     | | | ` ref name_7
+| | | |     |     | |     | | ` def name_30
 | | | |     |     | |     | |   ` <|>
 | | | |     |     | |     | |     + <*>
 | | | |     |     | |     | |     | + <*>
 | | | |     |     | |     | |     | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))
 | | | |     |     | |     | |     | | ` satisfy
-| | | |     |     | |     | |     | ` rec name_24
+| | | |     |     | |     | |     | ` rec name_30
 | | | |     |     | |     | |     ` pure (\u1 -> u1)
-| | | |     |     | |     | ` ref name_1
-| | | |     |     | |     ` ref name_1
-| | | |     |     | ` rec name_2
+| | | |     |     | |     | ` ref name_7
+| | | |     |     | |     ` ref name_7
+| | | |     |     | ` rec name_8
 | | | |     |     ` pure (\u1 -> u1)
-| | | |     ` ref name_1
-| | | ` ref name_1
-| | ` def name_30
+| | | |     ` ref name_7
+| | | ` ref name_7
+| | ` def name_6
 | |   ` <|>
 | |     + <*>
 | |     | + <*>
 | |     | | | | | | | | |     |     | | | ` satisfy
 | |     | | | | | | | | |     |     | | ` satisfy
 | |     | | | | | | | | |     |     | ` satisfy
-| |     | | | | | | | | |     |     ` def name_6
+| |     | | | | | | | | |     |     ` def name_14
 | |     | | | | | | | | |     |       ` pure Term
-| |     | | | | | | | | |     ` def name_9
+| |     | | | | | | | | |     ` def name_15
 | |     | | | | | | | | |       ` negLook
 | |     | | | | | | | | |         ` satisfy
-| |     | | | | | | | | ` ref name_15
-| |     | | | | | | | ` def name_11
+| |     | | | | | | | | ` ref name_20
+| |     | | | | | | | ` def name_19
 | |     | | | | | | |   ` <*>
 | |     | | | | | | |     + <*>
 | |     | | | | | | |     | + pure (\u1 -> (\u2 -> u2))
 | |     | | | | | | |     |     | | + <*>
 | |     | | | | | | |     |     | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))
 | |     | | | | | | |     |     | | | ` satisfy
-| |     | | | | | | |     |     | | ` ref name_1
-| |     | | | | | | |     |     | ` def name_17
+| |     | | | | | | |     |     | | ` ref name_7
+| |     | | | | | | |     |     | ` def name_23
 | |     | | | | | | |     |     |   ` <|>
 | |     | | | | | | |     |     |     + <*>
 | |     | | | | | | |     |     |     | + <*>
 | |     | | | | | | |     |     |     | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))
 | |     | | | | | | |     |     |     | | ` satisfy
-| |     | | | | | | |     |     |     | ` rec name_17
+| |     | | | | | | |     |     |     | ` rec name_23
 | |     | | | | | | |     |     |     ` pure (\u1 -> u1)
-| |     | | | | | | |     |     ` ref name_1
-| |     | | | | | | |     ` ref name_15
-| |     | | | | | | ` def name_19
+| |     | | | | | | |     |     ` ref name_7
+| |     | | | | | | |     ` ref name_20
+| |     | | | | | | ` def name_25
 | |     | | | | | |   ` <*>
 | |     | | | | | |     + <*>
 | |     | | | | | |     | + pure (\u1 -> (\u2 -> '('))
 | |     | | | | | |     | ` satisfy
-| |     | | | | | |     ` ref name_15
-| |     | | | | | ` def name_16
+| |     | | | | | |     ` ref name_20
+| |     | | | | | ` def name_21
 | |     | | | | |   ` <|>
 | |     | | | | |     + <*>
 | |     | | | | |     | + <*>
 | |     | | | | |     | | + <*>
 | |     | | | | |     | | | + <*>
 | |     | | | | |     | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))
-| |     | | | | |     | | | | ` def name_7
+| |     | | | | |     | | | | ` def name_12
 | |     | | | | |     | | | |   ` <*>
 | |     | | | | |     | | | |     + <*>
 | |     | | | | |     | | | |     | + pure (\u1 -> (\u2 -> u2))
-| |     | | | | |     | | | |     | ` ref name_11
+| |     | | | | |     | | | |     | ` ref name_19
 | |     | | | | |     | | | |     ` <|>
 | |     | | | | |     | | | |       + <*>
 | |     | | | | |     | | | |       | + pure (\u1 -> Term)
-| |     | | | | |     | | | |       | ` def name_22
+| |     | | | | |     | | | |       | ` def name_28
 | |     | | | | |     | | | |       |   ` <*>
 | |     | | | | |     | | | |       |     + <*>
 | |     | | | | |     | | | |       |     | + <*>
 | |     | | | | |     | | | |       |     | | | | + <*>
 | |     | | | | |     | | | |       |     | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term))))))
 | |     | | | | |     | | | |       |     | | | | | ` satisfy
-| |     | | | | |     | | | |       |     | | | | ` ref name_15
-| |     | | | | |     | | | |       |     | | | ` def name_4
+| |     | | | | |     | | | |       |     | | | | ` ref name_20
+| |     | | | | |     | | | |       |     | | | ` def name_10
 | |     | | | | |     | | | |       |     | | |   ` satisfy
-| |     | | | | |     | | | |       |     | | ` def name_20
+| |     | | | | |     | | | |       |     | | ` def name_26
 | |     | | | | |     | | | |       |     | |   ` <|>
 | |     | | | | |     | | | |       |     | |     + <*>
 | |     | | | | |     | | | |       |     | |     | + <*>
 | |     | | | | |     | | | |       |     | |     | | + pure (\u1 -> (\u2 -> (\u3 -> u2 u3)))
-| |     | | | | |     | | | |       |     | |     | | ` ref name_4
-| |     | | | | |     | | | |       |     | |     | ` rec name_20
+| |     | | | | |     | | | |       |     | |     | | ` ref name_10
+| |     | | | | |     | | | |       |     | |     | ` rec name_26
 | |     | | | | |     | | | |       |     | |     ` pure (\u1 -> u1)
 | |     | | | | |     | | | |       |     | ` satisfy
-| |     | | | | |     | | | |       |     ` ref name_15
-| |     | | | | |     | | | |       ` ref name_1
-| |     | | | | |     | | | ` ref name_1
-| |     | | | | |     | | ` def name_12
+| |     | | | | |     | | | |       |     ` ref name_20
+| |     | | | | |     | | | |       ` ref name_7
+| |     | | | | |     | | | ` ref name_7
+| |     | | | | |     | | ` def name_17
 | |     | | | | |     | |   ` <|>
 | |     | | | | |     | |     + <*>
 | |     | | | | |     | |     | + <*>
 | |     | | | | |     | |     | | + <*>
 | |     | | | | |     | |     | | | + <*>
 | |     | | | | |     | |     | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-| |     | | | | |     | |     | | | | ` def name_18
+| |     | | | | |     | |     | | | | ` def name_24
 | |     | | | | |     | |     | | | |   ` pure (\u1 -> (\u2 -> u2))
-| |     | | | | |     | |     | | | ` def name_8
+| |     | | | | |     | |     | | | ` def name_13
 | |     | | | | |     | |     | | |   ` <*>
 | |     | | | | |     | |     | | |     + <*>
 | |     | | | | |     | |     | | |     | + pure (\u1 -> (\u2 -> ','))
 | |     | | | | |     | |     | | |     | ` satisfy
-| |     | | | | |     | |     | | |     ` ref name_15
-| |     | | | | |     | |     | | ` ref name_7
-| |     | | | | |     | |     | ` rec name_12
+| |     | | | | |     | |     | | |     ` ref name_20
+| |     | | | | |     | |     | | ` ref name_12
+| |     | | | | |     | |     | ` rec name_17
 | |     | | | | |     | |     ` pure (\u1 -> u1)
-| |     | | | | |     | ` ref name_1
-| |     | | | | |     ` ref name_1
+| |     | | | | |     | ` ref name_7
+| |     | | | | |     ` ref name_7
 | |     | | | | ` <|>
 | |     | | | |   + <*>
 | |     | | | |   | + <*>
 | |     | | | |   | | + <*>
 | |     | | | |   | | | + pure (\u1 -> (\u2 -> (\u3 -> Term)))
 | |     | | | |   | | | ` satisfy
-| |     | | | |   | | ` ref name_15
-| |     | | | |   | ` ref name_16
-| |     | | | |   ` ref name_1
-| |     | | | ` def name_25
+| |     | | | |   | | ` ref name_20
+| |     | | | |   | ` ref name_21
+| |     | | | |   ` ref name_7
+| |     | | | ` def name_1
 | |     | | |   ` <*>
 | |     | | |     + <*>
 | |     | | |     | + pure (\u1 -> (\u2 -> ')'))
 | |     | | |     | ` satisfy
-| |     | | |     ` ref name_15
-| |     | | ` def name_13
+| |     | | |     ` ref name_20
+| |     | | ` def name_18
 | |     | |   ` <*>
 | |     | |     + <*>
 | |     | |     | + <*>
 | |     | |     | | | | | + <*>
 | |     | |     | | | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> u5)))))))
 | |     | |     | | | | | | ` satisfy
-| |     | |     | | | | | ` ref name_15
-| |     | |     | | | | ` ref name_1
-| |     | |     | | | ` def name_26
+| |     | |     | | | | | ` ref name_20
+| |     | |     | | | | ` ref name_7
+| |     | |     | | | ` def name_2
 | |     | |     | | |   ` <|>
 | |     | |     | | |     + <*>
 | |     | |     | | |     | + <*>
 | |     | |     | | |     | |   | | | | |     |     | | + pure (\u1 -> (\u2 -> (\u3 -> 'i' : ('f' : u3))))
 | |     | |     | | |     | |   | | | | |     |     | | ` satisfy
 | |     | |     | | |     | |   | | | | |     |     | ` satisfy
-| |     | |     | | |     | |   | | | | |     |     ` ref name_6
-| |     | |     | | |     | |   | | | | |     ` ref name_9
-| |     | |     | | |     | |   | | | | ` ref name_15
-| |     | |     | | |     | |   | | | ` def name_10
+| |     | |     | | |     | |   | | | | |     |     ` ref name_14
+| |     | |     | | |     | |   | | | | |     ` ref name_15
+| |     | |     | | |     | |   | | | | ` ref name_20
+| |     | |     | | |     | |   | | | ` def name_16
 | |     | |     | | |     | |   | | |   ` <*>
 | |     | |     | | |     | |   | | |     + <*>
 | |     | |     | | |     | |   | | |     | + <*>
 | |     | |     | | |     | |   | | |     | | + <*>
 | |     | |     | | |     | |   | | |     | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))
-| |     | |     | | |     | |   | | |     | | | ` def name_14
+| |     | |     | | |     | |   | | |     | | | ` def name_22
 | |     | |     | | |     | |   | | |     | | |   ` <|>
 | |     | |     | | |     | |   | | |     | | |     + <*>
 | |     | |     | | |     | |   | | |     | | |     | + <*>
 | |     | |     | | |     | |   | | |     | | |     | |   ` <*>
 | |     | |     | | |     | |   | | |     | | |     | |     + pure (\u1 -> '1')
 | |     | |     | | |     | |   | | |     | | |     | |     ` satisfy
-| |     | |     | | |     | |   | | |     | | |     | ` ref name_15
+| |     | |     | | |     | |   | | |     | | |     | ` ref name_20
 | |     | |     | | |     | |   | | |     | | |     ` <|>
 | |     | |     | | |     | |   | | |     | | |       + <*>
 | |     | |     | | |     | |   | | |     | | |       | + <*>
 | |     | |     | | |     | |   | | |     | | |       | | |   | + <*>
 | |     | |     | | |     | |   | | |     | | |       | | |   | | + pure (\u1 -> (\u2 -> u2))
 | |     | |     | | |     | |   | | |     | | |       | | |   | | ` satisfy
-| |     | |     | | |     | |   | | |     | | |       | | |   | ` ref name_1
+| |     | |     | | |     | |   | | |     | | |       | | |   | ` ref name_7
 | |     | |     | | |     | |   | | |     | | |       | | |   ` <*>
 | |     | |     | | |     | |   | | |     | | |       | | |     + <*>
 | |     | |     | | |     | |   | | |     | | |       | | |     | + <*>
 | |     | |     | | |     | |   | | |     | | |       | | |     | | + pure (\u1 -> (\u2 -> (\u3 -> u3)))
 | |     | |     | | |     | |   | | |     | | |       | | |     | | ` satisfy
 | |     | |     | | |     | |   | | |     | | |       | | |     | ` satisfy
-| |     | |     | | |     | |   | | |     | | |       | | |     ` ref name_1
+| |     | |     | | |     | |   | | |     | | |       | | |     ` ref name_7
 | |     | |     | | |     | |   | | |     | | |       | | ` satisfy
-| |     | |     | | |     | |   | | |     | | |       | ` ref name_15
+| |     | |     | | |     | |   | | |     | | |       | ` ref name_20
 | |     | |     | | |     | |   | | |     | | |       ` <*>
 | |     | |     | | |     | |   | | |     | | |         + <*>
 | |     | |     | | |     | |   | | |     | | |         | + pure (\u1 -> (\u2 -> u2))
-| |     | |     | | |     | |   | | |     | | |         | ` ref name_11
+| |     | |     | | |     | |   | | |     | | |         | ` ref name_19
 | |     | |     | | |     | |   | | |     | | |         ` <|>
 | |     | |     | | |     | |   | | |     | | |           + <*>
 | |     | |     | | |     | |   | | |     | | |           | + pure (\u1 -> Term)
 | |     | |     | | |     | |   | | |     | | |           |   | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | | | + pure (\u1 -> (\u2 -> (\u3 -> u2)))
-| |     | |     | | |     | |   | | |     | | |           |   | | | ` ref name_19
+| |     | |     | | |     | |   | | |     | | |           |   | | | ` ref name_25
 | |     | |     | | |     | |   | | |     | | |           |   | | ` <|>
 | |     | |     | | |     | |   | | |     | | |           |   | |   + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | | | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))
-| |     | |     | | |     | |   | | |     | | |           |   | |   | | | | ` rec name_10
-| |     | |     | | |     | |   | | |     | | |           |   | |   | | | ` ref name_1
-| |     | |     | | |     | |   | | |     | | |           |   | |   | | ` def name_21
+| |     | |     | | |     | |   | | |     | | |           |   | |   | | | | ` rec name_16
+| |     | |     | | |     | |   | | |     | | |           |   | |   | | | ` ref name_7
+| |     | |     | | |     | |   | | |     | | |           |   | |   | | ` def name_27
 | |     | |     | | |     | |   | | |     | | |           |   | |   | |   ` <|>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | |     + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | |     | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | | + <*>
 | |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | | | ` ref name_18
-| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | | ` ref name_8
-| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | ` rec name_10
-| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | ` rec name_21
+| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | | | ` ref name_24
+| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | | ` ref name_13
+| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | | ` rec name_16
+| |     | |     | | |     | |   | | |     | | |           |   | |   | |     | ` rec name_27
 | |     | |     | | |     | |   | | |     | | |           |   | |   | |     ` pure (\u1 -> u1)
-| |     | |     | | |     | |   | | |     | | |           |   | |   | ` ref name_1
-| |     | |     | | |     | |   | | |     | | |           |   | |   ` ref name_1
-| |     | |     | | |     | |   | | |     | | |           |   | ` ref name_25
-| |     | |     | | |     | |   | | |     | | |           |   ` ref name_22
-| |     | |     | | |     | |   | | |     | | |           ` ref name_1
-| |     | |     | | |     | |   | | |     | | ` ref name_1
-| |     | |     | | |     | |   | | |     | ` def name_28
+| |     | |     | | |     | |   | | |     | | |           |   | |   | ` ref name_7
+| |     | |     | | |     | |   | | |     | | |           |   | |   ` ref name_7
+| |     | |     | | |     | |   | | |     | | |           |   | ` ref name_1
+| |     | |     | | |     | |   | | |     | | |           |   ` ref name_28
+| |     | |     | | |     | |   | | |     | | |           ` ref name_7
+| |     | |     | | |     | |   | | |     | | ` ref name_7
+| |     | |     | | |     | |   | | |     | ` def name_4
 | |     | |     | | |     | |   | | |     |   ` <|>
 | |     | |     | | |     | |   | | |     |     + <*>
 | |     | |     | | |     | |   | | |     |     | + <*>
 | |     | |     | | |     | |   | | |     |     | | | + <*>
 | |     | |     | | |     | |   | | |     |     | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4 u5)))))
 | |     | |     | | |     | |   | | |     |     | | | | ` satisfy
-| |     | |     | | |     | |   | | |     |     | | | ` ref name_15
-| |     | |     | | |     | |   | | |     |     | | ` ref name_14
-| |     | |     | | |     | |   | | |     |     | ` rec name_28
+| |     | |     | | |     | |   | | |     |     | | | ` ref name_20
+| |     | |     | | |     | |   | | |     |     | | ` ref name_22
+| |     | |     | | |     | |   | | |     |     | ` rec name_4
 | |     | |     | | |     | |   | | |     |     ` pure (\u1 -> u1)
-| |     | |     | | |     | |   | | |     ` ref name_1
-| |     | |     | | |     | |   | | ` rec name_13
+| |     | |     | | |     | |   | | |     ` ref name_7
+| |     | |     | | |     | |   | | ` rec name_18
 | |     | |     | | |     | |   | ` <|>
 | |     | |     | | |     | |   |   + <*>
 | |     | |     | | |     | |   |   | + <*>
 | |     | |     | | |     | |   |   | | |     |     | | | ` satisfy
 | |     | |     | | |     | |   |   | | |     |     | | ` satisfy
 | |     | |     | | |     | |   |   | | |     |     | ` satisfy
-| |     | |     | | |     | |   |   | | |     |     ` ref name_6
-| |     | |     | | |     | |   |   | | |     ` ref name_9
-| |     | |     | | |     | |   |   | | ` ref name_15
-| |     | |     | | |     | |   |   | ` rec name_13
-| |     | |     | | |     | |   |   ` ref name_1
+| |     | |     | | |     | |   |   | | |     |     ` ref name_14
+| |     | |     | | |     | |   |   | | |     ` ref name_15
+| |     | |     | | |     | |   |   | | ` ref name_20
+| |     | |     | | |     | |   |   | ` rec name_18
+| |     | |     | | |     | |   |   ` ref name_7
 | |     | |     | | |     | |   ` <|>
 | |     | |     | | |     | |     + <*>
 | |     | |     | | |     | |     | + <*>
 | |     | |     | | |     | |     | | | |     |     | | | ` satisfy
 | |     | |     | | |     | |     | | | |     |     | | ` satisfy
 | |     | |     | | |     | |     | | | |     |     | ` satisfy
-| |     | |     | | |     | |     | | | |     |     ` ref name_6
-| |     | |     | | |     | |     | | | |     ` ref name_9
-| |     | |     | | |     | |     | | | ` ref name_15
-| |     | |     | | |     | |     | | ` ref name_10
-| |     | |     | | |     | |     | ` rec name_13
+| |     | |     | | |     | |     | | | |     |     ` ref name_14
+| |     | |     | | |     | |     | | | |     ` ref name_15
+| |     | |     | | |     | |     | | | ` ref name_20
+| |     | |     | | |     | |     | | ` ref name_16
+| |     | |     | | |     | |     | ` rec name_18
 | |     | |     | | |     | |     ` <|>
 | |     | |     | | |     | |       + try
 | |     | |     | | |     | |       | ` <*>
 | |     | |     | | |     | |       |   | | | | | | | | | | |   | |     |     | | | ` satisfy
 | |     | |     | | |     | |       |   | | | | | | | | | | |   | |     |     | | ` satisfy
 | |     | |     | | |     | |       |   | | | | | | | | | | |   | |     |     | ` satisfy
-| |     | |     | | |     | |       |   | | | | | | | | | | |   | |     |     ` ref name_6
-| |     | |     | | |     | |       |   | | | | | | | | | | |   | |     ` ref name_9
-| |     | |     | | |     | |       |   | | | | | | | | | | |   | ` ref name_15
-| |     | |     | | |     | |       |   | | | | | | | | | | |   ` ref name_1
-| |     | |     | | |     | |       |   | | | | | | | | | | ` ref name_7
-| |     | |     | | |     | |       |   | | | | | | | | | ` ref name_1
-| |     | |     | | |     | |       |   | | | | | | | | ` def name_3
+| |     | |     | | |     | |       |   | | | | | | | | | | |   | |     |     ` ref name_14
+| |     | |     | | |     | |       |   | | | | | | | | | | |   | |     ` ref name_15
+| |     | |     | | |     | |       |   | | | | | | | | | | |   | ` ref name_20
+| |     | |     | | |     | |       |   | | | | | | | | | | |   ` ref name_7
+| |     | |     | | |     | |       |   | | | | | | | | | | ` ref name_12
+| |     | |     | | |     | |       |   | | | | | | | | | ` ref name_7
+| |     | |     | | |     | |       |   | | | | | | | | ` def name_9
 | |     | |     | | |     | |       |   | | | | | | | |   ` <|>
 | |     | |     | | |     | |       |   | | | | | | | |     + <*>
 | |     | |     | | |     | |       |   | | | | | | | |     | + <*>
 | |     | |     | | |     | |       |   | | | | | | | |     | | + <*>
 | |     | |     | | |     | |       |   | | | | | | | |     | | | + <*>
 | |     | |     | | |     | |       |   | | | | | | | |     | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-| |     | |     | | |     | |       |   | | | | | | | |     | | | | ` ref name_18
-| |     | |     | | |     | |       |   | | | | | | | |     | | | ` ref name_8
-| |     | |     | | |     | |       |   | | | | | | | |     | | ` ref name_7
-| |     | |     | | |     | |       |   | | | | | | | |     | ` rec name_3
+| |     | |     | | |     | |       |   | | | | | | | |     | | | | ` ref name_24
+| |     | |     | | |     | |       |   | | | | | | | |     | | | ` ref name_13
+| |     | |     | | |     | |       |   | | | | | | | |     | | ` ref name_12
+| |     | |     | | |     | |       |   | | | | | | | |     | ` rec name_9
 | |     | |     | | |     | |       |   | | | | | | | |     ` pure (\u1 -> u1)
-| |     | |     | | |     | |       |   | | | | | | | ` ref name_1
+| |     | |     | | |     | |       |   | | | | | | | ` ref name_7
 | |     | |     | | |     | |       |   | | | | | | ` satisfy
-| |     | |     | | |     | |       |   | | | | | ` ref name_15
-| |     | |     | | |     | |       |   | | | | ` ref name_10
-| |     | |     | | |     | |       |   | | | ` ref name_1
-| |     | |     | | |     | |       |   | | ` def name_5
+| |     | |     | | |     | |       |   | | | | | ` ref name_20
+| |     | |     | | |     | |       |   | | | | ` ref name_16
+| |     | |     | | |     | |       |   | | | ` ref name_7
+| |     | |     | | |     | |       |   | | ` def name_11
 | |     | |     | | |     | |       |   | |   ` <|>
 | |     | |     | | |     | |       |   | |     + <*>
 | |     | |     | | |     | |       |   | |     | + <*>
 | |     | |     | | |     | |       |   | |     | | + <*>
 | |     | |     | | |     | |       |   | |     | | | + <*>
 | |     | |     | | |     | |       |   | |     | | | | + pure (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-| |     | |     | | |     | |       |   | |     | | | | ` ref name_18
-| |     | |     | | |     | |       |   | |     | | | ` ref name_8
-| |     | |     | | |     | |       |   | |     | | ` ref name_10
-| |     | |     | | |     | |       |   | |     | ` rec name_5
+| |     | |     | | |     | |       |   | |     | | | | ` ref name_24
+| |     | |     | | |     | |       |   | |     | | | ` ref name_13
+| |     | |     | | |     | |       |   | |     | | ` ref name_16
+| |     | |     | | |     | |       |   | |     | ` rec name_11
 | |     | |     | | |     | |       |   | |     ` pure (\u1 -> u1)
-| |     | |     | | |     | |       |   | ` ref name_1
-| |     | |     | | |     | |       |   ` def name_23
+| |     | |     | | |     | |       |   | ` ref name_7
+| |     | |     | | |     | |       |   ` def name_29
 | |     | |     | | |     | |       |     ` <*>
 | |     | |     | | |     | |       |       + <*>
 | |     | |     | | |     | |       |       | + pure (\u1 -> (\u2 -> ';'))
 | |     | |     | | |     | |       |       | ` satisfy
-| |     | |     | | |     | |       |       ` ref name_15
+| |     | |     | | |     | |       |       ` ref name_20
 | |     | |     | | |     | |       ` <*>
 | |     | |     | | |     | |         + <*>
 | |     | |     | | |     | |         | + pure (\u1 -> (\u2 -> u1))
-| |     | |     | | |     | |         | ` ref name_10
-| |     | |     | | |     | |         ` ref name_23
-| |     | |     | | |     | ` rec name_26
+| |     | |     | | |     | |         | ` ref name_16
+| |     | |     | | |     | |         ` ref name_29
+| |     | |     | | |     | ` rec name_2
 | |     | |     | | |     ` pure (\u1 -> u1)
-| |     | |     | | ` ref name_1
+| |     | |     | | ` ref name_7
 | |     | |     | ` satisfy
-| |     | |     ` ref name_15
-| |     | ` rec name_30
+| |     | |     ` ref name_20
+| |     | ` rec name_6
 | |     ` pure (\u1 -> u1)
-| ` ref name_1
+| ` ref name_7
 ` eof
index cbf8b5a194bfc4ae9858ce965da00dc24d976306..ce087c569d69b21313feded2058c6f914a730a30 100644 (file)
@@ -1,51 +1,51 @@
 push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (u4 u5) u6))))))
-name_3:
+name_5:
 | push (\u1 -> (\u2 -> u2))
 | ret
-call name_3
+call name_5
 lift (\u1 -> (\u2 -> u1 u2))
-name_7:
-| name_6:
+name_2:
+| name_1:
 | | push (\u1 -> (\u2 -> u2))
 | | ret
-| call name_6
-| name_5:
+| call name_1
+| name_7:
 | | push (\u1 -> (\u2 -> u2))
-| | call name_7
+| | call name_2
 | | lift (\u1 -> (\u2 -> u1 u2))
-| | call name_5
+| | call name_7
 | | lift (\u1 -> (\u2 -> u1 u2))
 | | ret
-| call name_5
-| lift (\u1 -> (\u2 -> u1 u2))
 | call name_7
 | lift (\u1 -> (\u2 -> u1 u2))
+| call name_2
+| lift (\u1 -> (\u2 -> u1 u2))
 | ret
-call name_7
+call name_2
 lift (\u1 -> (\u2 -> u1 u2))
-name_4:
+name_6:
 | push Term
 | ret
-call name_4
+call name_6
 lift (\u1 -> (\u2 -> u1 u2))
-call name_3
+call name_5
 lift (\u1 -> (\u2 -> u1 u2))
-name_2:
-| call name_6
-| name_1:
+name_4:
+| call name_1
+| name_3:
 | | push (\u1 -> (\u2 -> u2))
-| | call name_2
+| | call name_4
 | | lift (\u1 -> (\u2 -> u1 u2))
-| | call name_1
+| | call name_3
 | | lift (\u1 -> (\u2 -> u1 u2))
 | | ret
-| call name_1
+| call name_3
 | lift (\u1 -> (\u2 -> u1 u2))
-| call name_2
+| call name_4
 | lift (\u1 -> (\u2 -> u1 u2))
 | ret
-call name_2
-lift (\u1 -> (\u2 -> u1 u2))
 call name_4
 lift (\u1 -> (\u2 -> u1 u2))
+call name_6
+lift (\u1 -> (\u2 -> u1 u2))
 ret
index fb2cd306af34575f840c8fd53911de7e2c775002..583132db86bffaeb1d9d6f73562be110add88560 100644 (file)
@@ -1,70 +1,40 @@
-push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))
-name_7:
-| push Term
+push (\u1 -> (\u2 -> u2))
+name_1:
+| push (\u1 -> Term)
+| name_4:
+| | catchFail
+| |   <try>
+| |   | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))
+| |   | read Term
+| |   | lift (\u1 -> (\u2 -> u1 u2))
+| |   | call name_4
+| |   | lift (\u1 -> (\u2 -> u1 u2))
+| |   | popFail
+| |   | ret
+| |   <handler>
+| |     pushInput
+| |     lift Term
+| |     choices [(\u1 -> u1)]
+| |       <branch>
+| |       | push (\u1 -> u1)
+| |       | ret
+| |       <default>
+| |         fail
+| call name_4
+| lift (\u1 -> (\u2 -> u1 u2))
 | ret
-call name_7
-lift (\u1 -> (\u2 -> u1 u2))
-name_6:
-| catchFail
-|   <try>
-|   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
-|   | name_5:
-|   | | push (\u1 -> (\u2 -> u2))
-|   | | ret
-|   | call name_5
-|   | lift (\u1 -> (\u2 -> u1 u2))
-|   | read Term
-|   | lift (\u1 -> (\u2 -> u1 u2))
-|   | call name_6
-|   | lift (\u1 -> (\u2 -> u1 u2))
-|   | popFail
-|   | ret
-|   <handler>
-|     pushInput
-|     lift Term
-|     choices [(\u1 -> u1)]
-|       <branch>
-|       | push (\u1 -> u1)
-|       | ret
-|       <default>
-|         fail
-call name_6
-lift (\u1 -> (\u2 -> u1 u2))
-call name_7
+call name_1
 lift (\u1 -> (\u2 -> u1 u2))
 name_3:
 | push (\u1 -> u1 Term)
 | name_2:
 | | catchFail
 | |   <try>
-| |   | join_55:
-| |   | | call name_7
+| |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
+| |   | join_46:
 | |   | | lift (\u1 -> (\u2 -> u1 u2))
-| |   | | name_1:
-| |   | | | catchFail
-| |   | | |   <try>
-| |   | | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
-| |   | | |   | call name_5
-| |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   | | |   | read Term
-| |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   | | |   | call name_1
-| |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   | | |   | popFail
-| |   | | |   | ret
-| |   | | |   <handler>
-| |   | | |     pushInput
-| |   | | |     lift Term
-| |   | | |     choices [(\u1 -> u1)]
-| |   | | |       <branch>
-| |   | | |       | push (\u1 -> u1)
-| |   | | |       | ret
-| |   | | |       <default>
-| |   | | |         fail
 | |   | | call name_1
 | |   | | lift (\u1 -> (\u2 -> u1 u2))
-| |   | | call name_7
-| |   | | lift (\u1 -> (\u2 -> u1 u2))
 | |   | | call name_2
 | |   | | lift (\u1 -> (\u2 -> u1 u2))
 | |   | | popFail
@@ -75,71 +45,46 @@ name_3:
 | |   | loadInput
 | |   | choices [(Term ==),(Term ==),(Term ==),(Term ==),(Term ==),(Term ==),(Term ==)]
 | |   |   <branch>
-| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
+| |   |   | push (\u1 -> (\u2 -> cons Term))
 | |   |   | read ((\u1 -> (\u2 -> u1)) Term)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <branch>
-| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
+| |   |   | push (\u1 -> (\u2 -> cons Term))
 | |   |   | read ((\u1 -> (\u2 -> u1)) Term)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <branch>
-| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
+| |   |   | push (\u1 -> (\u2 -> cons Term))
 | |   |   | read ((\u1 -> (\u2 -> u1)) Term)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <branch>
-| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
+| |   |   | push (\u1 -> (\u2 -> cons Term))
 | |   |   | read ((\u1 -> (\u2 -> u1)) Term)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <branch>
-| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
+| |   |   | push (\u1 -> (\u2 -> cons Term))
 | |   |   | read ((\u1 -> (\u2 -> u1)) Term)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <branch>
-| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term : u5 u6))))))
+| |   |   | push (\u1 -> (\u2 -> cons Term))
 | |   |   | read ((\u1 -> (\u2 -> u1)) Term)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <branch>
-| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> (\u11 -> Term u5 : u10 u11)))))))))))
+| |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> cons (Term u3))))))
 | |   |   | read ((\u1 -> (\u2 -> u1)) Term)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | call name_7
-| |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | name_4:
-| |   |   | | catchFail
-| |   |   | |   <try>
-| |   |   | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (u1 u2) (u3 u4)))))
-| |   |   | |   | call name_5
-| |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | |   | read Term
-| |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | |   | call name_4
-| |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | |   | popFail
-| |   |   | |   | ret
-| |   |   | |   <handler>
-| |   |   | |     pushInput
-| |   |   | |     lift Term
-| |   |   | |     choices [(\u1 -> u1)]
-| |   |   | |       <branch>
-| |   |   | |       | push (\u1 -> u1)
-| |   |   | |       | ret
-| |   |   | |       <default>
-| |   |   | |         fail
-| |   |   | call name_4
-| |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | call name_7
+| |   |   | call name_1
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
 | |   |   | call name_3
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
 | |   |   | read (']' ==)
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <default>
 | |   |     fail
 | |   <handler>
index d3a66d11f8db5ce9eedae2aed8595ef277d6367a..03d2b23d02bd6ad6c3edffc615dfb1bd110ef9ed 100644 (file)
@@ -20,7 +20,7 @@ name_1:
 |         fail
 call name_1
 lift (\u1 -> (\u2 -> u1 u2))
-join_55:
+join_46:
 | lift (\u1 -> (\u2 -> u1 u2))
 | ret
 catchFail
@@ -37,7 +37,7 @@ catchFail
   |     loadInput
   |     push Term
   |     popFail
-  |     refJoin join_55
+  |     refJoin join_46
   <handler>
     pushInput
     lift Term
index 615a3e19221e08ab48297cb9ce2413115c53c20f..a0de89afa4d6b2a1ffadd27b547ca7358799c38b 100644 (file)
@@ -1,40 +1,40 @@
 push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4)))))
-name_17:
+name_26:
 | push (\u1 -> (\u2 -> (\u3 -> u3)))
-| name_28:
+| name_10:
 | | push Term
 | | ret
-| call name_28
+| call name_10
 | lift (\u1 -> (\u2 -> u1 u2))
-| name_24:
+| name_9:
 | | catchFail
 | |   <try>
 | |   | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))
-| |   | join_55:
+| |   | join_46:
 | |   | | lift (\u1 -> (\u2 -> u1 u2))
-| |   | | call name_24
+| |   | | call name_9
 | |   | | lift (\u1 -> (\u2 -> u1 u2))
 | |   | | popFail
 | |   | | ret
 | |   | catchFail
 | |   |   <try>
 | |   |   | push (\u1 -> (\u2 -> Term))
-| |   |   | name_4:
+| |   |   | name_11:
 | |   |   | | push (\u1 -> (\u2 -> u2))
 | |   |   | | read Term
 | |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | | call name_28
+| |   |   | | call name_10
 | |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 | |   |   | | ret
-| |   |   | call name_4
+| |   |   | call name_11
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | name_6:
+| |   |   | name_14:
 | |   |   | | catchFail
 | |   |   | |   <try>
 | |   |   | |   | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))
-| |   |   | |   | call name_4
+| |   |   | |   | call name_11
 | |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |   | |   | call name_6
+| |   |   | |   | call name_14
 | |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 | |   |   | |   | popFail
 | |   |   | |   | ret
@@ -47,10 +47,10 @@ name_17:
 | |   |   | |       | ret
 | |   |   | |       <default>
 | |   |   | |         fail
-| |   |   | call name_6
+| |   |   | call name_14
 | |   |   | lift (\u1 -> (\u2 -> u1 u2))
 | |   |   | popFail
-| |   |   | refJoin join_55
+| |   |   | refJoin join_46
 | |   |   <handler>
 | |   |     pushInput
 | |   |     lift Term
@@ -66,15 +66,15 @@ name_17:
 | |   |       |   | lift (\u1 -> (\u2 -> u1 u2))
 | |   |       |   | popFail
 | |   |       |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |       |   | call name_28
+| |   |       |   | call name_10
 | |   |       |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |       |   | name_7:
+| |   |       |   | name_19:
 | |   |       |   | | catchFail
 | |   |       |   | |   <try>
 | |   |       |   | |   | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))
 | |   |       |   | |   | read Term
 | |   |       |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |       |   | |   | call name_7
+| |   |       |   | |   | call name_19
 | |   |       |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 | |   |       |   | |   | popFail
 | |   |       |   | |   | ret
@@ -87,13 +87,13 @@ name_17:
 | |   |       |   | |       | ret
 | |   |       |   | |       <default>
 | |   |       |   | |         fail
-| |   |       |   | call name_7
+| |   |       |   | call name_19
 | |   |       |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |       |   | call name_28
+| |   |       |   | call name_10
 | |   |       |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |       |   | call name_28
+| |   |       |   | call name_10
 | |   |       |   | lift (\u1 -> (\u2 -> u1 u2))
-| |   |       |   | refJoin join_55
+| |   |       |   | refJoin join_46
 | |   |       |   <handler>
 | |   |       |     loadInput
 | |   |       |     fail
@@ -108,16 +108,16 @@ name_17:
 | |       | ret
 | |       <default>
 | |         fail
-| call name_24
+| call name_9
 | lift (\u1 -> (\u2 -> u1 u2))
-| call name_28
+| call name_10
 | lift (\u1 -> (\u2 -> u1 u2))
 | ret
-call name_17
+call name_26
 lift (\u1 -> (\u2 -> u1 u2))
-call name_28
+call name_10
 lift (\u1 -> (\u2 -> u1 u2))
-name_5:
+name_12:
 | catchFail
 |   <try>
 |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> u9 u10))))))))))
@@ -143,14 +143,14 @@ name_5:
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | read ('n' ==)
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | name_29:
+|   |   |   | name_4:
 |   |   |   | | push Term
 |   |   |   | | ret
-|   |   |   | call name_29
+|   |   |   | call name_4
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | popFail
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | name_26:
+|   |   |   | name_2:
 |   |   |   | | catchFail
 |   |   |   | |   <try>
 |   |   |   | |   | pushInput
@@ -163,28 +163,28 @@ name_5:
 |   |   |   | |     loadInput
 |   |   |   | |     push Term
 |   |   |   | |     ret
-|   |   |   | call name_26
+|   |   |   | call name_2
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | popFail
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | call name_17
+|   |   |   | call name_26
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | name_22:
+|   |   |   | name_28:
 |   |   |   | | push (\u1 -> (\u2 -> u2))
 |   |   |   | | catchFail
 |   |   |   | |   <try>
 |   |   |   | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))
 |   |   |   | |   | read Term
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | call name_28
+|   |   |   | |   | call name_10
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | name_18:
+|   |   |   | |   | name_24:
 |   |   |   | |   | | catchFail
 |   |   |   | |   | |   <try>
 |   |   |   | |   | |   | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))
 |   |   |   | |   | |   | read Term
 |   |   |   | |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | call name_18
+|   |   |   | |   | |   | call name_24
 |   |   |   | |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | |   | popFail
 |   |   |   | |   | |   | ret
@@ -197,61 +197,61 @@ name_5:
 |   |   |   | |   | |       | ret
 |   |   |   | |   | |       <default>
 |   |   |   | |   | |         fail
-|   |   |   | |   | call name_18
+|   |   |   | |   | call name_24
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | call name_28
+|   |   |   | |   | call name_10
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | popFail
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | call name_17
+|   |   |   | |   | call name_26
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | ret
 |   |   |   | |   <handler>
 |   |   |   | |     loadInput
 |   |   |   | |     fail
-|   |   |   | call name_22
+|   |   |   | call name_28
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | name_15:
+|   |   |   | name_22:
 |   |   |   | | push (\u1 -> (\u2 -> '('))
 |   |   |   | | read ('(' ==)
 |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | call name_17
+|   |   |   | | call name_26
 |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | ret
-|   |   |   | call name_15
+|   |   |   | call name_22
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | name_19:
+|   |   |   | name_25:
 |   |   |   | | catchFail
 |   |   |   | |   <try>
 |   |   |   | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))
-|   |   |   | |   | name_27:
+|   |   |   | |   | name_3:
 |   |   |   | |   | | push (\u1 -> (\u2 -> u2))
-|   |   |   | |   | | call name_22
+|   |   |   | |   | | call name_28
 |   |   |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | | join_55:
+|   |   |   | |   | | join_46:
 |   |   |   | |   | | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | | | ret
 |   |   |   | |   | | catchFail
 |   |   |   | |   | |   <try>
 |   |   |   | |   | |   | push (\u1 -> Term)
-|   |   |   | |   | |   | name_12:
+|   |   |   | |   | |   | name_18:
 |   |   |   | |   | |   | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> Term))))))
 |   |   |   | |   | |   | | read ('[' ==)
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | | call name_17
+|   |   |   | |   | |   | | call name_26
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | | name_2:
+|   |   |   | |   | |   | | name_7:
 |   |   |   | |   | |   | | | read Term
 |   |   |   | |   | |   | | | ret
-|   |   |   | |   | |   | | call name_2
+|   |   |   | |   | |   | | call name_7
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | | name_14:
+|   |   |   | |   | |   | | name_21:
 |   |   |   | |   | |   | | | catchFail
 |   |   |   | |   | |   | | |   <try>
 |   |   |   | |   | |   | | |   | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))
-|   |   |   | |   | |   | | |   | call name_2
+|   |   |   | |   | |   | | |   | call name_7
 |   |   |   | |   | |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | | |   | call name_14
+|   |   |   | |   | |   | | |   | call name_21
 |   |   |   | |   | |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | |   | | |   | popFail
 |   |   |   | |   | |   | | |   | ret
@@ -264,51 +264,51 @@ name_5:
 |   |   |   | |   | |   | | |       | ret
 |   |   |   | |   | |   | | |       <default>
 |   |   |   | |   | |   | | |         fail
-|   |   |   | |   | |   | | call name_14
+|   |   |   | |   | |   | | call name_21
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | |   | | read (']' ==)
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | | call name_17
+|   |   |   | |   | |   | | call name_26
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | |   | | ret
-|   |   |   | |   | |   | call name_12
+|   |   |   | |   | |   | call name_18
 |   |   |   | |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | |   | popFail
-|   |   |   | |   | |   | refJoin join_55
+|   |   |   | |   | |   | refJoin join_46
 |   |   |   | |   | |   <handler>
 |   |   |   | |   | |     pushInput
 |   |   |   | |   | |     lift Term
 |   |   |   | |   | |     choices [(\u1 -> u1)]
 |   |   |   | |   | |       <branch>
-|   |   |   | |   | |       | call name_28
-|   |   |   | |   | |       | refJoin join_55
+|   |   |   | |   | |       | call name_10
+|   |   |   | |   | |       | refJoin join_46
 |   |   |   | |   | |       <default>
 |   |   |   | |   | |         fail
-|   |   |   | |   | call name_27
+|   |   |   | |   | call name_3
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | call name_28
+|   |   |   | |   | call name_10
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | name_21:
+|   |   |   | |   | name_30:
 |   |   |   | |   | | catchFail
 |   |   |   | |   | |   <try>
 |   |   |   | |   | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-|   |   |   | |   | |   | name_16:
+|   |   |   | |   | |   | name_23:
 |   |   |   | |   | |   | | push (\u1 -> (\u2 -> u2))
 |   |   |   | |   | |   | | ret
-|   |   |   | |   | |   | call name_16
+|   |   |   | |   | |   | call name_23
 |   |   |   | |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | name_30:
+|   |   |   | |   | |   | name_5:
 |   |   |   | |   | |   | | push (\u1 -> (\u2 -> ','))
 |   |   |   | |   | |   | | read (',' ==)
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | | call name_17
+|   |   |   | |   | |   | | call name_26
 |   |   |   | |   | |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | |   | | ret
-|   |   |   | |   | |   | call name_30
+|   |   |   | |   | |   | call name_5
 |   |   |   | |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | call name_27
+|   |   |   | |   | |   | call name_3
 |   |   |   | |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | |   | call name_21
+|   |   |   | |   | |   | call name_30
 |   |   |   | |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | |   | popFail
 |   |   |   | |   | |   | ret
@@ -321,9 +321,9 @@ name_5:
 |   |   |   | |   | |       | ret
 |   |   |   | |   | |       <default>
 |   |   |   | |   | |         fail
-|   |   |   | |   | call name_21
+|   |   |   | |   | call name_30
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | |   | call name_28
+|   |   |   | |   | call name_10
 |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | |   | popFail
 |   |   |   | |   | ret
@@ -332,37 +332,37 @@ name_5:
 |   |   |   | |     lift Term
 |   |   |   | |     choices [(\u1 -> u1)]
 |   |   |   | |       <branch>
-|   |   |   | |       | jump name_28
+|   |   |   | |       | jump name_10
 |   |   |   | |       <default>
 |   |   |   | |         fail
-|   |   |   | call name_19
+|   |   |   | call name_25
 |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | join_55:
+|   |   |   | join_46:
 |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | name_10:
+|   |   |   | | name_16:
 |   |   |   | | | push (\u1 -> (\u2 -> ')'))
 |   |   |   | | | read (')' ==)
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | call name_17
+|   |   |   | | | call name_26
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | ret
-|   |   |   | | call name_10
+|   |   |   | | call name_16
 |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | name_23:
+|   |   |   | | name_29:
 |   |   |   | | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> u5)))))))
 |   |   |   | | | read ('{' ==)
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | call name_17
+|   |   |   | | | call name_26
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | call name_28
+|   |   |   | | | call name_10
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | name_9:
+|   |   |   | | | name_15:
 |   |   |   | | | | catchFail
 |   |   |   | | | |   <try>
 |   |   |   | | | |   | push (\u1 -> (\u2 -> (\u3 -> u2 u3)))
-|   |   |   | | | |   | join_55:
+|   |   |   | | | |   | join_46:
 |   |   |   | | | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   | | call name_9
+|   |   |   | | | |   | | call name_15
 |   |   |   | | | |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   | | popFail
 |   |   |   | | | |   | | ret
@@ -379,25 +379,25 @@ name_5:
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | read ('f' ==)
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | call name_29
+|   |   |   | | | |   |   |   |   | call name_4
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | popFail
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | call name_26
+|   |   |   | | | |   |   |   |   | call name_2
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | popFail
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | call name_17
+|   |   |   | | | |   |   |   |   | call name_26
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | name_25:
+|   |   |   | | | |   |   |   |   | name_1:
 |   |   |   | | | |   |   |   |   | | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u4))))
-|   |   |   | | | |   |   |   |   | | name_20:
+|   |   |   | | | |   |   |   |   | | name_27:
 |   |   |   | | | |   |   |   |   | | | catchFail
 |   |   |   | | | |   |   |   |   | | |   <try>
 |   |   |   | | | |   |   |   |   | | |   | push (\u1 -> (\u2 -> u2))
-|   |   |   | | | |   |   |   |   | | |   | join_55:
+|   |   |   | | | |   |   |   |   | | |   | join_46:
 |   |   |   | | | |   |   |   |   | | |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |   | | call name_17
+|   |   |   | | | |   |   |   |   | | |   | | call name_26
 |   |   |   | | | |   |   |   |   | | |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |   | | popFail
 |   |   |   | | | |   |   |   |   | | |   | | ret
@@ -407,7 +407,7 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |   |   | read ('0' ==)
 |   |   |   | | | |   |   |   |   | | |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |   |   | popFail
-|   |   |   | | | |   |   |   |   | | |   |   | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |   |   | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |   |   <handler>
 |   |   |   | | | |   |   |   |   | | |   |     pushInput
 |   |   |   | | | |   |   |   |   | | |   |     lift Term
@@ -416,7 +416,7 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |   |       | push (\u1 -> '1')
 |   |   |   | | | |   |   |   |   | | |   |       | read ('1' ==)
 |   |   |   | | | |   |   |   |   | | |   |       | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |   |       | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |   |       | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |   |       <default>
 |   |   |   | | | |   |   |   |   | | |   |         fail
 |   |   |   | | | |   |   |   |   | | |   <handler>
@@ -429,11 +429,11 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> u2))))
 |   |   |   | | | |   |   |   |   | | |       |   | read ('\'' ==)
 |   |   |   | | | |   |   |   |   | | |       |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |   | join_55:
+|   |   |   | | | |   |   |   |   | | |       |   | join_46:
 |   |   |   | | | |   |   |   |   | | |       |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |   | | read ('\'' ==)
 |   |   |   | | | |   |   |   |   | | |       |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |   | | call name_17
+|   |   |   | | | |   |   |   |   | | |       |   | | call name_26
 |   |   |   | | | |   |   |   |   | | |       |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |   | | popFail
 |   |   |   | | | |   |   |   |   | | |       |   | | ret
@@ -442,10 +442,10 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       |   |   | push (\u1 -> (\u2 -> u2))
 |   |   |   | | | |   |   |   |   | | |       |   |   | read Term
 |   |   |   | | | |   |   |   |   | | |       |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |   |   | call name_28
+|   |   |   | | | |   |   |   |   | | |       |   |   | call name_10
 |   |   |   | | | |   |   |   |   | | |       |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |   |   | popFail
-|   |   |   | | | |   |   |   |   | | |       |   |   | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |   |   | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |   |   <handler>
 |   |   |   | | | |   |   |   |   | | |       |   |     pushInput
 |   |   |   | | | |   |   |   |   | | |       |   |     lift Term
@@ -456,9 +456,9 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       |   |       | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |   |       | read Term
 |   |   |   | | | |   |   |   |   | | |       |   |       | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |   |       | call name_28
+|   |   |   | | | |   |   |   |   | | |       |   |       | call name_10
 |   |   |   | | | |   |   |   |   | | |       |   |       | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |   |       | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |   |       | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |   |       <default>
 |   |   |   | | | |   |   |   |   | | |       |   |         fail
 |   |   |   | | | |   |   |   |   | | |       |   <handler>
@@ -467,47 +467,47 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       |     choices [(\u1 -> u1)]
 |   |   |   | | | |   |   |   |   | | |       |       <branch>
 |   |   |   | | | |   |   |   |   | | |       |       | push (\u1 -> (\u2 -> u2))
-|   |   |   | | | |   |   |   |   | | |       |       | call name_22
+|   |   |   | | | |   |   |   |   | | |       |       | call name_28
 |   |   |   | | | |   |   |   |   | | |       |       | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       | join_55:
+|   |   |   | | | |   |   |   |   | | |       |       | join_46:
 |   |   |   | | | |   |   |   |   | | |       |       | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |       | | ret
 |   |   |   | | | |   |   |   |   | | |       |       | catchFail
 |   |   |   | | | |   |   |   |   | | |       |       |   <try>
 |   |   |   | | | |   |   |   |   | | |       |       |   | push (\u1 -> Term)
-|   |   |   | | | |   |   |   |   | | |       |       |   | join_55:
+|   |   |   | | | |   |   |   |   | | |       |       |   | join_46:
 |   |   |   | | | |   |   |   |   | | |       |       |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |       |   | | popFail
-|   |   |   | | | |   |   |   |   | | |       |       |   | | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |       |   | | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |       |   | catchFail
 |   |   |   | | | |   |   |   |   | | |       |       |   |   <try>
 |   |   |   | | | |   |   |   |   | | |       |       |   |   | push (\u1 -> (\u2 -> (\u3 -> u2)))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   | call name_15
+|   |   |   | | | |   |   |   |   | | |       |       |   |   | call name_22
 |   |   |   | | | |   |   |   |   | | |       |       |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   | join_55:
+|   |   |   | | | |   |   |   |   | | |       |       |   |   | join_46:
 |   |   |   | | | |   |   |   |   | | |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   | | call name_10
+|   |   |   | | | |   |   |   |   | | |       |       |   |   | | call name_16
 |   |   |   | | | |   |   |   |   | | |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |       |   |   | | popFail
-|   |   |   | | | |   |   |   |   | | |       |       |   |   | | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |       |   |   | | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |       |   |   | catchFail
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   <try>
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> Term))))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_25
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_1
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_28
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_10
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | name_13:
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | name_20:
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | | catchFail
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   <try>
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_16
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_23
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_30
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_5
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_25
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_1
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_13
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | call name_20
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | popFail
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |   | ret
@@ -520,19 +520,19 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |       | ret
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |       <default>
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | |         fail
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_13
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_20
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_28
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | call name_10
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   | popFail
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |   | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |   <handler>
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |     pushInput
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |     lift Term
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |     choices [(\u1 -> u1)]
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |       <branch>
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |       | call name_28
-|   |   |   | | | |   |   |   |   | | |       |       |   |   |       | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |       | call name_10
+|   |   |   | | | |   |   |   |   | | |       |       |   |   |       | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |       <default>
 |   |   |   | | | |   |   |   |   | | |       |       |   |   |         fail
 |   |   |   | | | |   |   |   |   | | |       |       |   |   <handler>
@@ -540,8 +540,8 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       |       |   |     lift Term
 |   |   |   | | | |   |   |   |   | | |       |       |   |     choices [(\u1 -> u1)]
 |   |   |   | | | |   |   |   |   | | |       |       |   |       <branch>
-|   |   |   | | | |   |   |   |   | | |       |       |   |       | call name_12
-|   |   |   | | | |   |   |   |   | | |       |       |   |       | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |       |   |       | call name_18
+|   |   |   | | | |   |   |   |   | | |       |       |   |       | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |       |   |       <default>
 |   |   |   | | | |   |   |   |   | | |       |       |   |         fail
 |   |   |   | | | |   |   |   |   | | |       |       |   <handler>
@@ -549,29 +549,29 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       |       |     lift Term
 |   |   |   | | | |   |   |   |   | | |       |       |     choices [(\u1 -> u1)]
 |   |   |   | | | |   |   |   |   | | |       |       |       <branch>
-|   |   |   | | | |   |   |   |   | | |       |       |       | call name_28
-|   |   |   | | | |   |   |   |   | | |       |       |       | refJoin join_55
+|   |   |   | | | |   |   |   |   | | |       |       |       | call name_10
+|   |   |   | | | |   |   |   |   | | |       |       |       | refJoin join_46
 |   |   |   | | | |   |   |   |   | | |       |       |       <default>
 |   |   |   | | | |   |   |   |   | | |       |       |         fail
 |   |   |   | | | |   |   |   |   | | |       |       <default>
 |   |   |   | | | |   |   |   |   | | |       |         fail
 |   |   |   | | | |   |   |   |   | | |       <default>
 |   |   |   | | | |   |   |   |   | | |         fail
-|   |   |   | | | |   |   |   |   | | call name_20
+|   |   |   | | | |   |   |   |   | | call name_27
 |   |   |   | | | |   |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | call name_28
+|   |   |   | | | |   |   |   |   | | call name_10
 |   |   |   | | | |   |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | name_8:
+|   |   |   | | | |   |   |   |   | | name_13:
 |   |   |   | | | |   |   |   |   | | | catchFail
 |   |   |   | | | |   |   |   |   | | |   <try>
 |   |   |   | | | |   |   |   |   | | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> u4 u5)))))
 |   |   |   | | | |   |   |   |   | | |   | read ('!' ==)
 |   |   |   | | | |   |   |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |   | call name_17
+|   |   |   | | | |   |   |   |   | | |   | call name_26
 |   |   |   | | | |   |   |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |   | call name_20
+|   |   |   | | | |   |   |   |   | | |   | call name_27
 |   |   |   | | | |   |   |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | |   | call name_8
+|   |   |   | | | |   |   |   |   | | |   | call name_13
 |   |   |   | | | |   |   |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | |   | popFail
 |   |   |   | | | |   |   |   |   | | |   | ret
@@ -584,19 +584,19 @@ name_5:
 |   |   |   | | | |   |   |   |   | | |       | ret
 |   |   |   | | | |   |   |   |   | | |       <default>
 |   |   |   | | | |   |   |   |   | | |         fail
-|   |   |   | | | |   |   |   |   | | call name_8
+|   |   |   | | | |   |   |   |   | | call name_13
 |   |   |   | | | |   |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | | call name_28
+|   |   |   | | | |   |   |   |   | | call name_10
 |   |   |   | | | |   |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | ret
-|   |   |   | | | |   |   |   |   | call name_25
+|   |   |   | | | |   |   |   |   | call name_1
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | call name_23
+|   |   |   | | | |   |   |   |   | call name_29
 |   |   |   | | | |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   | join_55:
+|   |   |   | | | |   |   |   |   | join_46:
 |   |   |   | | | |   |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   | | popFail
-|   |   |   | | | |   |   |   |   | | refJoin join_55
+|   |   |   | | | |   |   |   |   | | refJoin join_46
 |   |   |   | | | |   |   |   |   | catchFail
 |   |   |   | | | |   |   |   |   |   <try>
 |   |   |   | | | |   |   |   |   |   | push (\u1 -> (\u2 -> (\u3 -> Term)))
@@ -614,20 +614,20 @@ name_5:
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   |   |   |   | read ('e' ==)
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   |   |   |   | call name_29
+|   |   |   | | | |   |   |   |   |   |   |   | call name_4
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   |   |   |   | popFail
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   |   |   |   | call name_26
+|   |   |   | | | |   |   |   |   |   |   |   | call name_2
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   |   |   |   | popFail
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   |   |   |   | call name_17
+|   |   |   | | | |   |   |   |   |   |   |   | call name_26
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |   |   |   |   |   |   | call name_23
+|   |   |   | | | |   |   |   |   |   |   |   | call name_29
 |   |   |   | | | |   |   |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |   |   |   |   |   |   | popFail
-|   |   |   | | | |   |   |   |   |   |   |   | refJoin join_55
+|   |   |   | | | |   |   |   |   |   |   |   | refJoin join_46
 |   |   |   | | | |   |   |   |   |   |   |   <handler>
 |   |   |   | | | |   |   |   |   |   |   |     loadInput
 |   |   |   | | | |   |   |   |   |   |   |     fail
@@ -639,8 +639,8 @@ name_5:
 |   |   |   | | | |   |   |   |   |     lift Term
 |   |   |   | | | |   |   |   |   |     choices [(\u1 -> u1)]
 |   |   |   | | | |   |   |   |   |       <branch>
-|   |   |   | | | |   |   |   |   |       | call name_28
-|   |   |   | | | |   |   |   |   |       | refJoin join_55
+|   |   |   | | | |   |   |   |   |       | call name_10
+|   |   |   | | | |   |   |   |   |       | refJoin join_46
 |   |   |   | | | |   |   |   |   |       <default>
 |   |   |   | | | |   |   |   |   |         fail
 |   |   |   | | | |   |   |   |   <handler>
@@ -673,22 +673,22 @@ name_5:
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |   |   |   | read ('e' ==)
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |   |   |   | call name_29
+|   |   |   | | | |   |       |   |   |   | call name_4
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |   |   |   | popFail
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |   |   |   | call name_26
+|   |   |   | | | |   |       |   |   |   | call name_2
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |   |   |   | popFail
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |   |   |   | call name_17
+|   |   |   | | | |   |       |   |   |   | call name_26
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |   |   |   | call name_25
+|   |   |   | | | |   |       |   |   |   | call name_1
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |   |   |   | call name_23
+|   |   |   | | | |   |       |   |   |   | call name_29
 |   |   |   | | | |   |       |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |   |   |   | popFail
-|   |   |   | | | |   |       |   |   |   | refJoin join_55
+|   |   |   | | | |   |       |   |   |   | refJoin join_46
 |   |   |   | | | |   |       |   |   |   <handler>
 |   |   |   | | | |   |       |   |   |     loadInput
 |   |   |   | | | |   |       |   |   |     fail
@@ -705,24 +705,24 @@ name_5:
 |   |   |   | | | |   |       |       |   | catchFail
 |   |   |   | | | |   |       |       |   |   <try>
 |   |   |   | | | |   |       |       |   |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (\u6 -> (\u7 -> (\u8 -> (\u9 -> (\u10 -> (\u11 -> (\u12 -> u11))))))))))))
-|   |   |   | | | |   |       |       |   |   | join_55:
+|   |   |   | | | |   |       |       |   |   | join_46:
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | call name_27
+|   |   |   | | | |   |       |       |   |   | | call name_3
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | call name_28
+|   |   |   | | | |   |       |       |   |   | | call name_10
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | name_3:
+|   |   |   | | | |   |       |       |   |   | | name_8:
 |   |   |   | | | |   |       |       |   |   | | | catchFail
 |   |   |   | | | |   |       |       |   |   | | |   <try>
 |   |   |   | | | |   |       |       |   |   | | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-|   |   |   | | | |   |       |       |   |   | | |   | call name_16
-|   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | |   | call name_30
+|   |   |   | | | |   |       |       |   |   | | |   | call name_23
 |   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | |   | call name_27
+|   |   |   | | | |   |       |       |   |   | | |   | call name_5
 |   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   | | |   | call name_3
 |   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
+|   |   |   | | | |   |       |       |   |   | | |   | call name_8
+|   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   | | |   | popFail
 |   |   |   | | | |   |       |       |   |   | | |   | ret
 |   |   |   | | | |   |       |       |   |   | | |   <handler>
@@ -734,30 +734,30 @@ name_5:
 |   |   |   | | | |   |       |       |   |   | | |       | ret
 |   |   |   | | | |   |       |       |   |   | | |       <default>
 |   |   |   | | | |   |       |       |   |   | | |         fail
-|   |   |   | | | |   |       |       |   |   | | call name_3
+|   |   |   | | | |   |       |       |   |   | | call name_8
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | call name_28
+|   |   |   | | | |   |       |       |   |   | | call name_10
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   | | read ('=' ==)
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | call name_17
+|   |   |   | | | |   |       |       |   |   | | call name_26
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | call name_25
+|   |   |   | | | |   |       |       |   |   | | call name_1
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | call name_28
+|   |   |   | | | |   |       |       |   |   | | call name_10
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | name_1:
+|   |   |   | | | |   |       |       |   |   | | name_6:
 |   |   |   | | | |   |       |       |   |   | | | catchFail
 |   |   |   | | | |   |       |       |   |   | | |   <try>
 |   |   |   | | | |   |       |       |   |   | | |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> (\u5 -> (u1 u3) (u4 u5))))))
-|   |   |   | | | |   |       |       |   |   | | |   | call name_16
+|   |   |   | | | |   |       |       |   |   | | |   | call name_23
 |   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | |   | call name_30
-|   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | |   | call name_25
+|   |   |   | | | |   |       |       |   |   | | |   | call name_5
 |   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   | | |   | call name_1
 |   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
+|   |   |   | | | |   |       |       |   |   | | |   | call name_6
+|   |   |   | | | |   |       |       |   |   | | |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   | | |   | popFail
 |   |   |   | | | |   |       |       |   |   | | |   | ret
 |   |   |   | | | |   |       |       |   |   | | |   <handler>
@@ -769,22 +769,22 @@ name_5:
 |   |   |   | | | |   |       |       |   |   | | |       | ret
 |   |   |   | | | |   |       |       |   |   | | |       <default>
 |   |   |   | | | |   |       |       |   |   | | |         fail
-|   |   |   | | | |   |       |       |   |   | | call name_1
+|   |   |   | | | |   |       |       |   |   | | call name_6
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | call name_28
+|   |   |   | | | |   |       |       |   |   | | call name_10
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | name_11:
+|   |   |   | | | |   |       |       |   |   | | name_17:
 |   |   |   | | | |   |       |       |   |   | | | push (\u1 -> (\u2 -> ';'))
 |   |   |   | | | |   |       |       |   |   | | | read (';' ==)
 |   |   |   | | | |   |       |       |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   | | | call name_17
+|   |   |   | | | |   |       |       |   |   | | | call name_26
 |   |   |   | | | |   |       |       |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   | | | ret
-|   |   |   | | | |   |       |       |   |   | | call name_11
+|   |   |   | | | |   |       |       |   |   | | call name_17
 |   |   |   | | | |   |       |       |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   | | popFail
 |   |   |   | | | |   |       |       |   |   | | popFail
-|   |   |   | | | |   |       |       |   |   | | refJoin join_55
+|   |   |   | | | |   |       |       |   |   | | refJoin join_46
 |   |   |   | | | |   |       |       |   |   | catchFail
 |   |   |   | | | |   |       |       |   |   |   <try>
 |   |   |   | | | |   |       |       |   |   |   | push (\u1 -> (\u2 -> Term))
@@ -800,18 +800,18 @@ name_5:
 |   |   |   | | | |   |       |       |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   |   |   |   | read ('r' ==)
 |   |   |   | | | |   |       |       |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   |   |   |   | call name_29
+|   |   |   | | | |   |       |       |   |   |   |   |   | call name_4
 |   |   |   | | | |   |       |       |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   |   |   |   | popFail
 |   |   |   | | | |   |       |       |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   |   |   |   | call name_26
+|   |   |   | | | |   |       |       |   |   |   |   |   | call name_2
 |   |   |   | | | |   |       |       |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   |   |   |   | popFail
 |   |   |   | | | |   |       |       |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |   |   |   |   |   | call name_17
+|   |   |   | | | |   |       |       |   |   |   |   |   | call name_26
 |   |   |   | | | |   |       |       |   |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | |   |       |       |   |   |   |   |   | popFail
-|   |   |   | | | |   |       |       |   |   |   |   |   | refJoin join_55
+|   |   |   | | | |   |       |       |   |   |   |   |   | refJoin join_46
 |   |   |   | | | |   |       |       |   |   |   |   |   <handler>
 |   |   |   | | | |   |       |       |   |   |   |   |     loadInput
 |   |   |   | | | |   |       |       |   |   |   |   |     fail
@@ -823,8 +823,8 @@ name_5:
 |   |   |   | | | |   |       |       |   |   |     lift Term
 |   |   |   | | | |   |       |       |   |   |     choices [(\u1 -> u1)]
 |   |   |   | | | |   |       |       |   |   |       <branch>
-|   |   |   | | | |   |       |       |   |   |       | call name_28
-|   |   |   | | | |   |       |       |   |   |       | refJoin join_55
+|   |   |   | | | |   |       |       |   |   |       | call name_10
+|   |   |   | | | |   |       |       |   |   |       | refJoin join_46
 |   |   |   | | | |   |       |       |   |   |       <default>
 |   |   |   | | | |   |       |       |   |   |         fail
 |   |   |   | | | |   |       |       |   |   <handler>
@@ -836,11 +836,11 @@ name_5:
 |   |   |   | | | |   |       |       |     choices [(\u1 -> u1)]
 |   |   |   | | | |   |       |       |       <branch>
 |   |   |   | | | |   |       |       |       | push (\u1 -> (\u2 -> u1))
-|   |   |   | | | |   |       |       |       | call name_25
+|   |   |   | | | |   |       |       |       | call name_1
 |   |   |   | | | |   |       |       |       | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |       | call name_11
+|   |   |   | | | |   |       |       |       | call name_17
 |   |   |   | | | |   |       |       |       | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | |   |       |       |       | refJoin join_55
+|   |   |   | | | |   |       |       |       | refJoin join_46
 |   |   |   | | | |   |       |       |       <default>
 |   |   |   | | | |   |       |       |         fail
 |   |   |   | | | |   |       |       <default>
@@ -856,18 +856,18 @@ name_5:
 |   |   |   | | | |       | ret
 |   |   |   | | | |       <default>
 |   |   |   | | | |         fail
-|   |   |   | | | call name_9
+|   |   |   | | | call name_15
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | call name_28
+|   |   |   | | | call name_10
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | read ('}' ==)
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | | call name_17
+|   |   |   | | | call name_26
 |   |   |   | | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | | ret
-|   |   |   | | call name_23
+|   |   |   | | call name_29
 |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   | | call name_5
+|   |   |   | | call name_12
 |   |   |   | | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   | | popFail
 |   |   |   | | ret
@@ -876,19 +876,19 @@ name_5:
 |   |   |   |   | push (\u1 -> (\u2 -> (\u3 -> Term)))
 |   |   |   |   | read (':' ==)
 |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   |   | call name_17
+|   |   |   |   | call name_26
 |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
-|   |   |   |   | call name_19
+|   |   |   |   | call name_25
 |   |   |   |   | lift (\u1 -> (\u2 -> u1 u2))
 |   |   |   |   | popFail
-|   |   |   |   | refJoin join_55
+|   |   |   |   | refJoin join_46
 |   |   |   |   <handler>
 |   |   |   |     pushInput
 |   |   |   |     lift Term
 |   |   |   |     choices [(\u1 -> u1)]
 |   |   |   |       <branch>
-|   |   |   |       | call name_28
-|   |   |   |       | refJoin join_55
+|   |   |   |       | call name_10
+|   |   |   |       | refJoin join_46
 |   |   |   |       <default>
 |   |   |   |         fail
 |   |   |   <handler>
@@ -906,11 +906,11 @@ name_5:
 |       | ret
 |       <default>
 |         fail
-call name_5
+call name_12
 lift (\u1 -> (\u2 -> u1 u2))
-call name_28
+call name_10
 lift (\u1 -> (\u2 -> u1 u2))
-join_55:
+join_46:
 | lift (\u1 -> (\u2 -> u1 u2))
 | ret
 catchFail
@@ -927,7 +927,7 @@ catchFail
   |     loadInput
   |     push Term
   |     popFail
-  |     refJoin join_55
+  |     refJoin join_46
   <handler>
     pushInput
     lift Term
index 87f95946d54e994ba776f378c5a1494a8f15b55d..84cbe8b3529d8b55aeecc81342f3a66c05a774c8 100644 (file)
@@ -1,5 +1,5 @@
 push (\u1 -> (\u2 -> u1 : u2 Term))
-name_1:
+name_2:
 | catchFail
 |   <try>
 |   | push (\u1 -> (\u2 -> (\u3 -> (\u4 -> 'a' : ('b' : ('c' : ('d' : Term)))))))
@@ -16,16 +16,16 @@ name_1:
 |   <handler>
 |     loadInput
 |     fail
-call name_1
+call name_2
 lift (\u1 -> (\u2 -> u1 u2))
-name_2:
+name_1:
 | catchFail
 |   <try>
 |   | push (\u1 -> (\u2 -> (\u3 -> u1 : u2 u3)))
-|   | call name_1
-|   | lift (\u1 -> (\u2 -> u1 u2))
 |   | call name_2
 |   | lift (\u1 -> (\u2 -> u1 u2))
+|   | call name_1
+|   | lift (\u1 -> (\u2 -> u1 u2))
 |   | popFail
 |   | ret
 |   <handler>
@@ -37,6 +37,6 @@ name_2:
 |       | ret
 |       <default>
 |         fail
-call name_2
+call name_1
 lift (\u1 -> (\u2 -> u1 u2))
 ret
index 89aac7b5174e4917aa819de6dc5b5f3ae43c8658..491af08f3c1ec128b5e807cd0bc50632a5e9870a 100644 (file)
@@ -26,12 +26,14 @@ data BrainFuckOp
 haskell :: TH.Lift a => a -> P.TermGrammar a
 haskell a = H.Term (H.ValueCode a [||a||])
 
-brainfuck :: forall repr. P.Satisfiable repr Char => P.Grammar repr => repr [BrainFuckOp]
+brainfuck :: forall repr.
+  P.Grammar Char repr =>
+  repr [BrainFuckOp]
 brainfuck = whitespace P.*> bf
   where
   whitespace = P.skipMany (P.noneOf "<>+-[],.$")
   lexeme p = p P.<* whitespace
-  bf :: P.Grammar repr => repr [BrainFuckOp]
+  bf :: repr [BrainFuckOp]
   bf = P.many (lexeme (P.match (P.look P.anyChar) (haskell Prelude.<$> "><+-.,[") op P.empty))
   op :: H.Term H.ValueCode Char -> repr BrainFuckOp
   op (trans -> H.ValueCode c _) = case c of
index 8b11f8659ba2481bdee4c46104de67e85e41491e..fabf1e8e0944c8ede7e28234c6531ecdcd4cd001 100644 (file)
@@ -51,8 +51,7 @@ nandStringLetter :: Char -> Bool
 nandStringLetter c = (c /= '"') && (c /= '\\') && (c > '\026')
 
 nandlang :: forall repr.
-  P.Grammar repr =>
-  P.Satisfiable repr Char =>
+  P.Grammar Char repr =>
   repr ()
 nandlang = whitespace P.*> P.skipMany funcdef P.<* P.eof
   where