packages feed

Sit (empty) → 0.2017.2.26

raw patch · 28 files changed

+5496/−0 lines, 28 filesdep +arraydep +basedep +containerssetup-changed

Dependencies added: array, base, containers, data-lens-light, mtl

Files

+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2017 Anonymous++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Makefile view
@@ -0,0 +1,10 @@+# Makefile for Sit++default :+	cabal install --only-dependencies+	cabal configure+	cabal build+	dist/build/Sit.bin/Sit.bin test/Test.agda++install :+	cabal install
+ README.md view
@@ -0,0 +1,88 @@+# Sit: size-irrelevant types+A prototype dependently-typed language with sized natural numbers++Sit parses and typechecks `.agda` that conform to the Sit language syntax.++Syntax (excerpt):+```agda+--- Lexical stuff++--- Single line comment+{- Block comment -}+--;               --- End of declaration (mandatory)+f_x'1             --- identifiers start with a letter, then have letters, digits, _ and '++--- Declarations++x : T --;         --- type signature+x = t --;         --- definition+open import M --; --- ignored, for Agda compatibility++--- Sit specifics++oo                --- infinity size+i + 1             --- successor size++Nat a             --- type of natural numbers below size a+zero a            --- number zero (a is size annotation)+suc a n           --- successor of n (a is size annotation)++forall .i  -> T   --- irrelevant size quantification+forall ..i -> T   --- relevant size quantification++fix T t n         --- recursive function over natural numbers+                  ---   T: return type+                  ---   t: functional+                  ---   n: natural number argument++\{ (zero _) -> t; (suc _ x) -> u }   --- case distinction function++--- Inherited Agda syntax++U -> T            --- non-dependent function type+(x y z : U) -> T  --- dependent function type+\ x y z -> t      --- lambda-abstraction+t u               --- application++Set               --- first universe+Set1              --- second universe+Set a             --- universe of level a++```++## Limitations++Sit only understands a tiny subset of the Agda language.+Sit does not understand layout, instead each declaration has to be terminated with+comment `--;`.++## Installation++Requires GHC and cabal, for instance via the Haskell Platform.+In a shell, type+```+  cabal install+```++## Test++In a shell, type+```+  Sit.bin test/Test.agda+```++## Example++This is the addition function in Sit:+```+--- Addition of natural numbers++plus : forall .i -> Nat i -> Nat oo -> Nat oo   --;+plus = \ i x y ->+  fix (\ i x -> Nat oo)+      (\ _ f -> \+        { (zero _)  -> y+        ; (suc _ x) -> suc oo (f x)+        })+      x+```
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ Sit.cabal view
@@ -0,0 +1,75 @@+name:            Sit+version:         0.2017.02.26+build-type:      Simple+cabal-version:   >= 1.8+license:         OtherLicense+license-file:    LICENSE+author:          Anonymous+maintainer:      Anonymous+homepage:        NONE+category:        Dependent types+synopsis:        Prototypical type checker for Type Theory with Sized Natural Numbers+description:+  Sit = Size-irrelevant types+  .+  Sit is a prototypical language with an Agda-compatible syntax.+  It has dependent function types, universes, sized natural numbers,+  and case and recursion over natural numbers.+  There is a relevant and an irrelevant quantifier over sizes.+  For an example, see file test/Test.agda++tested-with:        GHC == 7.8.4+                    GHC == 7.10.3+                    GHC == 8.0.1++data-files:         test/Makefile+                    test/Base.agda+                    test/Test.agda+                    README.md++extra-source-files: Makefile+                    src/Makefile+                    src/Sit.cf+                    src/undefined.h++source-repository head+  type:     git+  location: NONE++executable Sit.bin+  ghc-options:      -rtsopts+  hs-source-dirs:   src++  build-depends:    array >= 0.3 && < 1.0,+                    base >= 4.2 && < 5.0,+                    containers >= 0.3 && < 1.0,+                    data-lens-light >= 0.1.2.2 && < 0.2,+                    mtl >= 2.2.1 && < 3.0++--  -- The lexer and parser are shipped as .hs files, thus, no tools necessary.+--  build-tools:      happy >= 1.15 && < 2,+--                    alex >= 3.0 && < 4++  extensions:       MultiParamTypeClasses+                    FunctionalDependencies+                    TypeSynonymInstances+                    FlexibleInstances+                    FlexibleContexts+                    GeneralizedNewtypeDeriving+                    LambdaCase+                    TupleSections++  main-is:          Sit.hs++  other-modules:    Abstract+                    Evaluation+                    Impossible+                    Internal+                    Lens+                    Substitute+                    TypeChecker+                    Sit.Abs+                    Sit.ErrM+                    Sit.Lex+                    Sit.Par+                    Sit.Print
+ dist/build/Sit.bin/Sit.bin-tmp/Sit/Lex.hs view
@@ -0,0 +1,423 @@+{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-missing-signatures #-}+{-# LANGUAGE CPP,MagicHash #-}+{-# LINE 3 "src/Sit/Lex.x" #-}++{-# OPTIONS -fno-warn-incomplete-patterns #-}+{-# OPTIONS_GHC -w #-}+module Sit.Lex where++++import qualified Data.Bits+import Data.Word (Word8)+import Data.Char (ord)++#if __GLASGOW_HASKELL__ >= 603+#include "ghcconfig.h"+#elif defined(__GLASGOW_HASKELL__)+#include "config.h"+#endif+#if __GLASGOW_HASKELL__ >= 503+import Data.Array+import Data.Array.Base (unsafeAt)+#else+import Array+#endif+#if __GLASGOW_HASKELL__ >= 503+import GHC.Exts+#else+import GlaExts+#endif+alex_tab_size :: Int+alex_tab_size = 8+alex_base :: AlexAddr+alex_base = AlexA# "\xf8\xff\xff\xff\xd9\xff\xff\xff\x47\x00\x00\x00\xc7\x00\x00\x00\x9a\x01\x00\x00\x1a\x02\x00\x00\x1a\x03\x00\x00\xb6\xff\xff\xff\x00\x00\x00\x00\x0b\x03\x00\x00\x00\x00\x00\x00\x09\x01\x00\x00\x8b\x03\x00\x00\xdb\xff\xff\xff\x4b\x04\x00\x00\x0b\x04\x00\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\xda\xff\xff\xff\x00\x00\x00\x00\xdc\xff\xff\xff\xda\x05\x00\x00\xd9\x01\x00\x00"#++alex_table :: AlexAddr+alex_table = AlexA# "\x00\x00\x13\x00\x13\x00\x13\x00\x13\x00\x13\x00\x11\x00\x04\x00\x01\x00\x00\x00\x15\x00\x13\x00\x13\x00\x13\x00\x13\x00\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x13\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x13\x00\x15\x00\x00\x00\x0d\x00\x16\x00\x00\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x15\x00\x15\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x15\x00\x00\x00\x00\x00\x15\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x14\x00\x02\x00\x15\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\x07\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0e\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x02\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\x07\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0e\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x0f\x00\x03\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0b\x00\x05\x00\x08\x00\x08\x00\x08\x00\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++alex_check :: AlexAddr+alex_check = AlexA# "\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x2d\x00\x2d\x00\x2d\x00\xff\xff\x2e\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\x20\x00\x3e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\x20\x00\x2b\x00\xff\xff\x2d\x00\x2e\x00\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\x5c\x00\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x2d\x00\x7d\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc3\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7d\x00\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x2d\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\xff\xff\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xff\xff\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc3\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++alex_deflt :: AlexAddr+alex_deflt = AlexA# "\xff\xff\xff\xff\x04\x00\xff\xff\x04\x00\xff\xff\x04\x00\x04\x00\x0a\x00\x0a\x00\x10\x00\x10\x00\xff\xff\xff\xff\x11\x00\x11\x00\x11\x00\x11\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++alex_accept = listArray (0::Int,24) [AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccSkip,AlexAccSkip,AlexAccSkip,AlexAcc (alex_action_3),AlexAcc (alex_action_3),AlexAcc (alex_action_3),AlexAcc (alex_action_4),AlexAcc (alex_action_5)]+{-# LINE 39 "src/Sit/Lex.x" #-}+++tok :: (Posn -> String -> Token) -> (Posn -> String -> Token)+tok f p s = f p s++share :: String -> String+share = id++data Tok =+   TS !String !Int    -- reserved words and symbols+ | TL !String         -- string literals+ | TI !String         -- integer literals+ | TV !String         -- identifiers+ | TD !String         -- double precision float literals+ | TC !String         -- character literals++ deriving (Eq,Show,Ord)++data Token =+   PT  Posn Tok+ | Err Posn+  deriving (Eq,Show,Ord)++printPosn :: Posn -> String+printPosn (Pn _ l c) = "line " ++ show l ++ ", column " ++ show c++tokenPos :: [Token] -> String+tokenPos (t:_) = printPosn (tokenPosn t)+tokenPos [] = "end of file"++tokenPosn :: Token -> Posn+tokenPosn (PT p _) = p+tokenPosn (Err p) = p++tokenLineCol :: Token -> (Int, Int)+tokenLineCol = posLineCol . tokenPosn++posLineCol :: Posn -> (Int, Int)+posLineCol (Pn _ l c) = (l,c)++mkPosToken :: Token -> ((Int, Int), String)+mkPosToken t@(PT p _) = (posLineCol p, prToken t)++prToken :: Token -> String+prToken t = case t of+  PT _ (TS s _) -> s+  PT _ (TL s)   -> show s+  PT _ (TI s)   -> s+  PT _ (TV s)   -> s+  PT _ (TD s)   -> s+  PT _ (TC s)   -> s+  Err _         -> "#error"+++data BTree = N | B String Tok BTree BTree deriving (Show)++eitherResIdent :: (String -> Tok) -> String -> Tok+eitherResIdent tv s = treeFind resWords+  where+  treeFind N = tv s+  treeFind (B a t left right) | s < a  = treeFind left+                              | s > a  = treeFind right+                              | s == a = t++resWords :: BTree+resWords = b "\\" 16 (b ":" 8 (b "--;" 4 (b ")" 2 (b "(" 1 N N) (b "+" 3 N N)) (b "." 6 (b "->" 5 N N) (b ".." 7 N N))) (b "Set" 12 (b "=" 10 (b ";" 9 N N) (b "Nat" 11 N N)) (b "Set2" 14 (b "Set1" 13 N N) (b "Size" 15 N N)))) (b "of" 24 (b "forall" 20 (b "case" 18 (b "_" 17 N N) (b "fix" 19 N N)) (b "lsuc" 22 (b "import" 21 N N) (b "lzero" 23 N N))) (b "suc" 28 (b "open" 26 (b "oo" 25 N N) (b "return" 27 N N)) (b "{" 30 (b "zero" 29 N N) (b "}" 31 N N))))+   where b s n = let bs = id s+                  in B bs (TS bs n)++unescapeInitTail :: String -> String+unescapeInitTail = id . unesc . tail . id where+  unesc s = case s of+    '\\':c:cs | elem c ['\"', '\\', '\''] -> c : unesc cs+    '\\':'n':cs  -> '\n' : unesc cs+    '\\':'t':cs  -> '\t' : unesc cs+    '"':[]    -> []+    c:cs      -> c : unesc cs+    _         -> []++-------------------------------------------------------------------+-- Alex wrapper code.+-- A modified "posn" wrapper.+-------------------------------------------------------------------++data Posn = Pn !Int !Int !Int+      deriving (Eq, Show,Ord)++alexStartPos :: Posn+alexStartPos = Pn 0 1 1++alexMove :: Posn -> Char -> Posn+alexMove (Pn a l c) '\t' = Pn (a+1)  l     (((c+7) `div` 8)*8+1)+alexMove (Pn a l c) '\n' = Pn (a+1) (l+1)   1+alexMove (Pn a l c) _    = Pn (a+1)  l     (c+1)++type Byte = Word8++type AlexInput = (Posn,     -- current position,+                  Char,     -- previous char+                  [Byte],   -- pending bytes on the current char+                  String)   -- current input string++tokens :: String -> [Token]+tokens str = go (alexStartPos, '\n', [], str)+    where+      go :: AlexInput -> [Token]+      go inp@(pos, _, _, str) =+               case alexScan inp 0 of+                AlexEOF                   -> []+                AlexError (pos, _, _, _)  -> [Err pos]+                AlexSkip  inp' len        -> go inp'+                AlexToken inp' len act    -> act pos (take len str) : (go inp')++alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)+alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))+alexGetByte (p, _, [], s) =+  case  s of+    []  -> Nothing+    (c:s) ->+             let p'     = alexMove p c+                 (b:bs) = utf8Encode c+              in p' `seq` Just (b, (p', c, bs, s))++alexInputPrevChar :: AlexInput -> Char+alexInputPrevChar (p, c, bs, s) = c++-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.+utf8Encode :: Char -> [Word8]+utf8Encode = map fromIntegral . go . ord+ where+  go oc+   | oc <= 0x7f       = [oc]++   | oc <= 0x7ff      = [ 0xc0 + (oc `Data.Bits.shiftR` 6)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]++   | oc <= 0xffff     = [ 0xe0 + (oc `Data.Bits.shiftR` 12)+                        , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]+   | otherwise        = [ 0xf0 + (oc `Data.Bits.shiftR` 18)+                        , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)+                        , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]++alex_action_3 =  tok (\p s -> PT p (eitherResIdent (TV . share) s)) +alex_action_4 =  tok (\p s -> PT p (eitherResIdent (TV . share) s)) +alex_action_5 =  tok (\p s -> PT p (TI $ share s))    +{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<built-in>" #-}+{-# LINE 1 "<command-line>" #-}+{-# LINE 9 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4++# 17 "/usr/include/stdc-predef.h" 3 4+++++++++++++++++++++++++++++++++++++++++++{-# LINE 9 "<command-line>" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+-- -----------------------------------------------------------------------------+-- ALEX TEMPLATE+--+-- This code is in the PUBLIC DOMAIN; you may copy it freely and use+-- it for any purpose whatsoever.++-- -----------------------------------------------------------------------------+-- INTERNALS and main scanner engine++{-# LINE 21 "templates/GenericTemplate.hs" #-}++++++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define GTE(n,m) (tagToEnum# (n >=# m))+#define EQ(n,m) (tagToEnum# (n ==# m))+#else+#define GTE(n,m) (n >=# m)+#define EQ(n,m) (n ==# m)+#endif+{-# LINE 51 "templates/GenericTemplate.hs" #-}+++data AlexAddr = AlexA# Addr#+-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ < 503+uncheckedShiftL# = shiftL#+#endif++{-# INLINE alexIndexInt16OffAddr #-}+alexIndexInt16OffAddr (AlexA# arr) off =+#ifdef WORDS_BIGENDIAN+  narrow16Int# i+  where+        i    = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)+        high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+        low  = int2Word# (ord# (indexCharOffAddr# arr off'))+        off' = off *# 2#+#else+  indexInt16OffAddr# arr off+#endif++++++{-# INLINE alexIndexInt32OffAddr #-}+alexIndexInt32OffAddr (AlexA# arr) off = +#ifdef WORDS_BIGENDIAN+  narrow32Int# i+  where+   i    = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`+                     (b2 `uncheckedShiftL#` 16#) `or#`+                     (b1 `uncheckedShiftL#` 8#) `or#` b0)+   b3   = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))+   b2   = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))+   b1   = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+   b0   = int2Word# (ord# (indexCharOffAddr# arr off'))+   off' = off *# 4#+#else+  indexInt32OffAddr# arr off+#endif+++++++#if __GLASGOW_HASKELL__ < 503+quickIndex arr i = arr ! i+#else+-- GHC >= 503, unsafeAt is available from Data.Array.Base.+quickIndex = unsafeAt+#endif+++++-- -----------------------------------------------------------------------------+-- Main lexing routines++data AlexReturn a+  = AlexEOF+  | AlexError  !AlexInput+  | AlexSkip   !AlexInput !Int+  | AlexToken  !AlexInput !Int a++-- alexScan :: AlexInput -> StartCode -> AlexReturn a+alexScan input (I# (sc))+  = alexScanUser undefined input (I# (sc))++alexScanUser user input (I# (sc))+  = case alex_scan_tkn user input 0# input sc AlexNone of+        (AlexNone, input') ->+                case alexGetByte input of+                        Nothing -> ++++                                   AlexEOF+                        Just _ ->++++                                   AlexError input'++        (AlexLastSkip input'' len, _) ->++++                AlexSkip input'' len++        (AlexLastAcc k input''' len, _) ->++++                AlexToken input''' len k+++-- Push the input through the DFA, remembering the most recent accepting+-- state it encountered.++alex_scan_tkn user orig_input len input s last_acc =+  input `seq` -- strict in the input+  let +        new_acc = (check_accs (alex_accept `quickIndex` (I# (s))))+  in+  new_acc `seq`+  case alexGetByte input of+     Nothing -> (new_acc, input)+     Just (c, new_input) -> ++++      case fromIntegral c of { (I# (ord_c)) ->+        let+                base   = alexIndexInt32OffAddr alex_base s+                offset = (base +# ord_c)+                check  = alexIndexInt16OffAddr alex_check offset+                +                new_s = if GTE(offset,0#) && EQ(check,ord_c)+                          then alexIndexInt16OffAddr alex_table offset+                          else alexIndexInt16OffAddr alex_deflt s+        in+        case new_s of+            -1# -> (new_acc, input)+                -- on an error, we want to keep the input *before* the+                -- character that failed, not after.+            _ -> alex_scan_tkn user orig_input (if c < 0x80 || c >= 0xC0 then (len +# 1#) else len)+                                                -- note that the length is increased ONLY if this is the 1st byte in a char encoding)+                        new_input new_s new_acc+      }+  where+        check_accs (AlexAccNone) = last_acc+        check_accs (AlexAcc a  ) = AlexLastAcc a input (I# (len))+        check_accs (AlexAccSkip) = AlexLastSkip  input (I# (len))+{-# LINE 198 "templates/GenericTemplate.hs" #-}++data AlexLastAcc a+  = AlexNone+  | AlexLastAcc a !AlexInput !Int+  | AlexLastSkip  !AlexInput !Int++instance Functor AlexLastAcc where+    fmap _ AlexNone = AlexNone+    fmap f (AlexLastAcc x y z) = AlexLastAcc (f x) y z+    fmap _ (AlexLastSkip x y) = AlexLastSkip x y++data AlexAcc a user+  = AlexAccNone+  | AlexAcc a+  | AlexAccSkip
+ dist/build/Sit.bin/Sit.bin-tmp/Sit/Par.hs view
@@ -0,0 +1,995 @@+{-# OPTIONS_GHC -w #-}+{-# OPTIONS -fglasgow-exts -cpp #-}+{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}+module Sit.Par where+import Sit.Abs+import Sit.Lex+import Sit.ErrM+import qualified Data.Array as Happy_Data_Array+import qualified GHC.Exts as Happy_GHC_Exts+import Control.Applicative(Applicative(..))+import Control.Monad (ap)++-- parser produced by Happy Version 1.19.5++newtype HappyAbsSyn  = HappyAbsSyn HappyAny+#if __GLASGOW_HASKELL__ >= 607+type HappyAny = Happy_GHC_Exts.Any+#else+type HappyAny = forall a . a+#endif+happyIn15 :: (Ident) -> (HappyAbsSyn )+happyIn15 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn15 #-}+happyOut15 :: (HappyAbsSyn ) -> (Ident)+happyOut15 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut15 #-}+happyIn16 :: (Integer) -> (HappyAbsSyn )+happyIn16 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn16 #-}+happyOut16 :: (HappyAbsSyn ) -> (Integer)+happyOut16 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut16 #-}+happyIn17 :: (Prg) -> (HappyAbsSyn )+happyIn17 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn17 #-}+happyOut17 :: (HappyAbsSyn ) -> (Prg)+happyOut17 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut17 #-}+happyIn18 :: (Decl) -> (HappyAbsSyn )+happyIn18 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn18 #-}+happyOut18 :: (HappyAbsSyn ) -> (Decl)+happyOut18 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut18 #-}+happyIn19 :: (QualId) -> (HappyAbsSyn )+happyIn19 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn19 #-}+happyOut19 :: (HappyAbsSyn ) -> (QualId)+happyOut19 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut19 #-}+happyIn20 :: ([Decl]) -> (HappyAbsSyn )+happyIn20 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn20 #-}+happyOut20 :: (HappyAbsSyn ) -> ([Decl])+happyOut20 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut20 #-}+happyIn21 :: (IdU) -> (HappyAbsSyn )+happyIn21 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn21 #-}+happyOut21 :: (HappyAbsSyn ) -> (IdU)+happyOut21 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut21 #-}+happyIn22 :: (Bind) -> (HappyAbsSyn )+happyIn22 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn22 #-}+happyOut22 :: (HappyAbsSyn ) -> (Bind)+happyOut22 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut22 #-}+happyIn23 :: ([Bind]) -> (HappyAbsSyn )+happyIn23 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn23 #-}+happyOut23 :: (HappyAbsSyn ) -> ([Bind])+happyOut23 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut23 #-}+happyIn24 :: ([Ident]) -> (HappyAbsSyn )+happyIn24 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn24 #-}+happyOut24 :: (HappyAbsSyn ) -> ([Ident])+happyOut24 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut24 #-}+happyIn25 :: ([IdU]) -> (HappyAbsSyn )+happyIn25 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn25 #-}+happyOut25 :: (HappyAbsSyn ) -> ([IdU])+happyOut25 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut25 #-}+happyIn26 :: (Exp) -> (HappyAbsSyn )+happyIn26 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn26 #-}+happyOut26 :: (HappyAbsSyn ) -> (Exp)+happyOut26 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut26 #-}+happyIn27 :: (Exp) -> (HappyAbsSyn )+happyIn27 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn27 #-}+happyOut27 :: (HappyAbsSyn ) -> (Exp)+happyOut27 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut27 #-}+happyIn28 :: (Exp) -> (HappyAbsSyn )+happyIn28 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn28 #-}+happyOut28 :: (HappyAbsSyn ) -> (Exp)+happyOut28 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut28 #-}+happyInTok :: (Token) -> (HappyAbsSyn )+happyInTok x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyInTok #-}+happyOutTok :: (HappyAbsSyn ) -> (Token)+happyOutTok x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOutTok #-}+++happyActOffsets :: HappyAddr+happyActOffsets = HappyA# "\x7f\x00\x7f\x00\xf0\x00\x7f\x00\xf0\xff\x04\x00\x04\x00\xf0\x00\xf0\xff\x52\x00\x1a\x00\x52\x00\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xeb\x00\x3b\x00\x1a\x00\xf3\xff\x1a\x00\x04\x00\xeb\x00\xf0\xff\xeb\x00\xea\x00\xe6\x00\x04\x00\xe6\x00\xe7\x00\xe7\x00\xe7\x00\xe4\x00\xe4\x00\x43\x00\x01\x01\xe2\x00\xe1\x00\x00\x00\xfd\xff\xd2\x00\xd2\x00\x00\x00\xd1\x00\xd1\x00\x7f\x00\x1a\x00\x1a\x00\x00\x00\x00\x00\xdd\x00\x00\x00\x00\x00\x00\x00\xee\x00\xc5\x00\xe9\x00\xdc\x00\xf9\x00\x00\x00\xc2\x00\x1a\x00\xe0\x00\x00\x00\x00\x00\x00\x00\x1a\x00\xb7\x00\x1a\x00\x1a\x00\x1a\x00\x1a\x00\x00\x00\x00\x00\x00\x00\xc9\x00\x00\x00\xd0\x00\x00\x00\xb4\x00\x00\x00\xc0\x00\xbf\x00\xbe\x00\xae\x00\x1a\x00\x00\x00\x00\x00\xad\x00\x1a\x00\x00\x00\x1a\x00\x98\x00\x9d\x00\x80\x00\x66\x00\xf0\xff\x6b\x00\x54\x00\x1a\x00\xe8\xff\x00\x00\x00\x00"#++happyGotoOffsets :: HappyAddr+happyGotoOffsets = HappyA# "\x8b\x00\x06\x00\x3f\x00\xbb\x00\x82\x00\x5f\x00\xfb\x00\x38\x00\x50\x00\x61\x00\xec\x00\xef\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\xdb\x00\x2f\x00\xcd\x00\xf8\x00\x00\x00\x16\x00\x00\x00\x34\x00\x00\x00\xf6\x00\x00\x00\x29\x00\x55\x00\x42\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x15\x00\xaa\x00\xca\x00\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\x00\xb9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xab\x00\x00\x00\xa8\x00\x9a\x00\x97\x00\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x86\x00\x00\x00\x00\x00\x00\x00\x78\x00\x00\x00\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x00\x00\x00\x00\x00\x70\x00\x00\x00\x00\x00\x00\x00"#++happyDefActions :: HappyAddr+happyDefActions = HappyA# "\xed\xff\xed\xff\x00\x00\xed\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf3\xff\xe8\xff\xdc\xff\xdd\xff\xc7\xff\x00\x00\x00\x00\xda\xff\xd9\xff\xd8\xff\xd7\xff\xe7\xff\xd4\xff\xd2\xff\xd3\xff\xdb\xff\xd5\xff\xd6\xff\xf2\xff\x00\x00\xc9\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdf\xff\x00\x00\xe1\xff\x00\x00\xe3\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xea\xff\x00\x00\x00\x00\xec\xff\x00\x00\x00\x00\x00\x00\xf1\xff\x00\x00\x00\x00\xed\xff\x00\x00\x00\x00\xe5\xff\xe6\xff\x00\x00\xe2\xff\xe0\xff\xde\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\xff\x00\x00\x00\x00\x00\x00\xd1\xff\xcd\xff\xcb\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xef\xff\xf0\xff\xe9\xff\xee\xff\xeb\xff\x00\x00\xcf\xff\x00\x00\xd0\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\xff\xcc\xff\x00\x00\x00\x00\xce\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xff"#++happyCheck :: HappyAddr+happyCheck = HappyA# "\xff\xff\x11\x00\x01\x00\x06\x00\x11\x00\x01\x00\x00\x00\x1f\x00\x01\x00\x03\x00\x06\x00\x07\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x20\x00\x1e\x00\x11\x00\x20\x00\x13\x00\x00\x00\x00\x00\x16\x00\x17\x00\x04\x00\x19\x00\x01\x00\x06\x00\x1c\x00\x1d\x00\x22\x00\x0a\x00\x20\x00\x21\x00\x22\x00\x00\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x00\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x09\x00\x19\x00\x00\x00\x06\x00\x1c\x00\x1d\x00\x00\x00\x0a\x00\x20\x00\x21\x00\x01\x00\x09\x00\x03\x00\x00\x00\x05\x00\x09\x00\x00\x00\x04\x00\x00\x00\x01\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x06\x00\x08\x00\x11\x00\x0a\x00\x13\x00\x0b\x00\x00\x00\x16\x00\x17\x00\x01\x00\x19\x00\x00\x00\x06\x00\x1c\x00\x1d\x00\x05\x00\x0a\x00\x20\x00\x21\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x00\x00\x01\x00\x11\x00\x00\x00\x13\x00\x07\x00\x06\x00\x16\x00\x17\x00\x06\x00\x19\x00\x0b\x00\x02\x00\x1c\x00\x1d\x00\x00\x00\x01\x00\x20\x00\x21\x00\x00\x00\x01\x00\x06\x00\x11\x00\x00\x00\x01\x00\x06\x00\x0b\x00\x0c\x00\x0d\x00\x06\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x06\x00\x00\x00\x01\x00\x00\x00\x06\x00\x02\x00\x03\x00\x06\x00\x05\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x1a\x00\x00\x00\x01\x00\x1c\x00\x06\x00\x01\x00\x20\x00\x06\x00\x09\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00\x03\x00\x06\x00\x05\x00\x02\x00\x06\x00\x05\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00\x03\x00\x06\x00\x05\x00\x02\x00\x06\x00\x05\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x18\x00\x00\x00\x01\x00\x06\x00\x06\x00\x11\x00\x02\x00\x06\x00\x1d\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x01\x00\x00\x00\x01\x00\x1b\x00\x06\x00\x02\x00\x21\x00\x06\x00\x08\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x05\x00\x00\x00\x01\x00\x20\x00\x06\x00\x05\x00\x22\x00\x06\x00\x15\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x02\x00\x0d\x00\x07\x00\x08\x00\x07\x00\x08\x00\x08\x00\x07\x00\x08\x00\x22\x00\x04\x00\x22\x00\x20\x00\x22\x00\xff\xff\x20\x00\xff\xff\xff\xff\x22\x00\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++happyTable :: HappyAddr+happyTable = HappyA# "\x00\x00\x19\x00\x14\x00\x3c\x00\x19\x00\x2e\x00\x32\x00\x76\x00\x51\x00\x38\x00\x2f\x00\x30\x00\x15\x00\x16\x00\x17\x00\x18\x00\x0e\x00\x4a\x00\x19\x00\x0e\x00\x1a\x00\x36\x00\x0e\x00\x1b\x00\x1c\x00\x5b\x00\x1d\x00\x23\x00\x27\x00\x1e\x00\x1f\x00\xff\xff\x45\x00\x0e\x00\x20\x00\xff\xff\x5c\x00\x15\x00\x16\x00\x17\x00\x18\x00\x29\x00\x24\x00\x19\x00\x25\x00\x1a\x00\x26\x00\x0e\x00\x1b\x00\x1c\x00\x42\x00\x1d\x00\x29\x00\x27\x00\x1e\x00\x1f\x00\x29\x00\x48\x00\x0e\x00\x20\x00\x14\x00\x44\x00\x4d\x00\x36\x00\x4e\x00\x2a\x00\x40\x00\x37\x00\x0e\x00\x0f\x00\x15\x00\x16\x00\x17\x00\x18\x00\x10\x00\x3f\x00\x19\x00\x40\x00\x1a\x00\x4b\x00\x0e\x00\x1b\x00\x1c\x00\x14\x00\x1d\x00\x41\x00\x27\x00\x1e\x00\x1f\x00\x74\x00\x28\x00\x0e\x00\x20\x00\x15\x00\x16\x00\x17\x00\x18\x00\x0e\x00\x0f\x00\x19\x00\x0e\x00\x1a\x00\x30\x00\x10\x00\x1b\x00\x1c\x00\x71\x00\x1d\x00\x26\x00\x73\x00\x1e\x00\x1f\x00\x0e\x00\x0f\x00\x0e\x00\x20\x00\x0e\x00\x0f\x00\x10\x00\x71\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x74\x00\x21\x00\x10\x00\x11\x00\x6c\x00\x21\x00\x0e\x00\x11\x00\x6a\x00\x21\x00\x0e\x00\x0f\x00\x31\x00\x0e\x00\x0f\x00\x32\x00\x10\x00\x39\x00\x33\x00\x10\x00\x3a\x00\x11\x00\x67\x00\x21\x00\x11\x00\x5d\x00\x21\x00\x0e\x00\x0f\x00\x36\x00\x0e\x00\x0f\x00\x70\x00\x10\x00\x6f\x00\x0e\x00\x10\x00\x6e\x00\x11\x00\x5e\x00\x21\x00\x11\x00\x5f\x00\x21\x00\x0e\x00\x0f\x00\x32\x00\x0e\x00\x0f\x00\x33\x00\x10\x00\x5a\x00\x69\x00\x10\x00\x6c\x00\x11\x00\x60\x00\x21\x00\x11\x00\x62\x00\x21\x00\x0e\x00\x0f\x00\x32\x00\x0e\x00\x0f\x00\x33\x00\x10\x00\x34\x00\x64\x00\x10\x00\x6a\x00\x11\x00\x50\x00\x21\x00\x11\x00\x58\x00\x21\x00\x0e\x00\x0f\x00\x66\x00\x0e\x00\x0f\x00\x3c\x00\x10\x00\x65\x00\x67\x00\x10\x00\x62\x00\x11\x00\x59\x00\x21\x00\x11\x00\x47\x00\x21\x00\x0e\x00\x0f\x00\x54\x00\x0e\x00\x0f\x00\x56\x00\x10\x00\x50\x00\x20\x00\x10\x00\x58\x00\x11\x00\x4a\x00\x21\x00\x11\x00\x4e\x00\x21\x00\x0e\x00\x0f\x00\x55\x00\x0e\x00\x0f\x00\x0e\x00\x10\x00\x57\x00\xff\xff\x10\x00\x3d\x00\x11\x00\x20\x00\x21\x00\x11\x00\x50\x00\x12\x00\x2b\x00\x43\x00\x2b\x00\x46\x00\x53\x00\x2b\x00\x2c\x00\xff\xff\x3e\x00\xff\xff\x0e\x00\xff\xff\x00\x00\x0e\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++happyReduceArr = Happy_Data_Array.array (12, 56) [+	(12 , happyReduce_12),+	(13 , happyReduce_13),+	(14 , happyReduce_14),+	(15 , happyReduce_15),+	(16 , happyReduce_16),+	(17 , happyReduce_17),+	(18 , happyReduce_18),+	(19 , happyReduce_19),+	(20 , happyReduce_20),+	(21 , happyReduce_21),+	(22 , happyReduce_22),+	(23 , happyReduce_23),+	(24 , happyReduce_24),+	(25 , happyReduce_25),+	(26 , happyReduce_26),+	(27 , happyReduce_27),+	(28 , happyReduce_28),+	(29 , happyReduce_29),+	(30 , happyReduce_30),+	(31 , happyReduce_31),+	(32 , happyReduce_32),+	(33 , happyReduce_33),+	(34 , happyReduce_34),+	(35 , happyReduce_35),+	(36 , happyReduce_36),+	(37 , happyReduce_37),+	(38 , happyReduce_38),+	(39 , happyReduce_39),+	(40 , happyReduce_40),+	(41 , happyReduce_41),+	(42 , happyReduce_42),+	(43 , happyReduce_43),+	(44 , happyReduce_44),+	(45 , happyReduce_45),+	(46 , happyReduce_46),+	(47 , happyReduce_47),+	(48 , happyReduce_48),+	(49 , happyReduce_49),+	(50 , happyReduce_50),+	(51 , happyReduce_51),+	(52 , happyReduce_52),+	(53 , happyReduce_53),+	(54 , happyReduce_54),+	(55 , happyReduce_55),+	(56 , happyReduce_56)+	]++happy_n_terms = 35 :: Int+happy_n_nonterms = 14 :: Int++happyReduce_12 = happySpecReduce_1  0# happyReduction_12+happyReduction_12 happy_x_1+	 =  case happyOutTok happy_x_1 of { (PT _ (TV happy_var_1)) -> +	happyIn15+		 (Ident happy_var_1+	)}++happyReduce_13 = happySpecReduce_1  1# happyReduction_13+happyReduction_13 happy_x_1+	 =  case happyOutTok happy_x_1 of { (PT _ (TI happy_var_1)) -> +	happyIn16+		 ((read ( happy_var_1)) :: Integer+	)}++happyReduce_14 = happySpecReduce_1  2# happyReduction_14+happyReduction_14 happy_x_1+	 =  case happyOut20 happy_x_1 of { happy_var_1 -> +	happyIn17+		 (Sit.Abs.Prg happy_var_1+	)}++happyReduce_15 = happySpecReduce_3  3# happyReduction_15+happyReduction_15 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	case happyOut27 happy_x_3 of { happy_var_3 -> +	happyIn18+		 (Sit.Abs.Sig happy_var_1 happy_var_3+	)}}++happyReduce_16 = happySpecReduce_3  3# happyReduction_16+happyReduction_16 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	case happyOut27 happy_x_3 of { happy_var_3 -> +	happyIn18+		 (Sit.Abs.Def happy_var_1 happy_var_3+	)}}++happyReduce_17 = happySpecReduce_3  3# happyReduction_17+happyReduction_17 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut19 happy_x_3 of { happy_var_3 -> +	happyIn18+		 (Sit.Abs.Open happy_var_3+	)}++happyReduce_18 = happySpecReduce_0  3# happyReduction_18+happyReduction_18  =  happyIn18+		 (Sit.Abs.Blank+	)++happyReduce_19 = happySpecReduce_1  4# happyReduction_19+happyReduction_19 happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	happyIn19+		 (Sit.Abs.Sg happy_var_1+	)}++happyReduce_20 = happySpecReduce_3  4# happyReduction_20+happyReduction_20 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut19 happy_x_1 of { happy_var_1 -> +	case happyOut15 happy_x_3 of { happy_var_3 -> +	happyIn19+		 (Sit.Abs.Cons happy_var_1 happy_var_3+	)}}++happyReduce_21 = happySpecReduce_1  5# happyReduction_21+happyReduction_21 happy_x_1+	 =  case happyOut18 happy_x_1 of { happy_var_1 -> +	happyIn20+		 ((:[]) happy_var_1+	)}++happyReduce_22 = happySpecReduce_3  5# happyReduction_22+happyReduction_22 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut18 happy_x_1 of { happy_var_1 -> +	case happyOut20 happy_x_3 of { happy_var_3 -> +	happyIn20+		 ((:) happy_var_1 happy_var_3+	)}}++happyReduce_23 = happySpecReduce_1  6# happyReduction_23+happyReduction_23 happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	happyIn21+		 (Sit.Abs.Id happy_var_1+	)}++happyReduce_24 = happySpecReduce_1  6# happyReduction_24+happyReduction_24 happy_x_1+	 =  happyIn21+		 (Sit.Abs.Under+	)++happyReduce_25 = happySpecReduce_2  7# happyReduction_25+happyReduction_25 happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_2 of { happy_var_2 -> +	happyIn22+		 (Sit.Abs.BIrrel happy_var_2+	)}++happyReduce_26 = happySpecReduce_2  7# happyReduction_26+happyReduction_26 happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_2 of { happy_var_2 -> +	happyIn22+		 (Sit.Abs.BRel happy_var_2+	)}++happyReduce_27 = happyReduce 5# 7# happyReduction_27+happyReduction_27 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut24 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	happyIn22+		 (Sit.Abs.BAnn happy_var_2 happy_var_4+	) `HappyStk` happyRest}}++happyReduce_28 = happySpecReduce_1  8# happyReduction_28+happyReduction_28 happy_x_1+	 =  case happyOut22 happy_x_1 of { happy_var_1 -> +	happyIn23+		 ((:[]) happy_var_1+	)}++happyReduce_29 = happySpecReduce_2  8# happyReduction_29+happyReduction_29 happy_x_2+	happy_x_1+	 =  case happyOut22 happy_x_1 of { happy_var_1 -> +	case happyOut23 happy_x_2 of { happy_var_2 -> +	happyIn23+		 ((:) happy_var_1 happy_var_2+	)}}++happyReduce_30 = happySpecReduce_1  9# happyReduction_30+happyReduction_30 happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	happyIn24+		 ((:[]) happy_var_1+	)}++happyReduce_31 = happySpecReduce_2  9# happyReduction_31+happyReduction_31 happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	case happyOut24 happy_x_2 of { happy_var_2 -> +	happyIn24+		 ((:) happy_var_1 happy_var_2+	)}}++happyReduce_32 = happySpecReduce_1  10# happyReduction_32+happyReduction_32 happy_x_1+	 =  case happyOut21 happy_x_1 of { happy_var_1 -> +	happyIn25+		 ((:[]) happy_var_1+	)}++happyReduce_33 = happySpecReduce_2  10# happyReduction_33+happyReduction_33 happy_x_2+	happy_x_1+	 =  case happyOut21 happy_x_1 of { happy_var_1 -> +	case happyOut25 happy_x_2 of { happy_var_2 -> +	happyIn25+		 ((:) happy_var_1 happy_var_2+	)}}++happyReduce_34 = happySpecReduce_1  11# happyReduction_34+happyReduction_34 happy_x_1+	 =  case happyOut21 happy_x_1 of { happy_var_1 -> +	happyIn26+		 (Sit.Abs.Var happy_var_1+	)}++happyReduce_35 = happySpecReduce_1  11# happyReduction_35+happyReduction_35 happy_x_1+	 =  case happyOut16 happy_x_1 of { happy_var_1 -> +	happyIn26+		 (Sit.Abs.Int happy_var_1+	)}++happyReduce_36 = happySpecReduce_1  11# happyReduction_36+happyReduction_36 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Infty+	)++happyReduce_37 = happySpecReduce_1  11# happyReduction_37+happyReduction_37 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Nat+	)++happyReduce_38 = happySpecReduce_1  11# happyReduction_38+happyReduction_38 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Set+	)++happyReduce_39 = happySpecReduce_1  11# happyReduction_39+happyReduction_39 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Set1+	)++happyReduce_40 = happySpecReduce_1  11# happyReduction_40+happyReduction_40 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Set2+	)++happyReduce_41 = happySpecReduce_1  11# happyReduction_41+happyReduction_41 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Zero+	)++happyReduce_42 = happySpecReduce_1  11# happyReduction_42+happyReduction_42 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Suc+	)++happyReduce_43 = happySpecReduce_1  11# happyReduction_43+happyReduction_43 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Fix+	)++happyReduce_44 = happySpecReduce_1  11# happyReduction_44+happyReduction_44 happy_x_1+	 =  happyIn26+		 (Sit.Abs.LZero+	)++happyReduce_45 = happySpecReduce_1  11# happyReduction_45+happyReduction_45 happy_x_1+	 =  happyIn26+		 (Sit.Abs.LSuc+	)++happyReduce_46 = happySpecReduce_3  11# happyReduction_46+happyReduction_46 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut27 happy_x_2 of { happy_var_2 -> +	happyIn26+		 (happy_var_2+	)}++happyReduce_47 = happyReduce 4# 12# happyReduction_47+happyReduction_47 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut25 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	happyIn27+		 (Sit.Abs.Lam happy_var_2 happy_var_4+	) `HappyStk` happyRest}}++happyReduce_48 = happyReduce 4# 12# happyReduction_48+happyReduction_48 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut23 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	happyIn27+		 (Sit.Abs.Forall happy_var_2 happy_var_4+	) `HappyStk` happyRest}}++happyReduce_49 = happyReduce 7# 12# happyReduction_49+happyReduction_49 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut27 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	case happyOut27 happy_x_7 of { happy_var_7 -> +	happyIn27+		 (Sit.Abs.Pi happy_var_2 happy_var_4 happy_var_7+	) `HappyStk` happyRest}}}++happyReduce_50 = happySpecReduce_3  12# happyReduction_50+happyReduction_50 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut27 happy_x_3 of { happy_var_3 -> +	happyIn27+		 (Sit.Abs.Arrow happy_var_1 happy_var_3+	)}}++happyReduce_51 = happyReduce 6# 12# happyReduction_51+happyReduction_51 (happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut27 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	case happyOut27 happy_x_6 of { happy_var_6 -> +	happyIn27+		 (Sit.Abs.Case happy_var_2 happy_var_4 happy_var_6+	) `HappyStk` happyRest}}}++happyReduce_52 = happySpecReduce_3  12# happyReduction_52+happyReduction_52 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	happyIn27+		 (Sit.Abs.Plus happy_var_1 happy_var_3+	)}}++happyReduce_53 = happyReduce 17# 12# happyReduction_53+happyReduction_53 (happy_x_17 `HappyStk`+	happy_x_16 `HappyStk`+	happy_x_15 `HappyStk`+	happy_x_14 `HappyStk`+	happy_x_13 `HappyStk`+	happy_x_12 `HappyStk`+	happy_x_11 `HappyStk`+	happy_x_10 `HappyStk`+	happy_x_9 `HappyStk`+	happy_x_8 `HappyStk`+	happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut27 happy_x_8 of { happy_var_8 -> +	case happyOut21 happy_x_13 of { happy_var_13 -> +	case happyOut27 happy_x_16 of { happy_var_16 -> +	happyIn27+		 (Sit.Abs.ELam happy_var_8 happy_var_13 happy_var_16+	) `HappyStk` happyRest}}}++happyReduce_54 = happySpecReduce_1  12# happyReduction_54+happyReduction_54 happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	happyIn27+		 (happy_var_1+	)}++happyReduce_55 = happySpecReduce_2  13# happyReduction_55+happyReduction_55 happy_x_2+	happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut26 happy_x_2 of { happy_var_2 -> +	happyIn28+		 (Sit.Abs.App happy_var_1 happy_var_2+	)}}++happyReduce_56 = happySpecReduce_1  13# happyReduction_56+happyReduction_56 happy_x_1+	 =  case happyOut26 happy_x_1 of { happy_var_1 -> +	happyIn28+		 (happy_var_1+	)}++happyNewToken action sts stk [] =+	happyDoAction 34# notHappyAtAll action sts stk []++happyNewToken action sts stk (tk:tks) =+	let cont i = happyDoAction i tk action sts stk tks in+	case tk of {+	PT _ (TS _ 1) -> cont 1#;+	PT _ (TS _ 2) -> cont 2#;+	PT _ (TS _ 3) -> cont 3#;+	PT _ (TS _ 4) -> cont 4#;+	PT _ (TS _ 5) -> cont 5#;+	PT _ (TS _ 6) -> cont 6#;+	PT _ (TS _ 7) -> cont 7#;+	PT _ (TS _ 8) -> cont 8#;+	PT _ (TS _ 9) -> cont 9#;+	PT _ (TS _ 10) -> cont 10#;+	PT _ (TS _ 11) -> cont 11#;+	PT _ (TS _ 12) -> cont 12#;+	PT _ (TS _ 13) -> cont 13#;+	PT _ (TS _ 14) -> cont 14#;+	PT _ (TS _ 15) -> cont 15#;+	PT _ (TS _ 16) -> cont 16#;+	PT _ (TS _ 17) -> cont 17#;+	PT _ (TS _ 18) -> cont 18#;+	PT _ (TS _ 19) -> cont 19#;+	PT _ (TS _ 20) -> cont 20#;+	PT _ (TS _ 21) -> cont 21#;+	PT _ (TS _ 22) -> cont 22#;+	PT _ (TS _ 23) -> cont 23#;+	PT _ (TS _ 24) -> cont 24#;+	PT _ (TS _ 25) -> cont 25#;+	PT _ (TS _ 26) -> cont 26#;+	PT _ (TS _ 27) -> cont 27#;+	PT _ (TS _ 28) -> cont 28#;+	PT _ (TS _ 29) -> cont 29#;+	PT _ (TS _ 30) -> cont 30#;+	PT _ (TS _ 31) -> cont 31#;+	PT _ (TV happy_dollar_dollar) -> cont 32#;+	PT _ (TI happy_dollar_dollar) -> cont 33#;+	_ -> happyError' (tk:tks)+	}++happyError_ 34# tk tks = happyError' tks+happyError_ _ tk tks = happyError' (tk:tks)++happyThen :: () => Err a -> (a -> Err b) -> Err b+happyThen = (thenM)+happyReturn :: () => a -> Err a+happyReturn = (returnM)+happyThen1 m k tks = (thenM) m (\a -> k a tks)+happyReturn1 :: () => a -> b -> Err a+happyReturn1 = \a tks -> (returnM) a+happyError' :: () => [(Token)] -> Err a+happyError' = happyError++pPrg tks = happySomeParser where+  happySomeParser = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut17 x))++pDecl tks = happySomeParser where+  happySomeParser = happyThen (happyParse 1# tks) (\x -> happyReturn (happyOut18 x))++pQualId tks = happySomeParser where+  happySomeParser = happyThen (happyParse 2# tks) (\x -> happyReturn (happyOut19 x))++pListDecl tks = happySomeParser where+  happySomeParser = happyThen (happyParse 3# tks) (\x -> happyReturn (happyOut20 x))++pIdU tks = happySomeParser where+  happySomeParser = happyThen (happyParse 4# tks) (\x -> happyReturn (happyOut21 x))++pBind tks = happySomeParser where+  happySomeParser = happyThen (happyParse 5# tks) (\x -> happyReturn (happyOut22 x))++pListBind tks = happySomeParser where+  happySomeParser = happyThen (happyParse 6# tks) (\x -> happyReturn (happyOut23 x))++pListIdent tks = happySomeParser where+  happySomeParser = happyThen (happyParse 7# tks) (\x -> happyReturn (happyOut24 x))++pListIdU tks = happySomeParser where+  happySomeParser = happyThen (happyParse 8# tks) (\x -> happyReturn (happyOut25 x))++pExp2 tks = happySomeParser where+  happySomeParser = happyThen (happyParse 9# tks) (\x -> happyReturn (happyOut26 x))++pExp tks = happySomeParser where+  happySomeParser = happyThen (happyParse 10# tks) (\x -> happyReturn (happyOut27 x))++pExp1 tks = happySomeParser where+  happySomeParser = happyThen (happyParse 11# tks) (\x -> happyReturn (happyOut28 x))++happySeq = happyDontSeq+++returnM :: a -> Err a+returnM = return++thenM :: Err a -> (a -> Err b) -> Err b+thenM = (>>=)++happyError :: [Token] -> Err a+happyError ts =+  Bad $ "syntax error at " ++ tokenPos ts ++ +  case ts of+    [] -> []+    [Err _] -> " due to lexer error"+    t:_ -> " before `" ++ id(prToken t) ++ "'"++myLexer = tokens+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<built-in>" #-}+{-# LINE 1 "<command-line>" #-}+{-# LINE 10 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4++# 17 "/usr/include/stdc-predef.h" 3 4++++++++++++++++++++++++++++++++++++++++++++{-# LINE 10 "<command-line>" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+-- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp ++{-# LINE 13 "templates/GenericTemplate.hs" #-}++++++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define LT(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.<# m)) :: Bool)+#define GTE(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.>=# m)) :: Bool)+#define EQ(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.==# m)) :: Bool)+#else+#define LT(n,m) (n Happy_GHC_Exts.<# m)+#define GTE(n,m) (n Happy_GHC_Exts.>=# m)+#define EQ(n,m) (n Happy_GHC_Exts.==# m)+#endif+{-# LINE 46 "templates/GenericTemplate.hs" #-}+++data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList++++++{-# LINE 67 "templates/GenericTemplate.hs" #-}++{-# LINE 77 "templates/GenericTemplate.hs" #-}++{-# LINE 86 "templates/GenericTemplate.hs" #-}++infixr 9 `HappyStk`+data HappyStk a = HappyStk a (HappyStk a)++-----------------------------------------------------------------------------+-- starting the parse++happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll++-----------------------------------------------------------------------------+-- Accepting the parse++-- If the current token is 0#, it means we've just accepted a partial+-- parse (a %partial parser).  We must ignore the saved token on the top of+-- the stack in this case.+happyAccept 0# tk st sts (_ `HappyStk` ans `HappyStk` _) =+        happyReturn1 ans+happyAccept j tk st sts (HappyStk ans _) = +        (happyTcHack j (happyTcHack st)) (happyReturn1 ans)++-----------------------------------------------------------------------------+-- Arrays only: do the next action++++happyDoAction i tk st+        = {- nothing -}+++          case action of+                0#           -> {- nothing -}+                                     happyFail i tk st+                -1#          -> {- nothing -}+                                     happyAccept i tk st+                n | LT(n,(0# :: Happy_GHC_Exts.Int#)) -> {- nothing -}++                                                   (happyReduceArr Happy_Data_Array.! rule) i tk st+                                                   where rule = (Happy_GHC_Exts.I# ((Happy_GHC_Exts.negateInt# ((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#))))))+                n                 -> {- nothing -}+++                                     happyShift new_state i tk st+                                     where new_state = (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#))+   where off    = indexShortOffAddr happyActOffsets st+         off_i  = (off Happy_GHC_Exts.+# i)+         check  = if GTE(off_i,(0# :: Happy_GHC_Exts.Int#))+                  then EQ(indexShortOffAddr happyCheck off_i, i)+                  else False+         action+          | check     = indexShortOffAddr happyTable off_i+          | otherwise = indexShortOffAddr happyDefActions st+++indexShortOffAddr (HappyA# arr) off =+        Happy_GHC_Exts.narrow16Int# i+  where+        i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.uncheckedShiftL# high 8#) low)+        high = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr (off' Happy_GHC_Exts.+# 1#)))+        low  = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr off'))+        off' = off Happy_GHC_Exts.*# 2#++++++data HappyAddr = HappyA# Happy_GHC_Exts.Addr#+++++-----------------------------------------------------------------------------+-- HappyState data type (not arrays)++{-# LINE 170 "templates/GenericTemplate.hs" #-}++-----------------------------------------------------------------------------+-- Shifting a token++happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =+     let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in+--     trace "shifting the error token" $+     happyDoAction i tk new_state (HappyCons (st) (sts)) (stk)++happyShift new_state i tk st sts stk =+     happyNewToken new_state (HappyCons (st) (sts)) ((happyInTok (tk))`HappyStk`stk)++-- happyReduce is specialised for the common cases.++happySpecReduce_0 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_0 nt fn j tk st@((action)) sts stk+     = happyGoto nt j tk st (HappyCons (st) (sts)) (fn `HappyStk` stk)++happySpecReduce_1 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_1 nt fn j tk _ sts@((HappyCons (st@(action)) (_))) (v1`HappyStk`stk')+     = let r = fn v1 in+       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_2 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_2 nt fn j tk _ (HappyCons (_) (sts@((HappyCons (st@(action)) (_))))) (v1`HappyStk`v2`HappyStk`stk')+     = let r = fn v1 v2 in+       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_3 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_3 nt fn j tk _ (HappyCons (_) ((HappyCons (_) (sts@((HappyCons (st@(action)) (_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')+     = let r = fn v1 v2 v3 in+       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happyReduce k i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happyReduce k nt fn j tk st sts stk+     = case happyDrop (k Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) sts of+         sts1@((HappyCons (st1@(action)) (_))) ->+                let r = fn stk in  -- it doesn't hurt to always seq here...+                happyDoSeq r (happyGoto nt j tk st1 sts1 r)++happyMonadReduce k nt fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happyMonadReduce k nt fn j tk st sts stk =+      case happyDrop k (HappyCons (st) (sts)) of+        sts1@((HappyCons (st1@(action)) (_))) ->+          let drop_stk = happyDropStk k stk in+          happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))++happyMonad2Reduce k nt fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happyMonad2Reduce k nt fn j tk st sts stk =+      case happyDrop k (HappyCons (st) (sts)) of+        sts1@((HappyCons (st1@(action)) (_))) ->+         let drop_stk = happyDropStk k stk++             off = indexShortOffAddr happyGotoOffsets st1+             off_i = (off Happy_GHC_Exts.+# nt)+             new_state = indexShortOffAddr happyTable off_i++++          in+          happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))++happyDrop 0# l = l+happyDrop n (HappyCons (_) (t)) = happyDrop (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) t++happyDropStk 0# l = l+happyDropStk n (x `HappyStk` xs) = happyDropStk (n Happy_GHC_Exts.-# (1#::Happy_GHC_Exts.Int#)) xs++-----------------------------------------------------------------------------+-- Moving to a new state after a reduction+++happyGoto nt j tk st = +   {- nothing -}+   happyDoAction j tk new_state+   where off = indexShortOffAddr happyGotoOffsets st+         off_i = (off Happy_GHC_Exts.+# nt)+         new_state = indexShortOffAddr happyTable off_i+++++-----------------------------------------------------------------------------+-- Error recovery (0# is the error token)++-- parse error if we are in recovery and we fail again+happyFail 0# tk old_st _ stk@(x `HappyStk` _) =+     let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in+--      trace "failing" $ +        happyError_ i tk++{-  We don't need state discarding for our restricted implementation of+    "error".  In fact, it can cause some bogus parses, so I've disabled it+    for now --SDM++-- discard a state+happyFail  0# tk old_st (HappyCons ((action)) (sts)) +                                                (saved_tok `HappyStk` _ `HappyStk` stk) =+--      trace ("discarding state, depth " ++ show (length stk))  $+        happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk))+-}++-- Enter error recovery: generate an error token,+--                       save the old token and carry on.+happyFail  i tk (action) sts stk =+--      trace "entering error recovery" $+        happyDoAction 0# tk action sts ( (Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk)++-- Internal happy errors:++notHappyAtAll :: a+notHappyAtAll = error "Internal Happy error\n"++-----------------------------------------------------------------------------+-- Hack to get the typechecker to accept our action functions+++happyTcHack :: Happy_GHC_Exts.Int# -> a -> a+happyTcHack x y = y+{-# INLINE happyTcHack #-}+++-----------------------------------------------------------------------------+-- Seq-ing.  If the --strict flag is given, then Happy emits +--      happySeq = happyDoSeq+-- otherwise it emits+--      happySeq = happyDontSeq++happyDoSeq, happyDontSeq :: a -> b -> b+happyDoSeq   a b = a `seq` b+happyDontSeq a b = b++-----------------------------------------------------------------------------+-- Don't inline any functions from the template.  GHC has a nasty habit+-- of deciding to inline happyGoto everywhere, which increases the size of+-- the generated parser quite a bit.+++{-# NOINLINE happyDoAction #-}+{-# NOINLINE happyTable #-}+{-# NOINLINE happyCheck #-}+{-# NOINLINE happyActOffsets #-}+{-# NOINLINE happyGotoOffsets #-}+{-# NOINLINE happyDefActions #-}++{-# NOINLINE happyShift #-}+{-# NOINLINE happySpecReduce_0 #-}+{-# NOINLINE happySpecReduce_1 #-}+{-# NOINLINE happySpecReduce_2 #-}+{-# NOINLINE happySpecReduce_3 #-}+{-# NOINLINE happyReduce #-}+{-# NOINLINE happyMonadReduce #-}+{-# NOINLINE happyGoto #-}+{-# NOINLINE happyFail #-}++-- end of Happy Template.
+ src/Abstract.hs view
@@ -0,0 +1,84 @@+{-# LANGUAGE LambdaCase #-}++{-# OPTIONS_GHC -fno-warn-typed-holes #-}+{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}++-- | Auxiliary functions for abstract syntax.++module Abstract where++import Control.Monad++import Sit.Abs as A++import Lens++-- data AppView+--   = FixV [Exp]+--   | SetV [Exp]+--   | VarV [Exp]+--   | ZeroV [Exp]+--   | SucV  [Exp]++-- | Gather applications to expose head.++appView :: Exp -> (Exp, [Exp])+appView = \case+  App f e -> over _2 (++ [e]) $ appView f+  e -> (e, [])++-- | Can this expression only denote a type?++mustBeType :: Exp -> Bool+mustBeType = \case+  Nat      -> True+  Set      -> True+  Set1     -> True+  Set2     -> True+  Forall{} -> True+  Pi{}     -> True+  Arrow{}  -> True+  App f _  -> mustBeType f+  _ -> False++-- | Is this expression an introduction?++introduction :: Exp -> Bool+introduction = \case+  Var{}    -> False+  App{}    -> False+  Case{}   -> False+  Int{}    -> True+  Infty    -> True+  Size     -> True+  Nat      -> True+  Set      -> True+  Set1     -> True+  Set2     -> True+  Zero     -> True+  Suc      -> True+  Fix      -> True+  LZero    -> True+  LSuc     -> True+  Lam{}    -> True+  Forall{} -> True+  Pi{}     -> True+  Arrow{}  -> True+  Plus{}   -> True+  ELam{}   -> True++-- | Convert "identifier-or-underscore" to string.++fromIdU :: A.IdU -> String+fromIdU = \case+  A.Id (A.Ident x) -> x+  A.Under -> "_"++-- | Try to convert an expression to a list of A.IdU++parseIdUs :: A.Exp -> Maybe [A.IdU]+parseIdUs e = do+  let (f, es) = appView e+  forM (f : es) $ \case+    A.Var x -> Just x+    _ -> Nothing
+ src/Evaluation.hs view
@@ -0,0 +1,393 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-}+-- {-# LANGUAGE FunctionalDependencies, UndecidableInstances #-}++-- | Values and weak head evaluation++module Evaluation where++import Control.Applicative+import Control.Monad+import Control.Monad.Identity+import Control.Monad.Reader++import Data.Maybe+import Data.Traversable (traverse)++import Debug.Trace++import Internal+import Substitute++import Lens+import Impossible+#include "undefined.h"++-- * Values++-- | Generic values are de Bruijn levels.+type VGen   = Int++-- | We have just a single type of values, including size values.+type VSize  = Val+type VLevel = VSize++type VType  = Val+type VElim  = Elim' Val+type VElims = [VElim]++data Val+  = VType VLevel+  | VSize+  | VNat VSize+  | VZero VSize+  | VSuc VSize Val+  | VInfty+  | VPi (Dom VType) VClos+  -- Functions+  | -- | Lambda abstraction+    VLam VClos+  | -- | @\ x -> x e@ for internal use in fix.+    VElimBy VElim+  -- -- | -- | Constant function+  -- --   VConst Val+  | -- | Neutrals.+    VUp VType VNe+  | -- | Type annotation for readback (normal form).+    VDown VType Val+  deriving (Eq, Show)++data VNe = VNe+  { _neVar :: VGen+  , _neElims :: VElims+  }+  deriving (Eq, Show)++data VClos = VClos+  { closBody :: Abs Term+  , closEnv  :: Env+  }+  deriving (Eq, Show)++-- | An environment maps de Bruijn indices to values.+--   The first entry in the list is the binding for index 0.++type Env = [Val]++makeLens ''VNe++-- | Variable++vVar :: VType -> VGen -> Val+vVar t x = VUp t $ VNe x []++-- * Size arithmetic++-- | Zero size.++vsZero :: VSize+vsZero = VZero VInfty++-- | Successor size.++vsSuc :: VSize -> VSize+vsSuc = VSuc VInfty++-- | Variable size.++vsVar :: VGen -> VSize+vsVar = vVar VSize++-- | Size increment.++vsPlus :: Int -> VSize -> VSize+vsPlus n v = iterate vsSuc v !! n++-- | Constant size.++vsConst :: Int -> VSize+vsConst n = vsPlus n vsZero++-- | View a value as a size expression.++data SizeView+  = SVConst Int+    -- ^ @n@+  | SVVar VGen Int+    -- ^ @i + n@+  | SVInfty+    -- ^ @oo@+  deriving (Eq, Show)++-- | Successor size on view.++svSuc :: SizeView -> SizeView+svSuc = \case+  SVConst n -> SVConst $ succ n+  SVVar x n -> SVVar x $ succ n+  SVInfty   -> SVInfty++-- | View a value as a size expression.++sizeView :: Val -> Maybe SizeView+sizeView = \case+  VZero _              -> return $ SVConst 0+  VSuc _ v             -> svSuc <$> sizeView v+  VInfty               -> return $ SVInfty+  VUp VSize (VNe k []) -> return $ SVVar k 0+  _ -> Nothing++unSizeView :: SizeView -> Val+unSizeView = \case+  SVInfty -> VInfty+  SVConst n -> vsConst n+  SVVar x n -> vsPlus n $ vsVar x++-- | Compute the maximum of two sizes.++maxSize :: VSize -> VSize -> VSize+maxSize v1 v2 =+  case ( fromMaybe __IMPOSSIBLE__ $ sizeView v1+       , fromMaybe __IMPOSSIBLE__ $ sizeView v2) of+    (SVConst n, SVConst m)          -> unSizeView $ SVConst $ max n m+    (SVVar x n, SVVar y m) | x == y -> unSizeView $ SVVar x $ max n m+    (SVConst n, SVVar y m) | n <= m -> unSizeView $ SVVar y m+    (SVVar x n, SVConst m) | n >= m -> unSizeView $ SVVar x n+    _ -> VInfty++-- * Evaluation++-- | Evaluation monad.++class (Functor m, Applicative m, Monad m) => MonadEval m where+  getDef :: Id -> m Val++instance MonadEval Identity where+  getDef x = __IMPOSSIBLE__++evaluateClosed :: Term -> Val+evaluateClosed t = runIdentity $ evalIn t []++-- | Evaluation.++evalIn :: MonadEval m => Term -> Env -> m Val+evalIn t rho = runReaderT (eval t) rho++class Evaluate a b where -- -- | a -> b where+  eval :: MonadEval m => a -> ReaderT Env m b++instance Evaluate Index Val where+  eval (Index i) = (!! i) <$> ask++instance Evaluate Term Val where+  eval = \case+    Type l   -> VType <$> eval l+    Nat a    -> VNat <$> eval a+    Size     -> pure VSize+    Infty    -> pure VInfty+    Zero a   -> VZero <$> eval (unArg a)+    Suc a t  -> liftA2 VSuc (eval $ unArg a) (eval t)+    Pi u t   -> liftA2 VPi (eval u) (eval t)+    -- Lam ai (NoAbs x t) -> VConst <$> eval t+    Lam ai t -> VLam <$> eval t+    Var x -> eval x+    Def f -> lift $ getDef f+    App t e -> do+      h <- eval t+      e <- eval e+      lift $ applyE h e++instance Evaluate (Abs Term) VClos where+  eval t = VClos t <$> ask++instance Evaluate a b => Evaluate [a] [b] where+  eval = traverse eval++instance Evaluate a b => Evaluate (Dom a) (Dom b) where+  eval = traverse eval++instance Evaluate a b => Evaluate (Elim' a) (Elim' b) where+  eval = traverse eval++applyEs :: MonadEval m => Val -> VElims -> m Val+applyEs v []       = return v+applyEs v (e : es) = applyE v e >>= (`applyEs` es)++applyE :: MonadEval m => Val -> VElim -> m Val+applyE v e =+  case (v, e) of+    (_        , Apply u     ) -> apply v u+    (VZero _  , Case _ u _ _) -> return u+    (VSuc _ n , Case _ _ _ f) -> apply f $ defaultArg n+    (VZero a  , Fix t tf f  ) -> unfoldFix t tf f a v -- apply f $ e : map (Apply . defaultArg) [ v , VZero ]+    (VSuc a n , Fix t tf f  ) -> unfoldFix t tf f a v+    (VUp (VNat a) n , _)      -> elimNeNat a n e+    _ -> __IMPOSSIBLE__++-- | Apply a function to an argument.++apply :: MonadEval m => Val -> Arg Val -> m Val+apply v arg@(Arg ai u) = case v of+  VPi _ cl  -> applyClos cl u  -- we also allow instantiation of Pi-types by apply+  VLam cl   -> applyClos cl u+  VElimBy e -> applyE u e+  -- VConst f  -> return f+  VUp (VPi a b) (VNe x es) -> do+    t' <- applyClos b u+    return $ VUp t' $ VNe x $ es ++ [ Apply $ Arg ai $ VDown (unDom a) u ]+  _ -> do+    traceM $ "apply  " ++ show v ++ "  to  " ++ show u+    __IMPOSSIBLE__++-- | Apply a closure to a value.++applyClos :: MonadEval m => VClos -> Val -> m Val+applyClos (VClos b rho) u = case b of+  NoAbs _ t -> evalIn t rho+  Abs   _ t -> evalIn t $ u : rho++-- | Unfold a fixed-point.++unfoldFix :: MonadEval m => VType -> VType -> Val -> VSize -> Val -> m Val+unfoldFix t tf f a v = applyEs f $ map Apply+  [ Arg Irrelevant a+  , defaultArg $ VElimBy $ Fix t tf f+  , defaultArg v+  ]++-- | Eliminate a neutral natural number.+--   Here we need to compute the correct type of the elimination++elimNeNat :: MonadEval m => VSize -> VNe -> VElim -> m Val+elimNeNat a n e = case e of+  Apply{} -> __IMPOSSIBLE__++  Case t u tf f -> do+    -- Compute the type of the result of the elimination application+    tr <- apply t $ Arg Relevant $ VUp (VNat a) n+    -- Compute the type of the zero branch+    tz <- apply t $ Arg Relevant u+    -- Compute the type of the suc branch+    ts <- return t -- TODO: must be (x : Nat a) -> t (suc a x)+    -- Assemble the elimination+    let e = Case (VDown (VType VInfty) t) (VDown tz u) (VDown (VType VInfty) tf) (VDown tf f)+    -- Assemble the result+    return $ VUp tr $ over neElims (++ [e]) n++  Fix t tf f -> do+    -- Compute the type of the result of the elimination application+    tr <- applyEs t $ map Apply [ Arg ShapeIrr a, Arg Relevant $ VUp (VNat a) n ]+    -- Assemble the elimination+    let e = Fix (VDown fixKindV t) (VDown (VType VInfty) tf) (VDown tf f)+    -- Assemble the result+    return $ VUp tr $ over neElims (++ [e]) n++-- | Type of type of fix motive.+--   @fixKind = ..(i : Size) -> Nat i -> Setω@++fixKindV :: VType+fixKindV = evaluateClosed fixKind++-- * Readback++-- | Readback.++class Readback a b where+  readback :: MonadEval m => a -> ReaderT Int m b++instance Readback VGen Index where+  readback k = Index . (\ n -> n - (k + 1)) <$> ask++instance Readback Val Term where+  readback = \case+    VDown VSize     d -> readbackSize d+    VDown (VType _) d -> readbackType d+    VDown (VNat _ ) d -> readbackNat  d++    VDown (VPi a b) d -> do+      v0 <- vVar (unDom a) <$> ask+      c <- lift $ applyClos b v0+      Lam (_domInfo a) . Abs "x" <$> do+        local succ . readback . VDown c =<< do+          lift $ apply d $ Arg (_domInfo a) v0++    VDown (VUp _ _) (VUp _ n) -> readbackNe n++instance Readback a b => Readback [a] [b] where+  readback = traverse readback++instance Readback a b => Readback (Dom a) (Dom b) where+  readback = traverse readback++instance Readback a b => Readback (Arg a) (Arg b) where+  readback = traverse readback++instance Readback a b => Readback (Elim' a) (Elim' b) where+  readback = traverse readback++readbackType :: MonadEval m => Val -> ReaderT Int m Term+readbackType = \case+  VSize   -> pure Size+  VType a -> Type <$> readbackSize a+  VNat a  -> Nat  <$> readbackSize a+  VPi a b -> do+    u  <- traverse readbackType a+    v0 <- vVar (unDom a) <$> ask+    Pi u . Abs "x" <$> do+      local succ . readbackType =<< do+        lift $ applyClos b v0+  VUp _ n -> readbackNe n+  _ -> __IMPOSSIBLE__++readbackNat  :: MonadEval m => Val -> ReaderT Int m Term+readbackNat = \case+  VZero a        -> zero <$> readbackSize a+  VSuc a t       -> liftA2 suc (readbackSize a) (readbackNat t)+  VUp (VNat _) n -> readbackNe n+  _ -> __IMPOSSIBLE__++readbackNe  :: MonadEval m => VNe -> ReaderT Int m Term+readbackNe (VNe x es) = do+  i            <- readback x+  es' :: Elims <- readback es+  return $ foldl App (Var i) es'++readbackSize  :: MonadEval m => Val -> ReaderT Int m Term+readbackSize = \case+  VInfty   -> pure Infty+  VZero _  -> pure sZero+  VSuc _ a -> sSuc <$> readbackSize a+  VUp VSize (VNe x []) -> Var <$> readback x+  _ -> __IMPOSSIBLE__++-- * Comparison++-- | Size values are partially ordered++cmpSizes :: VSize -> VSize -> Maybe Ordering+cmpSizes v1 v2 = do+  s1 <- sizeView v1+  s2 <- sizeView v2+  case (s1, s2) of+    (a,b) | a == b -> return EQ+    (SVInfty, _) -> return GT+    (_, SVInfty) -> return LT+    (SVConst n, SVConst m) -> return $ compare n m+    (SVVar x n, SVVar y m) | x == y -> return $ compare n m+    (SVConst n, SVVar y m) | n <= m -> __IMPOSSIBLE__  -- Here, LT is too strong.+    _ -> __IMPOSSIBLE__  -- TODO++leqSize :: VSize -> VSize -> Bool+leqSize a b = maxSize a b == b++-- | Compute predecessor size, if possible.+sizePred :: VSize -> Maybe VSize+sizePred v = do+  sizeView v >>= \case+    SVInfty -> return $ VInfty+    SVConst n | n > 0 -> return $ unSizeView $ SVConst $ n-1+    SVVar x n | n > 0 -> return $ unSizeView $ SVVar x $ n-1+    _ -> Just v
+ src/Impossible.hs view
@@ -0,0 +1,27 @@+{-# LANGUAGE DeriveDataTypeable #-}++module Impossible where++import Control.Exception+import Data.Typeable ( Typeable )+++data Impossible+  = Impossible  String Integer+    -- ^ We reached a program point which should be unreachable.++  deriving Typeable++instance Show Impossible where+  show (Impossible file line) = unlines+    [ "An internal error has occurred. Please report this as a bug."+    , "Location of the error: " ++ file ++ ":" ++ show line+    ]++instance Exception Impossible++-- | Abort by throwing an \"impossible\" error. You should not use+-- this function directly. Instead use the macro in @undefined.h@.++throwImpossible :: Impossible -> a+throwImpossible = throw
+ src/Internal.hs view
@@ -0,0 +1,167 @@+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE DeriveFoldable #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE TemplateHaskell #-}++-- | Internal Syntax.++module Internal where++import Data.Foldable (Foldable)+import Data.Traversable (Traversable)++import Lens++-- | Definition names are strings.++type Id = String++-- | Variables are de Bruijn indices.++newtype Index = Index { dbIndex :: Int }+  deriving (Eq, Ord, Show, Enum, Num)++-- | Size expressions.++type Size  = Term+type Level = Size++-- | Terms/types++type Type = Term++data Term+  = -- | Universe with level.+    Type Level+  | -- | Type of sizes (internal use only).+    Size+  | -- | Sized natural number type.+    Nat Size+  | -- | Zero constructor, or zero size (then @Size@ is ignored).+    Zero (Arg Size)+  | -- | Successor constructor, or successor size (then @Size@ is ignored).+    Suc (Arg Size) Term+  | -- | Infinity size.+    Infty+  | -- ^ (Dependent) function type.+    Pi (Dom Type) (Abs Term)+  | -- ^ Lambda abstraction+    Lam ArgInfo (Abs Term)+  | -- ^ Variable.+    Var Index+  | -- ^ Function call.+    Def Id+  | -- ^ Application/eliminiation.+    App Term Elim+  deriving (Eq, Ord, Show)++-- | Eliminations.++type Elims = [ Elim ]+type Elim  = Elim' Term++data Elim' a+  = -- | Function application.+    Apply (Arg a)+  | -- | Case distinction+    Case+    { caseReturn :: a -- ^ @T : Nat (b + 1) -> Setω@+    , caseZero   :: a -- ^ @tz : T zero@+    , caseTySuc  :: a -- ^ Type of @caseSuc@.  Stored here for convenience, must be+                      --        @(t : Nat b) -> T (suc t)@+    , caseSuc    :: a -- ^ @ts : (t : Nat b) -> T (suc t)@+    }+  | -- | Recursion+    Fix+    { fixReturn :: a+      -- ^ @T : ..(i : Size) -> Nat i -> Setω@+    , fixTyBody :: a+      -- ^ Type of @fixBody@.  Stored here for convenience, must be+      -- @.(i : Size) (f : (x : Nat i) -> T i x) (x : Nat (i + 1)) -> T (i + 1) x@.+    , fixBody   :: a+      -- ^ @t : .(i : Size) (f : (x : Nat i) -> T i x) (x : Nat (i + 1)) -> T (i + 1) x@+    }+  deriving (Eq, Ord, Show, Functor, Foldable, Traversable)++-- | Abstraction.++type AbsName = String++data Abs a+  = -- | Actual abstraction (body contains one more index).+    Abs   { absName :: AbsName, absBody :: a }+  | -- | No abstraction (argument will be ignored).+    NoAbs { absName :: AbsName, absBody :: a }+  deriving (Eq, Ord, Show)++-- | Function domain decoration.++data Dom a = Dom { _domInfo :: ArgInfo, unDom :: a }+  deriving (Eq, Ord, Show, Functor, Foldable, Traversable)++-- | Argument decoration.++data Arg a = Arg { argInfo :: ArgInfo, unArg :: a }+  deriving (Ord, Show, Functor, Foldable, Traversable)++instance Eq a => Eq (Arg a) where+   Arg Irrelevant _ == Arg Irrelevant _ = True+   Arg r a == Arg r' a' = r == r' && a == a'++type ArgInfo = Relevance++-- | Relevance lattice (order matters)+data Relevance+  = Relevant+  | ShapeIrr+  | Irrelevant+  deriving (Eq, Ord, Show)++makeLens ''Dom++-- * Smart constructor.++zero :: Size -> Term+zero = Zero . Arg Irrelevant++suc :: Size -> Term -> Term+suc = Suc . Arg Irrelevant++-- var :: Index -> Term+-- var i = Var i []++-- app :: Term -> Arg Term -> Maybe Term+-- app t u = case t of+--   Var x es -> Just $ Var x $ es ++ [ Apply u ]+--   Def f es -> Just $ Def f $ es ++ [ Apply u ]+--   _ -> Nothing++defaultArg :: a -> Arg a+defaultArg = Arg Relevant++defaultDom :: a -> Dom a+defaultDom = Dom Relevant++-- | Zero size.++sZero :: Term+sZero = zero Infty++-- | Successor size.++sSuc  :: Term -> Term+sSuc  = suc Infty++-- | Size increment.++sPlus :: Term -> Integer -> Term+sPlus t n = iterate sSuc t !! fromInteger n++-- | @fixKind = ..(i : Size) -> Nat i -> Setω@++fixKind :: Type+fixKind =+  Pi (Dom ShapeIrr Size) $ Abs "i" $+    Pi (Dom Relevant (Nat $ Var 0)) $ Abs "x" $+      Type Infty
+ src/Lens.hs view
@@ -0,0 +1,15 @@+{-# LANGUAGE NoMonomorphismRestriction #-}++-- | Wrapper module for lens functionality++module Lens+  ( module Data.Lens.Light+  , module Lens+  ) where++import Data.Lens.Light++over = modL+set  = setL+use  = access+_2   = lens snd $ \ y (x, _) -> (x, y)
+ src/Makefile view
@@ -0,0 +1,34 @@+.PHONY: test+.PRECIOUS : %.hs %.x %.y+all : test++test : Sit.bin ../test/Test.agda+	Sit.bin ../test/Test.agda++loop : Sit.bin ../test/Loop.agda+	Sit.bin ../test/Loop.agda++Sit.bin : Sit.hs Sit/Abs.hs Sit/Lex.hs Sit/Par.hs \+  undefined.h Impossible.hs \+  Abstract.hs Internal.hs Substitute.hs Evaluation.hs TypeChecker.hs+	ghc --make $< -o Sit.bin++Sit/Lex.x Sit/Par.y Sit/Abs.hs : Sit.cf+	bnfc --haskell -d $<+	touch $@++Sit/Par.hs: Sit/Par.y+	happy -gcai $<++Sit/Lex.hs: Sit/Lex.x+	alex -g $<++Sit/Test: Sit/Test.hs Sit/Par.hs Sit/Lex.hs+	ghc --make $< -o $@++clean:+	-rm -f Sit/*.log Sit/*.aux Sit/*.hi Sit/*.o Sit/*.dvi++distclean: clean+	-rm -f Sit/Doc.* Sit/Lex.* Sit/Par.* Sit/Layout.* Sit/Skel.* Sit/Print.* Sit/Test.* Sit/Abs.* Sit/Test Sit/ErrM.* Sit/SharedString.* Sit/ComposOp.* Sit/Sit.dtd Sit/XML.*+		-rmdir -p Sit/
+ src/Sit.cf view
@@ -0,0 +1,82 @@+-- Type theory with sized natural numbers and a irrelevant+-- size quantifier.++-- Types:   T ::= Nat a | Set a | (x : T) -> T | T -> T | forall Bs -> T+-- Binding: B ::= (x : T) | .i | ..i++-- Terms:   t ::= x | t t | \ xs -> t | zero | suc t | fix l T t n | case n return T of \{ zero -> tz; suc x -> ts }+--+-- Sizes:   a ::= Integer | x | x + Integer | w++-- SizeVar.   SizeExp ::= Ident;+-- SizeInf.   SizeExp ::= "oo";+-- SizeConst. SizeExp ::= Integer;+-- SizeInc.   SizeExp1 ::= Ident "+" Integer;+--+-- coercions Exp 1;++Prg.    Prg  ::= [Decl];++-- Declarations.++Sig.    Decl ::= Ident ":" Exp;+Def.    Decl ::= Ident "=" Exp;+Open.   Decl ::= "open" "import" QualId;+Blank.  Decl ::= ;++Sg.     QualId ::= Ident;+Cons.   QualId ::= QualId "." Ident;++separator nonempty Decl "--;" ;++-- Identifier which can be _++Id.     IdU ::= Ident;+Under.  IdU ::= "_";++-- Binder:++BIrrel. Bind ::= "." Ident;+BRel.   Bind ::= ".." Ident;+BAnn.   Bind ::= "(" [Ident] ":" Exp ")";++terminator nonempty Bind "";+terminator nonempty Ident "";+terminator nonempty IdU   "";++-- Atoms:++Var.   Exp2 ::= IdU;+Int.   Exp2 ::= Integer;+Infty. Exp2 ::= "oo";+Nat.   Exp2 ::= "Nat";+Set.   Exp2 ::= "Set";+Set1.  Exp2 ::= "Set1";+Set2.  Exp2 ::= "Set2";+Zero.  Exp2 ::= "zero";+Suc.   Exp2 ::= "suc";+Fix.   Exp2 ::= "fix";+LZero. Exp2 ::= "lzero";+LSuc.  Exp2 ::= "lsuc";++internal+Size. Exp ::= "Size";++-- Applications:++App.  Exp1 ::= Exp1 Exp2;++-- Abstraction etc.++Lam.    Exp ::= "\\" [IdU] "->" Exp;+Forall. Exp ::= "forall" [Bind] "->" Exp;+Pi.     Exp ::= "(" Exp ":" Exp ")" "->" Exp;  -- The first Exp should be [IdU], but this conflicts+Arrow.  Exp ::= Exp1 "->" Exp;+Case.   Exp ::= "case" Exp "return" Exp "of" Exp;+Plus.   Exp ::= Exp1 "+" Integer;+ELam.   Exp ::= "\\" "{" "(" "zero" "_" ")" "->" Exp ";" "(" "suc" "_" IdU ")" "->" Exp "}";++coercions Exp 2;++comment "---";+comment "{-" "-}";
+ src/Sit.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE LambdaCase #-}++import System.Environment (getArgs)+import System.Exit (exitFailure)++import Data.Foldable++import Sit.Abs+import Sit.ErrM+import Sit.Lex+import Sit.Par+import Sit.Print++import TypeChecker++main :: IO ()+main = getArgs >>= \case+  [file] -> check =<< readFile file+  _ -> usage++usage :: IO ()+usage = do+  putStrLn "Usage: Sit <SourceFile>"+  exitFailure++-- | Handle error by failing hard.++failOnErr :: String -> Err a -> IO a+failOnErr msg = \case+  Ok a    -> return a+  Bad err -> exitMsg $ unlines [ msg , err ]++exitMsg :: String -> IO a+exitMsg msg = do+  putStrLn msg+  exitFailure++-- | Run the type checker on file contents+check :: String -> IO ()+check txt = do+  Prg decls <- failOnErr "PARSE ERROR" $ pPrg $ myLexer txt+  -- putStrLn "Parsed the following declarations"+  -- forM_ decls $ \ d -> do+  --   putStrLn $ printTree d+  either (\ err -> exitMsg $ unlines [ "TYPE ERROR" , err ]) return $ typeCheck decls
+ src/Sit/Abs.hs view
@@ -0,0 +1,49 @@+++module Sit.Abs where++-- Haskell module generated by the BNF converter+++++newtype Ident = Ident String deriving (Eq, Ord, Show, Read)+data Prg = Prg [Decl]+  deriving (Eq, Ord, Show, Read)++data Decl = Sig Ident Exp | Def Ident Exp | Open QualId | Blank+  deriving (Eq, Ord, Show, Read)++data QualId = Sg Ident | Cons QualId Ident+  deriving (Eq, Ord, Show, Read)++data IdU = Id Ident | Under+  deriving (Eq, Ord, Show, Read)++data Bind = BIrrel Ident | BRel Ident | BAnn [Ident] Exp+  deriving (Eq, Ord, Show, Read)++data Exp+    = Var IdU+    | Int Integer+    | Infty+    | Nat+    | Set+    | Set1+    | Set2+    | Zero+    | Suc+    | Fix+    | LZero+    | LSuc+    | Size+    | App Exp Exp+    | Lam [IdU] Exp+    | Forall [Bind] Exp+    | Pi Exp Exp Exp+    | Arrow Exp Exp+    | Case Exp Exp Exp+    | Plus Exp Integer+    | ELam Exp IdU Exp+  deriving (Eq, Ord, Show, Read)+
+ src/Sit/ErrM.hs view
@@ -0,0 +1,37 @@+-- BNF Converter: Error Monad+-- Copyright (C) 2004  Author:  Aarne Ranta++-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.+module Sit.ErrM where++-- the Error monad: like Maybe type with error msgs++import Control.Monad (MonadPlus(..), liftM)+import Control.Applicative (Applicative(..), Alternative(..))++data Err a = Ok a | Bad String+  deriving (Read, Show, Eq, Ord)++instance Monad Err where+  return      = Ok+  fail        = Bad+  Ok a  >>= f = f a+  Bad s >>= _ = Bad s++instance Applicative Err where+  pure = Ok+  (Bad s) <*> _ = Bad s+  (Ok f) <*> o  = liftM f o+++instance Functor Err where+  fmap = liftM++instance MonadPlus Err where+  mzero = Bad "Err.mzero"+  mplus (Bad _) y = y+  mplus x       _ = x++instance Alternative Err where+  empty = mzero+  (<|>) = mplus
+ src/Sit/Lex.hs view
@@ -0,0 +1,423 @@+{-# OPTIONS_GHC -fno-warn-unused-binds -fno-warn-missing-signatures #-}+{-# LANGUAGE CPP,MagicHash #-}+{-# LINE 3 "Sit/Lex.x" #-}++{-# OPTIONS -fno-warn-incomplete-patterns #-}+{-# OPTIONS_GHC -w #-}+module Sit.Lex where++++import qualified Data.Bits+import Data.Word (Word8)+import Data.Char (ord)++#if __GLASGOW_HASKELL__ >= 603+#include "ghcconfig.h"+#elif defined(__GLASGOW_HASKELL__)+#include "config.h"+#endif+#if __GLASGOW_HASKELL__ >= 503+import Data.Array+import Data.Array.Base (unsafeAt)+#else+import Array+#endif+#if __GLASGOW_HASKELL__ >= 503+import GHC.Exts+#else+import GlaExts+#endif+alex_tab_size :: Int+alex_tab_size = 8+alex_base :: AlexAddr+alex_base = AlexA# "\xf8\xff\xff\xff\xd9\xff\xff\xff\x47\x00\x00\x00\xc7\x00\x00\x00\x9a\x01\x00\x00\x1a\x02\x00\x00\x1a\x03\x00\x00\xb6\xff\xff\xff\x00\x00\x00\x00\x0b\x03\x00\x00\x00\x00\x00\x00\x09\x01\x00\x00\x8b\x03\x00\x00\xdb\xff\xff\xff\x4b\x04\x00\x00\x0b\x04\x00\x00\x00\x00\x00\x00\x01\x05\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\xda\xff\xff\xff\x00\x00\x00\x00\xdc\xff\xff\xff\xda\x05\x00\x00\xd9\x01\x00\x00"#++alex_table :: AlexAddr+alex_table = AlexA# "\x00\x00\x13\x00\x13\x00\x13\x00\x13\x00\x13\x00\x11\x00\x04\x00\x01\x00\x00\x00\x15\x00\x13\x00\x13\x00\x13\x00\x13\x00\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x13\x00\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x00\x15\x00\x13\x00\x15\x00\x00\x00\x0d\x00\x16\x00\x00\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x15\x00\x15\x00\x00\x00\x15\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x15\x00\x00\x00\x00\x00\x15\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x14\x00\x02\x00\x15\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\x07\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0e\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x02\x00\x0f\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x06\x00\x07\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x03\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0e\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x10\x00\x0f\x00\x03\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0a\x00\x0b\x00\x05\x00\x08\x00\x08\x00\x08\x00\x09\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17\x00\x00\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++alex_check :: AlexAddr+alex_check = AlexA# "\xff\xff\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x2d\x00\x2d\x00\x2d\x00\xff\xff\x2e\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\xff\xff\xff\xff\xff\xff\xff\xff\x3b\x00\xff\xff\xff\xff\xff\xff\x20\x00\x3e\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x28\x00\x29\x00\x20\x00\x2b\x00\xff\xff\x2d\x00\x2e\x00\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\xff\xff\x3d\x00\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\x5c\x00\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x2d\x00\x7d\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc3\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x7d\x00\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x2d\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\xff\xff\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xff\xff\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\x00\x00\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x06\x00\x07\x00\x08\x00\x09\x00\x0a\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x15\x00\x16\x00\x17\x00\x18\x00\x19\x00\x1a\x00\x1b\x00\x1c\x00\x1d\x00\x1e\x00\x1f\x00\x20\x00\x21\x00\x22\x00\x23\x00\x24\x00\x25\x00\x26\x00\x27\x00\x28\x00\x29\x00\x2a\x00\x2b\x00\x2c\x00\x2d\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x00\x40\x00\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\x5b\x00\x5c\x00\x5d\x00\x5e\x00\x5f\x00\x60\x00\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\x7b\x00\x7c\x00\x7d\x00\x7e\x00\x7f\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x0a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\x81\x00\x82\x00\x83\x00\x84\x00\x85\x00\x86\x00\x87\x00\x88\x00\x89\x00\x8a\x00\x8b\x00\x8c\x00\x8d\x00\x8e\x00\x8f\x00\x90\x00\x91\x00\x92\x00\x93\x00\x94\x00\x95\x00\x96\x00\x97\x00\x98\x00\x99\x00\x9a\x00\x9b\x00\x9c\x00\x9d\x00\x9e\x00\x9f\x00\xa0\x00\xa1\x00\xa2\x00\xa3\x00\xa4\x00\xa5\x00\xa6\x00\xa7\x00\xa8\x00\xa9\x00\xaa\x00\xab\x00\xac\x00\xad\x00\xae\x00\xaf\x00\xb0\x00\xb1\x00\xb2\x00\xb3\x00\xb4\x00\xb5\x00\xb6\x00\xb7\x00\xb8\x00\xb9\x00\xba\x00\xbb\x00\xbc\x00\xbd\x00\xbe\x00\xbf\x00\xc0\x00\xc1\x00\xc2\x00\xc3\x00\xc4\x00\xc5\x00\xc6\x00\xc7\x00\xc8\x00\xc9\x00\xca\x00\xcb\x00\xcc\x00\xcd\x00\xce\x00\xcf\x00\xd0\x00\xd1\x00\xd2\x00\xd3\x00\xd4\x00\xd5\x00\xd6\x00\xd7\x00\xd8\x00\xd9\x00\xda\x00\xdb\x00\xdc\x00\xdd\x00\xde\x00\xdf\x00\xe0\x00\xe1\x00\xe2\x00\xe3\x00\xe4\x00\xe5\x00\xe6\x00\xe7\x00\xe8\x00\xe9\x00\xea\x00\xeb\x00\xec\x00\xed\x00\xee\x00\xef\x00\xf0\x00\xf1\x00\xf2\x00\xf3\x00\xf4\x00\xf5\x00\xf6\x00\xf7\x00\xf8\x00\xf9\x00\xfa\x00\xfb\x00\xfc\x00\xfd\x00\xfe\x00\xff\x00\x27\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x41\x00\x42\x00\x43\x00\x44\x00\x45\x00\x46\x00\x47\x00\x48\x00\x49\x00\x4a\x00\x4b\x00\x4c\x00\x4d\x00\x4e\x00\x4f\x00\x50\x00\x51\x00\x52\x00\x53\x00\x54\x00\x55\x00\x56\x00\x57\x00\x58\x00\x59\x00\x5a\x00\xff\xff\xff\xff\xff\xff\xff\xff\x5f\x00\xff\xff\x61\x00\x62\x00\x63\x00\x64\x00\x65\x00\x66\x00\x67\x00\x68\x00\x69\x00\x6a\x00\x6b\x00\x6c\x00\x6d\x00\x6e\x00\x6f\x00\x70\x00\x71\x00\x72\x00\x73\x00\x74\x00\x75\x00\x76\x00\x77\x00\x78\x00\x79\x00\x7a\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xc3\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++alex_deflt :: AlexAddr+alex_deflt = AlexA# "\xff\xff\xff\xff\x04\x00\xff\xff\x04\x00\xff\xff\x04\x00\x04\x00\x0a\x00\x0a\x00\x10\x00\x10\x00\xff\xff\xff\xff\x11\x00\x11\x00\x11\x00\x11\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++alex_accept = listArray (0::Int,24) [AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccNone,AlexAccSkip,AlexAccSkip,AlexAccSkip,AlexAcc (alex_action_3),AlexAcc (alex_action_3),AlexAcc (alex_action_3),AlexAcc (alex_action_4),AlexAcc (alex_action_5)]+{-# LINE 39 "Sit/Lex.x" #-}+++tok :: (Posn -> String -> Token) -> (Posn -> String -> Token)+tok f p s = f p s++share :: String -> String+share = id++data Tok =+   TS !String !Int    -- reserved words and symbols+ | TL !String         -- string literals+ | TI !String         -- integer literals+ | TV !String         -- identifiers+ | TD !String         -- double precision float literals+ | TC !String         -- character literals++ deriving (Eq,Show,Ord)++data Token =+   PT  Posn Tok+ | Err Posn+  deriving (Eq,Show,Ord)++printPosn :: Posn -> String+printPosn (Pn _ l c) = "line " ++ show l ++ ", column " ++ show c++tokenPos :: [Token] -> String+tokenPos (t:_) = printPosn (tokenPosn t)+tokenPos [] = "end of file"++tokenPosn :: Token -> Posn+tokenPosn (PT p _) = p+tokenPosn (Err p) = p++tokenLineCol :: Token -> (Int, Int)+tokenLineCol = posLineCol . tokenPosn++posLineCol :: Posn -> (Int, Int)+posLineCol (Pn _ l c) = (l,c)++mkPosToken :: Token -> ((Int, Int), String)+mkPosToken t@(PT p _) = (posLineCol p, prToken t)++prToken :: Token -> String+prToken t = case t of+  PT _ (TS s _) -> s+  PT _ (TL s)   -> show s+  PT _ (TI s)   -> s+  PT _ (TV s)   -> s+  PT _ (TD s)   -> s+  PT _ (TC s)   -> s+  Err _         -> "#error"+++data BTree = N | B String Tok BTree BTree deriving (Show)++eitherResIdent :: (String -> Tok) -> String -> Tok+eitherResIdent tv s = treeFind resWords+  where+  treeFind N = tv s+  treeFind (B a t left right) | s < a  = treeFind left+                              | s > a  = treeFind right+                              | s == a = t++resWords :: BTree+resWords = b "\\" 16 (b ":" 8 (b "--;" 4 (b ")" 2 (b "(" 1 N N) (b "+" 3 N N)) (b "." 6 (b "->" 5 N N) (b ".." 7 N N))) (b "Set" 12 (b "=" 10 (b ";" 9 N N) (b "Nat" 11 N N)) (b "Set2" 14 (b "Set1" 13 N N) (b "Size" 15 N N)))) (b "of" 24 (b "forall" 20 (b "case" 18 (b "_" 17 N N) (b "fix" 19 N N)) (b "lsuc" 22 (b "import" 21 N N) (b "lzero" 23 N N))) (b "suc" 28 (b "open" 26 (b "oo" 25 N N) (b "return" 27 N N)) (b "{" 30 (b "zero" 29 N N) (b "}" 31 N N))))+   where b s n = let bs = id s+                  in B bs (TS bs n)++unescapeInitTail :: String -> String+unescapeInitTail = id . unesc . tail . id where+  unesc s = case s of+    '\\':c:cs | elem c ['\"', '\\', '\''] -> c : unesc cs+    '\\':'n':cs  -> '\n' : unesc cs+    '\\':'t':cs  -> '\t' : unesc cs+    '"':[]    -> []+    c:cs      -> c : unesc cs+    _         -> []++-------------------------------------------------------------------+-- Alex wrapper code.+-- A modified "posn" wrapper.+-------------------------------------------------------------------++data Posn = Pn !Int !Int !Int+      deriving (Eq, Show,Ord)++alexStartPos :: Posn+alexStartPos = Pn 0 1 1++alexMove :: Posn -> Char -> Posn+alexMove (Pn a l c) '\t' = Pn (a+1)  l     (((c+7) `div` 8)*8+1)+alexMove (Pn a l c) '\n' = Pn (a+1) (l+1)   1+alexMove (Pn a l c) _    = Pn (a+1)  l     (c+1)++type Byte = Word8++type AlexInput = (Posn,     -- current position,+                  Char,     -- previous char+                  [Byte],   -- pending bytes on the current char+                  String)   -- current input string++tokens :: String -> [Token]+tokens str = go (alexStartPos, '\n', [], str)+    where+      go :: AlexInput -> [Token]+      go inp@(pos, _, _, str) =+               case alexScan inp 0 of+                AlexEOF                   -> []+                AlexError (pos, _, _, _)  -> [Err pos]+                AlexSkip  inp' len        -> go inp'+                AlexToken inp' len act    -> act pos (take len str) : (go inp')++alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)+alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))+alexGetByte (p, _, [], s) =+  case  s of+    []  -> Nothing+    (c:s) ->+             let p'     = alexMove p c+                 (b:bs) = utf8Encode c+              in p' `seq` Just (b, (p', c, bs, s))++alexInputPrevChar :: AlexInput -> Char+alexInputPrevChar (p, c, bs, s) = c++-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.+utf8Encode :: Char -> [Word8]+utf8Encode = map fromIntegral . go . ord+ where+  go oc+   | oc <= 0x7f       = [oc]++   | oc <= 0x7ff      = [ 0xc0 + (oc `Data.Bits.shiftR` 6)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]++   | oc <= 0xffff     = [ 0xe0 + (oc `Data.Bits.shiftR` 12)+                        , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]+   | otherwise        = [ 0xf0 + (oc `Data.Bits.shiftR` 18)+                        , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)+                        , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]++alex_action_3 =  tok (\p s -> PT p (eitherResIdent (TV . share) s)) +alex_action_4 =  tok (\p s -> PT p (eitherResIdent (TV . share) s)) +alex_action_5 =  tok (\p s -> PT p (TI $ share s))    +{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<built-in>" #-}+{-# LINE 1 "<command-line>" #-}+{-# LINE 9 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4++# 17 "/usr/include/stdc-predef.h" 3 4+++++++++++++++++++++++++++++++++++++++++++{-# LINE 9 "<command-line>" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+-- -----------------------------------------------------------------------------+-- ALEX TEMPLATE+--+-- This code is in the PUBLIC DOMAIN; you may copy it freely and use+-- it for any purpose whatsoever.++-- -----------------------------------------------------------------------------+-- INTERNALS and main scanner engine++{-# LINE 21 "templates/GenericTemplate.hs" #-}++++++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define GTE(n,m) (tagToEnum# (n >=# m))+#define EQ(n,m) (tagToEnum# (n ==# m))+#else+#define GTE(n,m) (n >=# m)+#define EQ(n,m) (n ==# m)+#endif+{-# LINE 51 "templates/GenericTemplate.hs" #-}+++data AlexAddr = AlexA# Addr#+-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ < 503+uncheckedShiftL# = shiftL#+#endif++{-# INLINE alexIndexInt16OffAddr #-}+alexIndexInt16OffAddr (AlexA# arr) off =+#ifdef WORDS_BIGENDIAN+  narrow16Int# i+  where+        i    = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)+        high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+        low  = int2Word# (ord# (indexCharOffAddr# arr off'))+        off' = off *# 2#+#else+  indexInt16OffAddr# arr off+#endif++++++{-# INLINE alexIndexInt32OffAddr #-}+alexIndexInt32OffAddr (AlexA# arr) off = +#ifdef WORDS_BIGENDIAN+  narrow32Int# i+  where+   i    = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`+                     (b2 `uncheckedShiftL#` 16#) `or#`+                     (b1 `uncheckedShiftL#` 8#) `or#` b0)+   b3   = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))+   b2   = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))+   b1   = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))+   b0   = int2Word# (ord# (indexCharOffAddr# arr off'))+   off' = off *# 4#+#else+  indexInt32OffAddr# arr off+#endif+++++++#if __GLASGOW_HASKELL__ < 503+quickIndex arr i = arr ! i+#else+-- GHC >= 503, unsafeAt is available from Data.Array.Base.+quickIndex = unsafeAt+#endif+++++-- -----------------------------------------------------------------------------+-- Main lexing routines++data AlexReturn a+  = AlexEOF+  | AlexError  !AlexInput+  | AlexSkip   !AlexInput !Int+  | AlexToken  !AlexInput !Int a++-- alexScan :: AlexInput -> StartCode -> AlexReturn a+alexScan input (I# (sc))+  = alexScanUser undefined input (I# (sc))++alexScanUser user input (I# (sc))+  = case alex_scan_tkn user input 0# input sc AlexNone of+        (AlexNone, input') ->+                case alexGetByte input of+                        Nothing -> ++++                                   AlexEOF+                        Just _ ->++++                                   AlexError input'++        (AlexLastSkip input'' len, _) ->++++                AlexSkip input'' len++        (AlexLastAcc k input''' len, _) ->++++                AlexToken input''' len k+++-- Push the input through the DFA, remembering the most recent accepting+-- state it encountered.++alex_scan_tkn user orig_input len input s last_acc =+  input `seq` -- strict in the input+  let +        new_acc = (check_accs (alex_accept `quickIndex` (I# (s))))+  in+  new_acc `seq`+  case alexGetByte input of+     Nothing -> (new_acc, input)+     Just (c, new_input) -> ++++      case fromIntegral c of { (I# (ord_c)) ->+        let+                base   = alexIndexInt32OffAddr alex_base s+                offset = (base +# ord_c)+                check  = alexIndexInt16OffAddr alex_check offset+                +                new_s = if GTE(offset,0#) && EQ(check,ord_c)+                          then alexIndexInt16OffAddr alex_table offset+                          else alexIndexInt16OffAddr alex_deflt s+        in+        case new_s of+            -1# -> (new_acc, input)+                -- on an error, we want to keep the input *before* the+                -- character that failed, not after.+            _ -> alex_scan_tkn user orig_input (if c < 0x80 || c >= 0xC0 then (len +# 1#) else len)+                                                -- note that the length is increased ONLY if this is the 1st byte in a char encoding)+                        new_input new_s new_acc+      }+  where+        check_accs (AlexAccNone) = last_acc+        check_accs (AlexAcc a  ) = AlexLastAcc a input (I# (len))+        check_accs (AlexAccSkip) = AlexLastSkip  input (I# (len))+{-# LINE 198 "templates/GenericTemplate.hs" #-}++data AlexLastAcc a+  = AlexNone+  | AlexLastAcc a !AlexInput !Int+  | AlexLastSkip  !AlexInput !Int++instance Functor AlexLastAcc where+    fmap _ AlexNone = AlexNone+    fmap f (AlexLastAcc x y z) = AlexLastAcc (f x) y z+    fmap _ (AlexLastSkip x y) = AlexLastSkip x y++data AlexAcc a user+  = AlexAccNone+  | AlexAcc a+  | AlexAccSkip
+ src/Sit/Lex.x view
@@ -0,0 +1,185 @@+-- -*- haskell -*-+-- This Alex file was machine-generated by the BNF converter+{+{-# OPTIONS -fno-warn-incomplete-patterns #-}+{-# OPTIONS_GHC -w #-}+module Sit.Lex where++++import qualified Data.Bits+import Data.Word (Word8)+import Data.Char (ord)+}+++$l = [a-zA-Z\192 - \255] # [\215 \247]    -- isolatin1 letter FIXME+$c = [A-Z\192-\221] # [\215]    -- capital isolatin1 letter FIXME+$s = [a-z\222-\255] # [\247]    -- small isolatin1 letter FIXME+$d = [0-9]                -- digit+$i = [$l $d _ ']          -- identifier character+$u = [\0-\255]          -- universal: any character++@rsyms =    -- symbols and non-identifier-like reserved words+   \: | \= | \. | \- \- \; | \_ | \. \. | \( | \) | \\ | \- \> | \+ | \{ | \; | \}++:-+"---" [.]* ; -- Toss single line comments+"{-" ([$u # \-] | \-+ [$u # [\- \}]])* ("-")+ "}" ;++$white+ ;+@rsyms { tok (\p s -> PT p (eitherResIdent (TV . share) s)) }++$l $i*   { tok (\p s -> PT p (eitherResIdent (TV . share) s)) }+++$d+      { tok (\p s -> PT p (TI $ share s))    }+++{++tok :: (Posn -> String -> Token) -> (Posn -> String -> Token)+tok f p s = f p s++share :: String -> String+share = id++data Tok =+   TS !String !Int    -- reserved words and symbols+ | TL !String         -- string literals+ | TI !String         -- integer literals+ | TV !String         -- identifiers+ | TD !String         -- double precision float literals+ | TC !String         -- character literals++ deriving (Eq,Show,Ord)++data Token =+   PT  Posn Tok+ | Err Posn+  deriving (Eq,Show,Ord)++printPosn :: Posn -> String+printPosn (Pn _ l c) = "line " ++ show l ++ ", column " ++ show c++tokenPos :: [Token] -> String+tokenPos (t:_) = printPosn (tokenPosn t)+tokenPos [] = "end of file"++tokenPosn :: Token -> Posn+tokenPosn (PT p _) = p+tokenPosn (Err p) = p++tokenLineCol :: Token -> (Int, Int)+tokenLineCol = posLineCol . tokenPosn++posLineCol :: Posn -> (Int, Int)+posLineCol (Pn _ l c) = (l,c)++mkPosToken :: Token -> ((Int, Int), String)+mkPosToken t@(PT p _) = (posLineCol p, prToken t)++prToken :: Token -> String+prToken t = case t of+  PT _ (TS s _) -> s+  PT _ (TL s)   -> show s+  PT _ (TI s)   -> s+  PT _ (TV s)   -> s+  PT _ (TD s)   -> s+  PT _ (TC s)   -> s+  Err _         -> "#error"+++data BTree = N | B String Tok BTree BTree deriving (Show)++eitherResIdent :: (String -> Tok) -> String -> Tok+eitherResIdent tv s = treeFind resWords+  where+  treeFind N = tv s+  treeFind (B a t left right) | s < a  = treeFind left+                              | s > a  = treeFind right+                              | s == a = t++resWords :: BTree+resWords = b "\\" 16 (b ":" 8 (b "--;" 4 (b ")" 2 (b "(" 1 N N) (b "+" 3 N N)) (b "." 6 (b "->" 5 N N) (b ".." 7 N N))) (b "Set" 12 (b "=" 10 (b ";" 9 N N) (b "Nat" 11 N N)) (b "Set2" 14 (b "Set1" 13 N N) (b "Size" 15 N N)))) (b "of" 24 (b "forall" 20 (b "case" 18 (b "_" 17 N N) (b "fix" 19 N N)) (b "lsuc" 22 (b "import" 21 N N) (b "lzero" 23 N N))) (b "suc" 28 (b "open" 26 (b "oo" 25 N N) (b "return" 27 N N)) (b "{" 30 (b "zero" 29 N N) (b "}" 31 N N))))+   where b s n = let bs = id s+                  in B bs (TS bs n)++unescapeInitTail :: String -> String+unescapeInitTail = id . unesc . tail . id where+  unesc s = case s of+    '\\':c:cs | elem c ['\"', '\\', '\''] -> c : unesc cs+    '\\':'n':cs  -> '\n' : unesc cs+    '\\':'t':cs  -> '\t' : unesc cs+    '"':[]    -> []+    c:cs      -> c : unesc cs+    _         -> []++-------------------------------------------------------------------+-- Alex wrapper code.+-- A modified "posn" wrapper.+-------------------------------------------------------------------++data Posn = Pn !Int !Int !Int+      deriving (Eq, Show,Ord)++alexStartPos :: Posn+alexStartPos = Pn 0 1 1++alexMove :: Posn -> Char -> Posn+alexMove (Pn a l c) '\t' = Pn (a+1)  l     (((c+7) `div` 8)*8+1)+alexMove (Pn a l c) '\n' = Pn (a+1) (l+1)   1+alexMove (Pn a l c) _    = Pn (a+1)  l     (c+1)++type Byte = Word8++type AlexInput = (Posn,     -- current position,+                  Char,     -- previous char+                  [Byte],   -- pending bytes on the current char+                  String)   -- current input string++tokens :: String -> [Token]+tokens str = go (alexStartPos, '\n', [], str)+    where+      go :: AlexInput -> [Token]+      go inp@(pos, _, _, str) =+               case alexScan inp 0 of+                AlexEOF                   -> []+                AlexError (pos, _, _, _)  -> [Err pos]+                AlexSkip  inp' len        -> go inp'+                AlexToken inp' len act    -> act pos (take len str) : (go inp')++alexGetByte :: AlexInput -> Maybe (Byte,AlexInput)+alexGetByte (p, c, (b:bs), s) = Just (b, (p, c, bs, s))+alexGetByte (p, _, [], s) =+  case  s of+    []  -> Nothing+    (c:s) ->+             let p'     = alexMove p c+                 (b:bs) = utf8Encode c+              in p' `seq` Just (b, (p', c, bs, s))++alexInputPrevChar :: AlexInput -> Char+alexInputPrevChar (p, c, bs, s) = c++-- | Encode a Haskell String to a list of Word8 values, in UTF8 format.+utf8Encode :: Char -> [Word8]+utf8Encode = map fromIntegral . go . ord+ where+  go oc+   | oc <= 0x7f       = [oc]++   | oc <= 0x7ff      = [ 0xc0 + (oc `Data.Bits.shiftR` 6)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]++   | oc <= 0xffff     = [ 0xe0 + (oc `Data.Bits.shiftR` 12)+                        , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]+   | otherwise        = [ 0xf0 + (oc `Data.Bits.shiftR` 18)+                        , 0x80 + ((oc `Data.Bits.shiftR` 12) Data.Bits..&. 0x3f)+                        , 0x80 + ((oc `Data.Bits.shiftR` 6) Data.Bits..&. 0x3f)+                        , 0x80 + oc Data.Bits..&. 0x3f+                        ]+}
+ src/Sit/Par.hs view
@@ -0,0 +1,993 @@+{-# OPTIONS_GHC -w #-}+{-# OPTIONS -fglasgow-exts -cpp #-}+{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}+module Sit.Par where+import Sit.Abs+import Sit.Lex+import Sit.ErrM+import qualified Data.Array as Happy_Data_Array+import qualified GHC.Exts as Happy_GHC_Exts+import Control.Applicative(Applicative(..))+import Control.Monad (ap)++-- parser produced by Happy Version 1.19.5++newtype HappyAbsSyn  = HappyAbsSyn HappyAny+#if __GLASGOW_HASKELL__ >= 607+type HappyAny = Happy_GHC_Exts.Any+#else+type HappyAny = forall a . a+#endif+happyIn15 :: (Ident) -> (HappyAbsSyn )+happyIn15 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn15 #-}+happyOut15 :: (HappyAbsSyn ) -> (Ident)+happyOut15 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut15 #-}+happyIn16 :: (Integer) -> (HappyAbsSyn )+happyIn16 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn16 #-}+happyOut16 :: (HappyAbsSyn ) -> (Integer)+happyOut16 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut16 #-}+happyIn17 :: (Prg) -> (HappyAbsSyn )+happyIn17 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn17 #-}+happyOut17 :: (HappyAbsSyn ) -> (Prg)+happyOut17 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut17 #-}+happyIn18 :: (Decl) -> (HappyAbsSyn )+happyIn18 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn18 #-}+happyOut18 :: (HappyAbsSyn ) -> (Decl)+happyOut18 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut18 #-}+happyIn19 :: (QualId) -> (HappyAbsSyn )+happyIn19 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn19 #-}+happyOut19 :: (HappyAbsSyn ) -> (QualId)+happyOut19 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut19 #-}+happyIn20 :: ([Decl]) -> (HappyAbsSyn )+happyIn20 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn20 #-}+happyOut20 :: (HappyAbsSyn ) -> ([Decl])+happyOut20 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut20 #-}+happyIn21 :: (IdU) -> (HappyAbsSyn )+happyIn21 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn21 #-}+happyOut21 :: (HappyAbsSyn ) -> (IdU)+happyOut21 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut21 #-}+happyIn22 :: (Bind) -> (HappyAbsSyn )+happyIn22 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn22 #-}+happyOut22 :: (HappyAbsSyn ) -> (Bind)+happyOut22 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut22 #-}+happyIn23 :: ([Bind]) -> (HappyAbsSyn )+happyIn23 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn23 #-}+happyOut23 :: (HappyAbsSyn ) -> ([Bind])+happyOut23 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut23 #-}+happyIn24 :: ([Ident]) -> (HappyAbsSyn )+happyIn24 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn24 #-}+happyOut24 :: (HappyAbsSyn ) -> ([Ident])+happyOut24 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut24 #-}+happyIn25 :: ([IdU]) -> (HappyAbsSyn )+happyIn25 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn25 #-}+happyOut25 :: (HappyAbsSyn ) -> ([IdU])+happyOut25 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut25 #-}+happyIn26 :: (Exp) -> (HappyAbsSyn )+happyIn26 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn26 #-}+happyOut26 :: (HappyAbsSyn ) -> (Exp)+happyOut26 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut26 #-}+happyIn27 :: (Exp) -> (HappyAbsSyn )+happyIn27 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn27 #-}+happyOut27 :: (HappyAbsSyn ) -> (Exp)+happyOut27 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut27 #-}+happyIn28 :: (Exp) -> (HappyAbsSyn )+happyIn28 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyIn28 #-}+happyOut28 :: (HappyAbsSyn ) -> (Exp)+happyOut28 x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOut28 #-}+happyInTok :: (Token) -> (HappyAbsSyn )+happyInTok x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyInTok #-}+happyOutTok :: (HappyAbsSyn ) -> (Token)+happyOutTok x = Happy_GHC_Exts.unsafeCoerce# x+{-# INLINE happyOutTok #-}+++happyActOffsets :: HappyAddr+happyActOffsets = HappyA# "\x7f\x00\x7f\x00\xf0\x00\x7f\x00\xf0\xff\x04\x00\x04\x00\xf0\x00\xf0\xff\x52\x00\x1a\x00\x52\x00\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xeb\x00\x3b\x00\x1a\x00\xf3\xff\x1a\x00\x04\x00\xeb\x00\xf0\xff\xeb\x00\xea\x00\xe6\x00\x04\x00\xe6\x00\xe7\x00\xe7\x00\xe7\x00\xe4\x00\xe4\x00\x43\x00\x01\x01\xe2\x00\xe1\x00\x00\x00\xfd\xff\xd2\x00\xd2\x00\x00\x00\xd1\x00\xd1\x00\x7f\x00\x1a\x00\x1a\x00\x00\x00\x00\x00\xdd\x00\x00\x00\x00\x00\x00\x00\xee\x00\xc5\x00\xe9\x00\xdc\x00\xf9\x00\x00\x00\xc2\x00\x1a\x00\xe0\x00\x00\x00\x00\x00\x00\x00\x1a\x00\xb7\x00\x1a\x00\x1a\x00\x1a\x00\x1a\x00\x00\x00\x00\x00\x00\x00\xc9\x00\x00\x00\xd0\x00\x00\x00\xb4\x00\x00\x00\xc0\x00\xbf\x00\xbe\x00\xae\x00\x1a\x00\x00\x00\x00\x00\xad\x00\x1a\x00\x00\x00\x1a\x00\x98\x00\x9d\x00\x80\x00\x66\x00\xf0\xff\x6b\x00\x54\x00\x1a\x00\xe8\xff\x00\x00\x00\x00"#++happyGotoOffsets :: HappyAddr+happyGotoOffsets = HappyA# "\x8b\x00\x06\x00\x3f\x00\xbb\x00\x82\x00\x5f\x00\xfb\x00\x38\x00\x50\x00\x61\x00\xec\x00\xef\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x00\xdb\x00\x2f\x00\xcd\x00\xf8\x00\x00\x00\x16\x00\x00\x00\x34\x00\x00\x00\xf6\x00\x00\x00\x29\x00\x55\x00\x42\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x24\x00\x15\x00\xaa\x00\xca\x00\xbc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07\x00\xb9\x00\x00\x00\x00\x00\x00\x00\x00\x00\xab\x00\x00\x00\xa8\x00\x9a\x00\x97\x00\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x86\x00\x00\x00\x00\x00\x00\x00\x78\x00\x00\x00\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x64\x00\x00\x00\x00\x00\x70\x00\x00\x00\x00\x00\x00\x00"#++happyDefActions :: HappyAddr+happyDefActions = HappyA# "\xed\xff\xed\xff\x00\x00\xed\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf3\xff\xe8\xff\xdc\xff\xdd\xff\xc7\xff\x00\x00\x00\x00\xda\xff\xd9\xff\xd8\xff\xd7\xff\xe7\xff\xd4\xff\xd2\xff\xd3\xff\xdb\xff\xd5\xff\xd6\xff\xf2\xff\x00\x00\xc9\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xdf\xff\x00\x00\xe1\xff\x00\x00\xe3\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xea\xff\x00\x00\x00\x00\xec\xff\x00\x00\x00\x00\x00\x00\xf1\xff\x00\x00\x00\x00\xed\xff\x00\x00\x00\x00\xe5\xff\xe6\xff\x00\x00\xe2\xff\xe0\xff\xde\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\xff\x00\x00\x00\x00\x00\x00\xd1\xff\xcd\xff\xcb\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xef\xff\xf0\xff\xe9\xff\xee\xff\xeb\xff\x00\x00\xcf\xff\x00\x00\xd0\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\xff\xcc\xff\x00\x00\x00\x00\xce\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xca\xff"#++happyCheck :: HappyAddr+happyCheck = HappyA# "\xff\xff\x11\x00\x01\x00\x06\x00\x11\x00\x01\x00\x00\x00\x1f\x00\x01\x00\x03\x00\x06\x00\x07\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x20\x00\x1e\x00\x11\x00\x20\x00\x13\x00\x00\x00\x00\x00\x16\x00\x17\x00\x04\x00\x19\x00\x01\x00\x06\x00\x1c\x00\x1d\x00\x22\x00\x0a\x00\x20\x00\x21\x00\x22\x00\x00\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x00\x00\x10\x00\x11\x00\x12\x00\x13\x00\x14\x00\x00\x00\x16\x00\x17\x00\x09\x00\x19\x00\x00\x00\x06\x00\x1c\x00\x1d\x00\x00\x00\x0a\x00\x20\x00\x21\x00\x01\x00\x09\x00\x03\x00\x00\x00\x05\x00\x09\x00\x00\x00\x04\x00\x00\x00\x01\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x06\x00\x08\x00\x11\x00\x0a\x00\x13\x00\x0b\x00\x00\x00\x16\x00\x17\x00\x01\x00\x19\x00\x00\x00\x06\x00\x1c\x00\x1d\x00\x05\x00\x0a\x00\x20\x00\x21\x00\x0b\x00\x0c\x00\x0d\x00\x0e\x00\x00\x00\x01\x00\x11\x00\x00\x00\x13\x00\x07\x00\x06\x00\x16\x00\x17\x00\x06\x00\x19\x00\x0b\x00\x02\x00\x1c\x00\x1d\x00\x00\x00\x01\x00\x20\x00\x21\x00\x00\x00\x01\x00\x06\x00\x11\x00\x00\x00\x01\x00\x06\x00\x0b\x00\x0c\x00\x0d\x00\x06\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x06\x00\x00\x00\x01\x00\x00\x00\x06\x00\x02\x00\x03\x00\x06\x00\x05\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x1a\x00\x00\x00\x01\x00\x1c\x00\x06\x00\x01\x00\x20\x00\x06\x00\x09\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00\x03\x00\x06\x00\x05\x00\x02\x00\x06\x00\x05\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00\x03\x00\x06\x00\x05\x00\x02\x00\x06\x00\x05\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x18\x00\x00\x00\x01\x00\x06\x00\x06\x00\x11\x00\x02\x00\x06\x00\x1d\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x01\x00\x00\x00\x01\x00\x1b\x00\x06\x00\x02\x00\x21\x00\x06\x00\x08\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x0c\x00\x0d\x00\x00\x00\x01\x00\x05\x00\x00\x00\x01\x00\x20\x00\x06\x00\x05\x00\x22\x00\x06\x00\x15\x00\x0b\x00\x0c\x00\x0d\x00\x0b\x00\x02\x00\x0d\x00\x07\x00\x08\x00\x07\x00\x08\x00\x08\x00\x07\x00\x08\x00\x22\x00\x04\x00\x22\x00\x20\x00\x22\x00\xff\xff\x20\x00\xff\xff\xff\xff\x22\x00\xff\xff\xff\xff\x20\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#++happyTable :: HappyAddr+happyTable = HappyA# "\x00\x00\x19\x00\x14\x00\x3c\x00\x19\x00\x2e\x00\x32\x00\x76\x00\x51\x00\x38\x00\x2f\x00\x30\x00\x15\x00\x16\x00\x17\x00\x18\x00\x0e\x00\x4a\x00\x19\x00\x0e\x00\x1a\x00\x36\x00\x0e\x00\x1b\x00\x1c\x00\x5b\x00\x1d\x00\x23\x00\x27\x00\x1e\x00\x1f\x00\xff\xff\x45\x00\x0e\x00\x20\x00\xff\xff\x5c\x00\x15\x00\x16\x00\x17\x00\x18\x00\x29\x00\x24\x00\x19\x00\x25\x00\x1a\x00\x26\x00\x0e\x00\x1b\x00\x1c\x00\x42\x00\x1d\x00\x29\x00\x27\x00\x1e\x00\x1f\x00\x29\x00\x48\x00\x0e\x00\x20\x00\x14\x00\x44\x00\x4d\x00\x36\x00\x4e\x00\x2a\x00\x40\x00\x37\x00\x0e\x00\x0f\x00\x15\x00\x16\x00\x17\x00\x18\x00\x10\x00\x3f\x00\x19\x00\x40\x00\x1a\x00\x4b\x00\x0e\x00\x1b\x00\x1c\x00\x14\x00\x1d\x00\x41\x00\x27\x00\x1e\x00\x1f\x00\x74\x00\x28\x00\x0e\x00\x20\x00\x15\x00\x16\x00\x17\x00\x18\x00\x0e\x00\x0f\x00\x19\x00\x0e\x00\x1a\x00\x30\x00\x10\x00\x1b\x00\x1c\x00\x71\x00\x1d\x00\x26\x00\x73\x00\x1e\x00\x1f\x00\x0e\x00\x0f\x00\x0e\x00\x20\x00\x0e\x00\x0f\x00\x10\x00\x71\x00\x0e\x00\x0f\x00\x10\x00\x11\x00\x74\x00\x21\x00\x10\x00\x11\x00\x6c\x00\x21\x00\x0e\x00\x11\x00\x6a\x00\x21\x00\x0e\x00\x0f\x00\x31\x00\x0e\x00\x0f\x00\x32\x00\x10\x00\x39\x00\x33\x00\x10\x00\x3a\x00\x11\x00\x67\x00\x21\x00\x11\x00\x5d\x00\x21\x00\x0e\x00\x0f\x00\x36\x00\x0e\x00\x0f\x00\x70\x00\x10\x00\x6f\x00\x0e\x00\x10\x00\x6e\x00\x11\x00\x5e\x00\x21\x00\x11\x00\x5f\x00\x21\x00\x0e\x00\x0f\x00\x32\x00\x0e\x00\x0f\x00\x33\x00\x10\x00\x5a\x00\x69\x00\x10\x00\x6c\x00\x11\x00\x60\x00\x21\x00\x11\x00\x62\x00\x21\x00\x0e\x00\x0f\x00\x32\x00\x0e\x00\x0f\x00\x33\x00\x10\x00\x34\x00\x64\x00\x10\x00\x6a\x00\x11\x00\x50\x00\x21\x00\x11\x00\x58\x00\x21\x00\x0e\x00\x0f\x00\x66\x00\x0e\x00\x0f\x00\x3c\x00\x10\x00\x65\x00\x67\x00\x10\x00\x62\x00\x11\x00\x59\x00\x21\x00\x11\x00\x47\x00\x21\x00\x0e\x00\x0f\x00\x54\x00\x0e\x00\x0f\x00\x56\x00\x10\x00\x50\x00\x20\x00\x10\x00\x58\x00\x11\x00\x4a\x00\x21\x00\x11\x00\x4e\x00\x21\x00\x0e\x00\x0f\x00\x55\x00\x0e\x00\x0f\x00\x0e\x00\x10\x00\x57\x00\xff\xff\x10\x00\x3d\x00\x11\x00\x20\x00\x21\x00\x11\x00\x50\x00\x12\x00\x2b\x00\x43\x00\x2b\x00\x46\x00\x53\x00\x2b\x00\x2c\x00\xff\xff\x3e\x00\xff\xff\x0e\x00\xff\xff\x00\x00\x0e\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"#++happyReduceArr = Happy_Data_Array.array (12, 56) [+	(12 , happyReduce_12),+	(13 , happyReduce_13),+	(14 , happyReduce_14),+	(15 , happyReduce_15),+	(16 , happyReduce_16),+	(17 , happyReduce_17),+	(18 , happyReduce_18),+	(19 , happyReduce_19),+	(20 , happyReduce_20),+	(21 , happyReduce_21),+	(22 , happyReduce_22),+	(23 , happyReduce_23),+	(24 , happyReduce_24),+	(25 , happyReduce_25),+	(26 , happyReduce_26),+	(27 , happyReduce_27),+	(28 , happyReduce_28),+	(29 , happyReduce_29),+	(30 , happyReduce_30),+	(31 , happyReduce_31),+	(32 , happyReduce_32),+	(33 , happyReduce_33),+	(34 , happyReduce_34),+	(35 , happyReduce_35),+	(36 , happyReduce_36),+	(37 , happyReduce_37),+	(38 , happyReduce_38),+	(39 , happyReduce_39),+	(40 , happyReduce_40),+	(41 , happyReduce_41),+	(42 , happyReduce_42),+	(43 , happyReduce_43),+	(44 , happyReduce_44),+	(45 , happyReduce_45),+	(46 , happyReduce_46),+	(47 , happyReduce_47),+	(48 , happyReduce_48),+	(49 , happyReduce_49),+	(50 , happyReduce_50),+	(51 , happyReduce_51),+	(52 , happyReduce_52),+	(53 , happyReduce_53),+	(54 , happyReduce_54),+	(55 , happyReduce_55),+	(56 , happyReduce_56)+	]++happy_n_terms = 35 :: Int+happy_n_nonterms = 14 :: Int++happyReduce_12 = happySpecReduce_1  0# happyReduction_12+happyReduction_12 happy_x_1+	 =  case happyOutTok happy_x_1 of { (PT _ (TV happy_var_1)) -> +	happyIn15+		 (Ident happy_var_1+	)}++happyReduce_13 = happySpecReduce_1  1# happyReduction_13+happyReduction_13 happy_x_1+	 =  case happyOutTok happy_x_1 of { (PT _ (TI happy_var_1)) -> +	happyIn16+		 ((read ( happy_var_1)) :: Integer+	)}++happyReduce_14 = happySpecReduce_1  2# happyReduction_14+happyReduction_14 happy_x_1+	 =  case happyOut20 happy_x_1 of { happy_var_1 -> +	happyIn17+		 (Sit.Abs.Prg happy_var_1+	)}++happyReduce_15 = happySpecReduce_3  3# happyReduction_15+happyReduction_15 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	case happyOut27 happy_x_3 of { happy_var_3 -> +	happyIn18+		 (Sit.Abs.Sig happy_var_1 happy_var_3+	)}}++happyReduce_16 = happySpecReduce_3  3# happyReduction_16+happyReduction_16 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	case happyOut27 happy_x_3 of { happy_var_3 -> +	happyIn18+		 (Sit.Abs.Def happy_var_1 happy_var_3+	)}}++happyReduce_17 = happySpecReduce_3  3# happyReduction_17+happyReduction_17 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut19 happy_x_3 of { happy_var_3 -> +	happyIn18+		 (Sit.Abs.Open happy_var_3+	)}++happyReduce_18 = happySpecReduce_0  3# happyReduction_18+happyReduction_18  =  happyIn18+		 (Sit.Abs.Blank+	)++happyReduce_19 = happySpecReduce_1  4# happyReduction_19+happyReduction_19 happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	happyIn19+		 (Sit.Abs.Sg happy_var_1+	)}++happyReduce_20 = happySpecReduce_3  4# happyReduction_20+happyReduction_20 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut19 happy_x_1 of { happy_var_1 -> +	case happyOut15 happy_x_3 of { happy_var_3 -> +	happyIn19+		 (Sit.Abs.Cons happy_var_1 happy_var_3+	)}}++happyReduce_21 = happySpecReduce_1  5# happyReduction_21+happyReduction_21 happy_x_1+	 =  case happyOut18 happy_x_1 of { happy_var_1 -> +	happyIn20+		 ((:[]) happy_var_1+	)}++happyReduce_22 = happySpecReduce_3  5# happyReduction_22+happyReduction_22 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut18 happy_x_1 of { happy_var_1 -> +	case happyOut20 happy_x_3 of { happy_var_3 -> +	happyIn20+		 ((:) happy_var_1 happy_var_3+	)}}++happyReduce_23 = happySpecReduce_1  6# happyReduction_23+happyReduction_23 happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	happyIn21+		 (Sit.Abs.Id happy_var_1+	)}++happyReduce_24 = happySpecReduce_1  6# happyReduction_24+happyReduction_24 happy_x_1+	 =  happyIn21+		 (Sit.Abs.Under+	)++happyReduce_25 = happySpecReduce_2  7# happyReduction_25+happyReduction_25 happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_2 of { happy_var_2 -> +	happyIn22+		 (Sit.Abs.BIrrel happy_var_2+	)}++happyReduce_26 = happySpecReduce_2  7# happyReduction_26+happyReduction_26 happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_2 of { happy_var_2 -> +	happyIn22+		 (Sit.Abs.BRel happy_var_2+	)}++happyReduce_27 = happyReduce 5# 7# happyReduction_27+happyReduction_27 (happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut24 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	happyIn22+		 (Sit.Abs.BAnn happy_var_2 happy_var_4+	) `HappyStk` happyRest}}++happyReduce_28 = happySpecReduce_1  8# happyReduction_28+happyReduction_28 happy_x_1+	 =  case happyOut22 happy_x_1 of { happy_var_1 -> +	happyIn23+		 ((:[]) happy_var_1+	)}++happyReduce_29 = happySpecReduce_2  8# happyReduction_29+happyReduction_29 happy_x_2+	happy_x_1+	 =  case happyOut22 happy_x_1 of { happy_var_1 -> +	case happyOut23 happy_x_2 of { happy_var_2 -> +	happyIn23+		 ((:) happy_var_1 happy_var_2+	)}}++happyReduce_30 = happySpecReduce_1  9# happyReduction_30+happyReduction_30 happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	happyIn24+		 ((:[]) happy_var_1+	)}++happyReduce_31 = happySpecReduce_2  9# happyReduction_31+happyReduction_31 happy_x_2+	happy_x_1+	 =  case happyOut15 happy_x_1 of { happy_var_1 -> +	case happyOut24 happy_x_2 of { happy_var_2 -> +	happyIn24+		 ((:) happy_var_1 happy_var_2+	)}}++happyReduce_32 = happySpecReduce_1  10# happyReduction_32+happyReduction_32 happy_x_1+	 =  case happyOut21 happy_x_1 of { happy_var_1 -> +	happyIn25+		 ((:[]) happy_var_1+	)}++happyReduce_33 = happySpecReduce_2  10# happyReduction_33+happyReduction_33 happy_x_2+	happy_x_1+	 =  case happyOut21 happy_x_1 of { happy_var_1 -> +	case happyOut25 happy_x_2 of { happy_var_2 -> +	happyIn25+		 ((:) happy_var_1 happy_var_2+	)}}++happyReduce_34 = happySpecReduce_1  11# happyReduction_34+happyReduction_34 happy_x_1+	 =  case happyOut21 happy_x_1 of { happy_var_1 -> +	happyIn26+		 (Sit.Abs.Var happy_var_1+	)}++happyReduce_35 = happySpecReduce_1  11# happyReduction_35+happyReduction_35 happy_x_1+	 =  case happyOut16 happy_x_1 of { happy_var_1 -> +	happyIn26+		 (Sit.Abs.Int happy_var_1+	)}++happyReduce_36 = happySpecReduce_1  11# happyReduction_36+happyReduction_36 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Infty+	)++happyReduce_37 = happySpecReduce_1  11# happyReduction_37+happyReduction_37 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Nat+	)++happyReduce_38 = happySpecReduce_1  11# happyReduction_38+happyReduction_38 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Set+	)++happyReduce_39 = happySpecReduce_1  11# happyReduction_39+happyReduction_39 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Set1+	)++happyReduce_40 = happySpecReduce_1  11# happyReduction_40+happyReduction_40 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Set2+	)++happyReduce_41 = happySpecReduce_1  11# happyReduction_41+happyReduction_41 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Zero+	)++happyReduce_42 = happySpecReduce_1  11# happyReduction_42+happyReduction_42 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Suc+	)++happyReduce_43 = happySpecReduce_1  11# happyReduction_43+happyReduction_43 happy_x_1+	 =  happyIn26+		 (Sit.Abs.Fix+	)++happyReduce_44 = happySpecReduce_1  11# happyReduction_44+happyReduction_44 happy_x_1+	 =  happyIn26+		 (Sit.Abs.LZero+	)++happyReduce_45 = happySpecReduce_1  11# happyReduction_45+happyReduction_45 happy_x_1+	 =  happyIn26+		 (Sit.Abs.LSuc+	)++happyReduce_46 = happySpecReduce_3  11# happyReduction_46+happyReduction_46 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut27 happy_x_2 of { happy_var_2 -> +	happyIn26+		 (happy_var_2+	)}++happyReduce_47 = happyReduce 4# 12# happyReduction_47+happyReduction_47 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut25 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	happyIn27+		 (Sit.Abs.Lam happy_var_2 happy_var_4+	) `HappyStk` happyRest}}++happyReduce_48 = happyReduce 4# 12# happyReduction_48+happyReduction_48 (happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut23 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	happyIn27+		 (Sit.Abs.Forall happy_var_2 happy_var_4+	) `HappyStk` happyRest}}++happyReduce_49 = happyReduce 7# 12# happyReduction_49+happyReduction_49 (happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut27 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	case happyOut27 happy_x_7 of { happy_var_7 -> +	happyIn27+		 (Sit.Abs.Pi happy_var_2 happy_var_4 happy_var_7+	) `HappyStk` happyRest}}}++happyReduce_50 = happySpecReduce_3  12# happyReduction_50+happyReduction_50 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut27 happy_x_3 of { happy_var_3 -> +	happyIn27+		 (Sit.Abs.Arrow happy_var_1 happy_var_3+	)}}++happyReduce_51 = happyReduce 6# 12# happyReduction_51+happyReduction_51 (happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut27 happy_x_2 of { happy_var_2 -> +	case happyOut27 happy_x_4 of { happy_var_4 -> +	case happyOut27 happy_x_6 of { happy_var_6 -> +	happyIn27+		 (Sit.Abs.Case happy_var_2 happy_var_4 happy_var_6+	) `HappyStk` happyRest}}}++happyReduce_52 = happySpecReduce_3  12# happyReduction_52+happyReduction_52 happy_x_3+	happy_x_2+	happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut16 happy_x_3 of { happy_var_3 -> +	happyIn27+		 (Sit.Abs.Plus happy_var_1 happy_var_3+	)}}++happyReduce_53 = happyReduce 17# 12# happyReduction_53+happyReduction_53 (happy_x_17 `HappyStk`+	happy_x_16 `HappyStk`+	happy_x_15 `HappyStk`+	happy_x_14 `HappyStk`+	happy_x_13 `HappyStk`+	happy_x_12 `HappyStk`+	happy_x_11 `HappyStk`+	happy_x_10 `HappyStk`+	happy_x_9 `HappyStk`+	happy_x_8 `HappyStk`+	happy_x_7 `HappyStk`+	happy_x_6 `HappyStk`+	happy_x_5 `HappyStk`+	happy_x_4 `HappyStk`+	happy_x_3 `HappyStk`+	happy_x_2 `HappyStk`+	happy_x_1 `HappyStk`+	happyRest)+	 = case happyOut27 happy_x_8 of { happy_var_8 -> +	case happyOut21 happy_x_13 of { happy_var_13 -> +	case happyOut27 happy_x_16 of { happy_var_16 -> +	happyIn27+		 (Sit.Abs.ELam happy_var_8 happy_var_13 happy_var_16+	) `HappyStk` happyRest}}}++happyReduce_54 = happySpecReduce_1  12# happyReduction_54+happyReduction_54 happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	happyIn27+		 (happy_var_1+	)}++happyReduce_55 = happySpecReduce_2  13# happyReduction_55+happyReduction_55 happy_x_2+	happy_x_1+	 =  case happyOut28 happy_x_1 of { happy_var_1 -> +	case happyOut26 happy_x_2 of { happy_var_2 -> +	happyIn28+		 (Sit.Abs.App happy_var_1 happy_var_2+	)}}++happyReduce_56 = happySpecReduce_1  13# happyReduction_56+happyReduction_56 happy_x_1+	 =  case happyOut26 happy_x_1 of { happy_var_1 -> +	happyIn28+		 (happy_var_1+	)}++happyNewToken action sts stk [] =+	happyDoAction 34# notHappyAtAll action sts stk []++happyNewToken action sts stk (tk:tks) =+	let cont i = happyDoAction i tk action sts stk tks in+	case tk of {+	PT _ (TS _ 1) -> cont 1#;+	PT _ (TS _ 2) -> cont 2#;+	PT _ (TS _ 3) -> cont 3#;+	PT _ (TS _ 4) -> cont 4#;+	PT _ (TS _ 5) -> cont 5#;+	PT _ (TS _ 6) -> cont 6#;+	PT _ (TS _ 7) -> cont 7#;+	PT _ (TS _ 8) -> cont 8#;+	PT _ (TS _ 9) -> cont 9#;+	PT _ (TS _ 10) -> cont 10#;+	PT _ (TS _ 11) -> cont 11#;+	PT _ (TS _ 12) -> cont 12#;+	PT _ (TS _ 13) -> cont 13#;+	PT _ (TS _ 14) -> cont 14#;+	PT _ (TS _ 15) -> cont 15#;+	PT _ (TS _ 16) -> cont 16#;+	PT _ (TS _ 17) -> cont 17#;+	PT _ (TS _ 18) -> cont 18#;+	PT _ (TS _ 19) -> cont 19#;+	PT _ (TS _ 20) -> cont 20#;+	PT _ (TS _ 21) -> cont 21#;+	PT _ (TS _ 22) -> cont 22#;+	PT _ (TS _ 23) -> cont 23#;+	PT _ (TS _ 24) -> cont 24#;+	PT _ (TS _ 25) -> cont 25#;+	PT _ (TS _ 26) -> cont 26#;+	PT _ (TS _ 27) -> cont 27#;+	PT _ (TS _ 28) -> cont 28#;+	PT _ (TS _ 29) -> cont 29#;+	PT _ (TS _ 30) -> cont 30#;+	PT _ (TS _ 31) -> cont 31#;+	PT _ (TV happy_dollar_dollar) -> cont 32#;+	PT _ (TI happy_dollar_dollar) -> cont 33#;+	_ -> happyError' (tk:tks)+	}++happyError_ 34# tk tks = happyError' tks+happyError_ _ tk tks = happyError' (tk:tks)++happyThen :: () => Err a -> (a -> Err b) -> Err b+happyThen = (thenM)+happyReturn :: () => a -> Err a+happyReturn = (returnM)+happyThen1 m k tks = (thenM) m (\a -> k a tks)+happyReturn1 :: () => a -> b -> Err a+happyReturn1 = \a tks -> (returnM) a+happyError' :: () => [(Token)] -> Err a+happyError' = happyError++pPrg tks = happySomeParser where+  happySomeParser = happyThen (happyParse 0# tks) (\x -> happyReturn (happyOut17 x))++pDecl tks = happySomeParser where+  happySomeParser = happyThen (happyParse 1# tks) (\x -> happyReturn (happyOut18 x))++pQualId tks = happySomeParser where+  happySomeParser = happyThen (happyParse 2# tks) (\x -> happyReturn (happyOut19 x))++pListDecl tks = happySomeParser where+  happySomeParser = happyThen (happyParse 3# tks) (\x -> happyReturn (happyOut20 x))++pIdU tks = happySomeParser where+  happySomeParser = happyThen (happyParse 4# tks) (\x -> happyReturn (happyOut21 x))++pBind tks = happySomeParser where+  happySomeParser = happyThen (happyParse 5# tks) (\x -> happyReturn (happyOut22 x))++pListBind tks = happySomeParser where+  happySomeParser = happyThen (happyParse 6# tks) (\x -> happyReturn (happyOut23 x))++pListIdent tks = happySomeParser where+  happySomeParser = happyThen (happyParse 7# tks) (\x -> happyReturn (happyOut24 x))++pListIdU tks = happySomeParser where+  happySomeParser = happyThen (happyParse 8# tks) (\x -> happyReturn (happyOut25 x))++pExp2 tks = happySomeParser where+  happySomeParser = happyThen (happyParse 9# tks) (\x -> happyReturn (happyOut26 x))++pExp tks = happySomeParser where+  happySomeParser = happyThen (happyParse 10# tks) (\x -> happyReturn (happyOut27 x))++pExp1 tks = happySomeParser where+  happySomeParser = happyThen (happyParse 11# tks) (\x -> happyReturn (happyOut28 x))++happySeq = happyDontSeq+++returnM :: a -> Err a+returnM = return++thenM :: Err a -> (a -> Err b) -> Err b+thenM = (>>=)++happyError :: [Token] -> Err a+happyError ts =+  Bad $ "syntax error at " ++ tokenPos ts ++ +  case ts of+    [] -> []+    [Err _] -> " due to lexer error"+    t:_ -> " before `" ++ id(prToken t) ++ "'"++myLexer = tokens+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<command-line>" #-}+{-# LINE 10 "<command-line>" #-}+# 1 "/usr/include/stdc-predef.h" 1 3 4++# 17 "/usr/include/stdc-predef.h" 3 4+++++++++++++++++++++++++++++++++++++++++++{-# LINE 10 "<command-line>" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+-- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp ++{-# LINE 13 "templates/GenericTemplate.hs" #-}++++++-- Do not remove this comment. Required to fix CPP parsing when using GCC and a clang-compiled alex.+#if __GLASGOW_HASKELL__ > 706+#define LT(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.<# m)) :: Bool)+#define GTE(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.>=# m)) :: Bool)+#define EQ(n,m) ((Happy_GHC_Exts.tagToEnum# (n Happy_GHC_Exts.==# m)) :: Bool)+#else+#define LT(n,m) (n Happy_GHC_Exts.<# m)+#define GTE(n,m) (n Happy_GHC_Exts.>=# m)+#define EQ(n,m) (n Happy_GHC_Exts.==# m)+#endif+{-# LINE 46 "templates/GenericTemplate.hs" #-}+++data Happy_IntList = HappyCons Happy_GHC_Exts.Int# Happy_IntList++++++{-# LINE 67 "templates/GenericTemplate.hs" #-}++{-# LINE 77 "templates/GenericTemplate.hs" #-}++{-# LINE 86 "templates/GenericTemplate.hs" #-}++infixr 9 `HappyStk`+data HappyStk a = HappyStk a (HappyStk a)++-----------------------------------------------------------------------------+-- starting the parse++happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll++-----------------------------------------------------------------------------+-- Accepting the parse++-- If the current token is 0#, it means we've just accepted a partial+-- parse (a %partial parser).  We must ignore the saved token on the top of+-- the stack in this case.+happyAccept 0# tk st sts (_ `HappyStk` ans `HappyStk` _) =+        happyReturn1 ans+happyAccept j tk st sts (HappyStk ans _) = +        (happyTcHack j (happyTcHack st)) (happyReturn1 ans)++-----------------------------------------------------------------------------+-- Arrays only: do the next action++++happyDoAction i tk st+        = {- nothing -}+++          case action of+                0#           -> {- nothing -}+                                     happyFail i tk st+                -1#          -> {- nothing -}+                                     happyAccept i tk st+                n | LT(n,(0# :: Happy_GHC_Exts.Int#)) -> {- nothing -}++                                                   (happyReduceArr Happy_Data_Array.! rule) i tk st+                                                   where rule = (Happy_GHC_Exts.I# ((Happy_GHC_Exts.negateInt# ((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#))))))+                n                 -> {- nothing -}+++                                     happyShift new_state i tk st+                                     where new_state = (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#))+   where off    = indexShortOffAddr happyActOffsets st+         off_i  = (off Happy_GHC_Exts.+# i)+         check  = if GTE(off_i,(0# :: Happy_GHC_Exts.Int#))+                  then EQ(indexShortOffAddr happyCheck off_i, i)+                  else False+         action+          | check     = indexShortOffAddr happyTable off_i+          | otherwise = indexShortOffAddr happyDefActions st+++indexShortOffAddr (HappyA# arr) off =+        Happy_GHC_Exts.narrow16Int# i+  where+        i = Happy_GHC_Exts.word2Int# (Happy_GHC_Exts.or# (Happy_GHC_Exts.uncheckedShiftL# high 8#) low)+        high = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr (off' Happy_GHC_Exts.+# 1#)))+        low  = Happy_GHC_Exts.int2Word# (Happy_GHC_Exts.ord# (Happy_GHC_Exts.indexCharOffAddr# arr off'))+        off' = off Happy_GHC_Exts.*# 2#++++++data HappyAddr = HappyA# Happy_GHC_Exts.Addr#+++++-----------------------------------------------------------------------------+-- HappyState data type (not arrays)++{-# LINE 170 "templates/GenericTemplate.hs" #-}++-----------------------------------------------------------------------------+-- Shifting a token++happyShift new_state 0# tk st sts stk@(x `HappyStk` _) =+     let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in+--     trace "shifting the error token" $+     happyDoAction i tk new_state (HappyCons (st) (sts)) (stk)++happyShift new_state i tk st sts stk =+     happyNewToken new_state (HappyCons (st) (sts)) ((happyInTok (tk))`HappyStk`stk)++-- happyReduce is specialised for the common cases.++happySpecReduce_0 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_0 nt fn j tk st@((action)) sts stk+     = happyGoto nt j tk st (HappyCons (st) (sts)) (fn `HappyStk` stk)++happySpecReduce_1 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_1 nt fn j tk _ sts@((HappyCons (st@(action)) (_))) (v1`HappyStk`stk')+     = let r = fn v1 in+       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_2 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_2 nt fn j tk _ (HappyCons (_) (sts@((HappyCons (st@(action)) (_))))) (v1`HappyStk`v2`HappyStk`stk')+     = let r = fn v1 v2 in+       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_3 i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happySpecReduce_3 nt fn j tk _ (HappyCons (_) ((HappyCons (_) (sts@((HappyCons (st@(action)) (_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')+     = let r = fn v1 v2 v3 in+       happySeq r (happyGoto nt j tk st sts (r `HappyStk` stk'))++happyReduce k i fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happyReduce k nt fn j tk st sts stk+     = case happyDrop (k Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) sts of+         sts1@((HappyCons (st1@(action)) (_))) ->+                let r = fn stk in  -- it doesn't hurt to always seq here...+                happyDoSeq r (happyGoto nt j tk st1 sts1 r)++happyMonadReduce k nt fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happyMonadReduce k nt fn j tk st sts stk =+      case happyDrop k (HappyCons (st) (sts)) of+        sts1@((HappyCons (st1@(action)) (_))) ->+          let drop_stk = happyDropStk k stk in+          happyThen1 (fn stk tk) (\r -> happyGoto nt j tk st1 sts1 (r `HappyStk` drop_stk))++happyMonad2Reduce k nt fn 0# tk st sts stk+     = happyFail 0# tk st sts stk+happyMonad2Reduce k nt fn j tk st sts stk =+      case happyDrop k (HappyCons (st) (sts)) of+        sts1@((HappyCons (st1@(action)) (_))) ->+         let drop_stk = happyDropStk k stk++             off = indexShortOffAddr happyGotoOffsets st1+             off_i = (off Happy_GHC_Exts.+# nt)+             new_state = indexShortOffAddr happyTable off_i++++          in+          happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))++happyDrop 0# l = l+happyDrop n (HappyCons (_) (t)) = happyDrop (n Happy_GHC_Exts.-# (1# :: Happy_GHC_Exts.Int#)) t++happyDropStk 0# l = l+happyDropStk n (x `HappyStk` xs) = happyDropStk (n Happy_GHC_Exts.-# (1#::Happy_GHC_Exts.Int#)) xs++-----------------------------------------------------------------------------+-- Moving to a new state after a reduction+++happyGoto nt j tk st = +   {- nothing -}+   happyDoAction j tk new_state+   where off = indexShortOffAddr happyGotoOffsets st+         off_i = (off Happy_GHC_Exts.+# nt)+         new_state = indexShortOffAddr happyTable off_i+++++-----------------------------------------------------------------------------+-- Error recovery (0# is the error token)++-- parse error if we are in recovery and we fail again+happyFail 0# tk old_st _ stk@(x `HappyStk` _) =+     let i = (case Happy_GHC_Exts.unsafeCoerce# x of { (Happy_GHC_Exts.I# (i)) -> i }) in+--      trace "failing" $ +        happyError_ i tk++{-  We don't need state discarding for our restricted implementation of+    "error".  In fact, it can cause some bogus parses, so I've disabled it+    for now --SDM++-- discard a state+happyFail  0# tk old_st (HappyCons ((action)) (sts)) +                                                (saved_tok `HappyStk` _ `HappyStk` stk) =+--      trace ("discarding state, depth " ++ show (length stk))  $+        happyDoAction 0# tk action sts ((saved_tok`HappyStk`stk))+-}++-- Enter error recovery: generate an error token,+--                       save the old token and carry on.+happyFail  i tk (action) sts stk =+--      trace "entering error recovery" $+        happyDoAction 0# tk action sts ( (Happy_GHC_Exts.unsafeCoerce# (Happy_GHC_Exts.I# (i))) `HappyStk` stk)++-- Internal happy errors:++notHappyAtAll :: a+notHappyAtAll = error "Internal Happy error\n"++-----------------------------------------------------------------------------+-- Hack to get the typechecker to accept our action functions+++happyTcHack :: Happy_GHC_Exts.Int# -> a -> a+happyTcHack x y = y+{-# INLINE happyTcHack #-}+++-----------------------------------------------------------------------------+-- Seq-ing.  If the --strict flag is given, then Happy emits +--      happySeq = happyDoSeq+-- otherwise it emits+--      happySeq = happyDontSeq++happyDoSeq, happyDontSeq :: a -> b -> b+happyDoSeq   a b = a `seq` b+happyDontSeq a b = b++-----------------------------------------------------------------------------+-- Don't inline any functions from the template.  GHC has a nasty habit+-- of deciding to inline happyGoto everywhere, which increases the size of+-- the generated parser quite a bit.+++{-# NOINLINE happyDoAction #-}+{-# NOINLINE happyTable #-}+{-# NOINLINE happyCheck #-}+{-# NOINLINE happyActOffsets #-}+{-# NOINLINE happyGotoOffsets #-}+{-# NOINLINE happyDefActions #-}++{-# NOINLINE happyShift #-}+{-# NOINLINE happySpecReduce_0 #-}+{-# NOINLINE happySpecReduce_1 #-}+{-# NOINLINE happySpecReduce_2 #-}+{-# NOINLINE happySpecReduce_3 #-}+{-# NOINLINE happyReduce #-}+{-# NOINLINE happyMonadReduce #-}+{-# NOINLINE happyGoto #-}+{-# NOINLINE happyFail #-}++-- end of Happy Template.
+ src/Sit/Par.y view
@@ -0,0 +1,135 @@+-- This Happy file was machine-generated by the BNF converter+{+{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}+module Sit.Par where+import Sit.Abs+import Sit.Lex+import Sit.ErrM++}++%name pPrg Prg+%name pDecl Decl+%name pQualId QualId+%name pListDecl ListDecl+%name pIdU IdU+%name pBind Bind+%name pListBind ListBind+%name pListIdent ListIdent+%name pListIdU ListIdU+%name pExp2 Exp2+%name pExp Exp+%name pExp1 Exp1+-- no lexer declaration+%monad { Err } { thenM } { returnM }+%tokentype {Token}+%token+  '(' { PT _ (TS _ 1) }+  ')' { PT _ (TS _ 2) }+  '+' { PT _ (TS _ 3) }+  '--;' { PT _ (TS _ 4) }+  '->' { PT _ (TS _ 5) }+  '.' { PT _ (TS _ 6) }+  '..' { PT _ (TS _ 7) }+  ':' { PT _ (TS _ 8) }+  ';' { PT _ (TS _ 9) }+  '=' { PT _ (TS _ 10) }+  'Nat' { PT _ (TS _ 11) }+  'Set' { PT _ (TS _ 12) }+  'Set1' { PT _ (TS _ 13) }+  'Set2' { PT _ (TS _ 14) }+  'Size' { PT _ (TS _ 15) }+  '\\' { PT _ (TS _ 16) }+  '_' { PT _ (TS _ 17) }+  'case' { PT _ (TS _ 18) }+  'fix' { PT _ (TS _ 19) }+  'forall' { PT _ (TS _ 20) }+  'import' { PT _ (TS _ 21) }+  'lsuc' { PT _ (TS _ 22) }+  'lzero' { PT _ (TS _ 23) }+  'of' { PT _ (TS _ 24) }+  'oo' { PT _ (TS _ 25) }+  'open' { PT _ (TS _ 26) }+  'return' { PT _ (TS _ 27) }+  'suc' { PT _ (TS _ 28) }+  'zero' { PT _ (TS _ 29) }+  '{' { PT _ (TS _ 30) }+  '}' { PT _ (TS _ 31) }++L_ident  { PT _ (TV $$) }+L_integ  { PT _ (TI $$) }+++%%++Ident   :: { Ident }   : L_ident  { Ident $1 }+Integer :: { Integer } : L_integ  { (read ( $1)) :: Integer }++Prg :: { Prg }+Prg : ListDecl { Sit.Abs.Prg $1 }+Decl :: { Decl }+Decl : Ident ':' Exp { Sit.Abs.Sig $1 $3 }+     | Ident '=' Exp { Sit.Abs.Def $1 $3 }+     | 'open' 'import' QualId { Sit.Abs.Open $3 }+     | {- empty -} { Sit.Abs.Blank }+QualId :: { QualId }+QualId : Ident { Sit.Abs.Sg $1 }+       | QualId '.' Ident { Sit.Abs.Cons $1 $3 }+ListDecl :: { [Decl] }+ListDecl : Decl { (:[]) $1 } | Decl '--;' ListDecl { (:) $1 $3 }+IdU :: { IdU }+IdU : Ident { Sit.Abs.Id $1 } | '_' { Sit.Abs.Under }+Bind :: { Bind }+Bind : '.' Ident { Sit.Abs.BIrrel $2 }+     | '..' Ident { Sit.Abs.BRel $2 }+     | '(' ListIdent ':' Exp ')' { Sit.Abs.BAnn $2 $4 }+ListBind :: { [Bind] }+ListBind : Bind { (:[]) $1 } | Bind ListBind { (:) $1 $2 }+ListIdent :: { [Ident] }+ListIdent : Ident { (:[]) $1 } | Ident ListIdent { (:) $1 $2 }+ListIdU :: { [IdU] }+ListIdU : IdU { (:[]) $1 } | IdU ListIdU { (:) $1 $2 }+Exp2 :: { Exp }+Exp2 : IdU { Sit.Abs.Var $1 }+     | Integer { Sit.Abs.Int $1 }+     | 'oo' { Sit.Abs.Infty }+     | 'Nat' { Sit.Abs.Nat }+     | 'Set' { Sit.Abs.Set }+     | 'Set1' { Sit.Abs.Set1 }+     | 'Set2' { Sit.Abs.Set2 }+     | 'zero' { Sit.Abs.Zero }+     | 'suc' { Sit.Abs.Suc }+     | 'fix' { Sit.Abs.Fix }+     | 'lzero' { Sit.Abs.LZero }+     | 'lsuc' { Sit.Abs.LSuc }+     | '(' Exp ')' { $2 }+Exp :: { Exp }+Exp : '\\' ListIdU '->' Exp { Sit.Abs.Lam $2 $4 }+    | 'forall' ListBind '->' Exp { Sit.Abs.Forall $2 $4 }+    | '(' Exp ':' Exp ')' '->' Exp { Sit.Abs.Pi $2 $4 $7 }+    | Exp1 '->' Exp { Sit.Abs.Arrow $1 $3 }+    | 'case' Exp 'return' Exp 'of' Exp { Sit.Abs.Case $2 $4 $6 }+    | Exp1 '+' Integer { Sit.Abs.Plus $1 $3 }+    | '\\' '{' '(' 'zero' '_' ')' '->' Exp ';' '(' 'suc' '_' IdU ')' '->' Exp '}' { Sit.Abs.ELam $8 $13 $16 }+    | Exp1 { $1 }+Exp1 :: { Exp }+Exp1 : Exp1 Exp2 { Sit.Abs.App $1 $2 } | Exp2 { $1 }+{++returnM :: a -> Err a+returnM = return++thenM :: Err a -> (a -> Err b) -> Err b+thenM = (>>=)++happyError :: [Token] -> Err a+happyError ts =+  Bad $ "syntax error at " ++ tokenPos ts ++ +  case ts of+    [] -> []+    [Err _] -> " due to lexer error"+    t:_ -> " before `" ++ id(prToken t) ++ "'"++myLexer = tokens+}+
+ src/Sit/Print.hs view
@@ -0,0 +1,141 @@+{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}+module Sit.Print where++-- pretty-printer generated by the BNF converter++import Sit.Abs+import Data.Char+++-- the top-level printing method+printTree :: Print a => a -> String+printTree = render . prt 0++type Doc = [ShowS] -> [ShowS]++doc :: ShowS -> Doc+doc = (:)++render :: Doc -> String+render d = rend 0 (map ($ "") $ d []) "" where+  rend i ss = case ss of+    "["      :ts -> showChar '[' . rend i ts+    "("      :ts -> showChar '(' . rend i ts+    "{"      :ts -> showChar '{' . new (i+1) . rend (i+1) ts+    "}" : ";":ts -> new (i-1) . space "}" . showChar ';' . new (i-1) . rend (i-1) ts+    "}"      :ts -> new (i-1) . showChar '}' . new (i-1) . rend (i-1) ts+    ";"      :ts -> showChar ';' . new i . rend i ts+    t  : ts@(p:_) | closingOrPunctuation p -> showString t . rend i ts+    t        :ts -> space t . rend i ts+    _            -> id+  new i   = showChar '\n' . replicateS (2*i) (showChar ' ') . dropWhile isSpace+  space t = showString t . (\s -> if null s then "" else ' ':s)+  closingOrPunctuation [c] = c `elem` ")],;."+  closingOrPunctuation _   = False++parenth :: Doc -> Doc+parenth ss = doc (showChar '(') . ss . doc (showChar ')')++concatS :: [ShowS] -> ShowS+concatS = foldr (.) id++concatD :: [Doc] -> Doc+concatD = foldr (.) id++replicateS :: Int -> ShowS -> ShowS+replicateS n f = concatS (replicate n f)++-- the printer class does the job+class Print a where+  prt :: Int -> a -> Doc+  prtList :: Int -> [a] -> Doc+  prtList i = concatD . map (prt i)++instance Print a => Print [a] where+  prt = prtList++instance Print Char where+  prt _ s = doc (showChar '\'' . mkEsc '\'' s . showChar '\'')+  prtList _ s = doc (showChar '"' . concatS (map (mkEsc '"') s) . showChar '"')++mkEsc :: Char -> Char -> ShowS+mkEsc q s = case s of+  _ | s == q -> showChar '\\' . showChar s+  '\\'-> showString "\\\\"+  '\n' -> showString "\\n"+  '\t' -> showString "\\t"+  _ -> showChar s++prPrec :: Int -> Int -> Doc -> Doc+prPrec i j = if j<i then parenth else id+++instance Print Integer where+  prt _ x = doc (shows x)+++instance Print Double where+  prt _ x = doc (shows x)+++instance Print Ident where+  prt _ (Ident i) = doc (showString ( i))+  prtList _ [x] = (concatD [prt 0 x])+  prtList _ (x:xs) = (concatD [prt 0 x, prt 0 xs])+++instance Print Prg where+  prt i e = case e of+    Prg decls -> prPrec i 0 (concatD [prt 0 decls])++instance Print Decl where+  prt i e = case e of+    Sig id exp -> prPrec i 0 (concatD [prt 0 id, doc (showString ":"), prt 0 exp])+    Def id exp -> prPrec i 0 (concatD [prt 0 id, doc (showString "="), prt 0 exp])+    Open qualid -> prPrec i 0 (concatD [doc (showString "open"), doc (showString "import"), prt 0 qualid])+    Blank -> prPrec i 0 (concatD [])+  prtList _ [x] = (concatD [prt 0 x])+  prtList _ (x:xs) = (concatD [prt 0 x, doc (showString "--;"), prt 0 xs])+instance Print QualId where+  prt i e = case e of+    Sg id -> prPrec i 0 (concatD [prt 0 id])+    Cons qualid id -> prPrec i 0 (concatD [prt 0 qualid, doc (showString "."), prt 0 id])++instance Print IdU where+  prt i e = case e of+    Id id -> prPrec i 0 (concatD [prt 0 id])+    Under -> prPrec i 0 (concatD [doc (showString "_")])+  prtList _ [x] = (concatD [prt 0 x])+  prtList _ (x:xs) = (concatD [prt 0 x, prt 0 xs])+instance Print Bind where+  prt i e = case e of+    BIrrel id -> prPrec i 0 (concatD [doc (showString "."), prt 0 id])+    BRel id -> prPrec i 0 (concatD [doc (showString ".."), prt 0 id])+    BAnn ids exp -> prPrec i 0 (concatD [doc (showString "("), prt 0 ids, doc (showString ":"), prt 0 exp, doc (showString ")")])+  prtList _ [x] = (concatD [prt 0 x])+  prtList _ (x:xs) = (concatD [prt 0 x, prt 0 xs])+instance Print Exp where+  prt i e = case e of+    Var idu -> prPrec i 2 (concatD [prt 0 idu])+    Int n -> prPrec i 2 (concatD [prt 0 n])+    Infty -> prPrec i 2 (concatD [doc (showString "oo")])+    Nat -> prPrec i 2 (concatD [doc (showString "Nat")])+    Set -> prPrec i 2 (concatD [doc (showString "Set")])+    Set1 -> prPrec i 2 (concatD [doc (showString "Set1")])+    Set2 -> prPrec i 2 (concatD [doc (showString "Set2")])+    Zero -> prPrec i 2 (concatD [doc (showString "zero")])+    Suc -> prPrec i 2 (concatD [doc (showString "suc")])+    Fix -> prPrec i 2 (concatD [doc (showString "fix")])+    LZero -> prPrec i 2 (concatD [doc (showString "lzero")])+    LSuc -> prPrec i 2 (concatD [doc (showString "lsuc")])+    Size -> prPrec i 0 (concatD [doc (showString "Size")])+    App exp1 exp2 -> prPrec i 1 (concatD [prt 1 exp1, prt 2 exp2])+    Lam idus exp -> prPrec i 0 (concatD [doc (showString "\\"), prt 0 idus, doc (showString "->"), prt 0 exp])+    Forall binds exp -> prPrec i 0 (concatD [doc (showString "forall"), prt 0 binds, doc (showString "->"), prt 0 exp])+    Pi exp1 exp2 exp3 -> prPrec i 0 (concatD [doc (showString "("), prt 0 exp1, doc (showString ":"), prt 0 exp2, doc (showString ")"), doc (showString "->"), prt 0 exp3])+    Arrow exp1 exp2 -> prPrec i 0 (concatD [prt 1 exp1, doc (showString "->"), prt 0 exp2])+    Case exp1 exp2 exp3 -> prPrec i 0 (concatD [doc (showString "case"), prt 0 exp1, doc (showString "return"), prt 0 exp2, doc (showString "of"), prt 0 exp3])+    Plus exp n -> prPrec i 0 (concatD [prt 1 exp, doc (showString "+"), prt 0 n])+    ELam exp1 idu exp2 -> prPrec i 0 (concatD [doc (showString "\\"), doc (showString "{"), doc (showString "("), doc (showString "zero"), doc (showString "_"), doc (showString ")"), doc (showString "->"), prt 0 exp1, doc (showString ";"), doc (showString "("), doc (showString "suc"), doc (showString "_"), prt 0 idu, doc (showString ")"), doc (showString "->"), prt 0 exp2, doc (showString "}")])++
+ src/Substitute.hs view
@@ -0,0 +1,201 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}++{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}++-- | Substitution and weak head evaluation++module Substitute where++import Internal++import Impossible+#include "undefined.h"++-- | Substitutions are lists of terms.++type Subst = [Term]++-- | Weakening substitution @Γ.Δ ⊢ wkS |Δ| : Γ@++wkS :: Int -> Subst+wkS n = map (Var . Index) [n,n+1..]++-- | Identity substitution @Γ ⊢ idS : Γ@.++idS :: Subst+idS = wkS 0++-- | Composing substitution+--   @+--      Γ₁ ⊢ τ : Γ₂    Γ₂ ⊢ σ : Γ₃+--      -------------------------+--      Γ₁ ⊢ compS τ σ : Γ₃+--   @++compS :: Subst -> Subst -> Subst+compS = subst++-- | Extending a substitution+--   @+--      Γ ⊢ σ : Δ    Δ ⊢ T    Γ ⊢ t : Tσ+--      --------------------------------+--      Γ ⊢ consS t σ : Δ.T+--   @++consS :: Term -> Subst -> Subst+consS = (:)++-- | Lifting a substitution under a binder.+--   @+--      Γ ⊢ σ : Δ      Δ ⊢ T+--      --------------------+--      Γ.Tσ ⊢ liftS σ : Δ.T+--   @++liftS :: Subst -> Subst+liftS s = consS (Var 0) $ weakS s++-- | Weakening a substitution.+--+--   @+--     Γ ⊢ σ : Δ    Γ ⊢ T+--     ------------------+--     Γ.T ⊢ weakS σ : Δ+--   @++weakS :: Subst -> Subst+weakS = compS (wkS 1)++-- | Looking up an entry in a substitution.++lookupS :: Subst -> Index -> Term+lookupS s i =  s !! dbIndex i++-- | Substitution for various syntactic categories.++class Substitute a where+  subst :: Subst -> a -> a++instance Substitute a => Substitute [a] where+  subst s = map (subst s)++instance Substitute a => Substitute (Dom a) where+  subst s = fmap (subst s)++instance Substitute a => Substitute (Arg a) where+  subst s = fmap (subst s)++instance Substitute a => Substitute (Elim' a) where+  subst s = fmap (subst s)++instance Substitute Term where+  subst s = \case+    Type l  -> Type $ subst s l+    Size    -> Size+    Nat a   -> Nat $ subst s a+    Zero a  -> Zero $ subst s a+    Suc a t -> Suc (subst s a) $ subst s t+    Infty   -> Infty+    Pi u t  -> Pi (subst s u) $ subst s t+    Lam r t -> Lam r $ subst s t+    Var i   -> lookupS s i+    Def f   -> Def f+    App t u -> App (subst s t) (subst s u)++instance Substitute (Abs Term) where+  subst s (Abs   x t) = Abs   x $ subst (liftS s) t+  subst s (NoAbs x t) = NoAbs x $ subst s t++raise :: Substitute a => Int -> a -> a+raise n = subst (wkS n)++{- TODO!?++-- | Application++class Substitute a => Apply a where+  applyE     :: a -> Elims -> a+  applyE t [] = t+  applyE t es = substApply t idS es++  substApply :: a -> Subst -> Elims -> a+  substApply t s es = subst s t `applyE` es++instance Apply a => Apply [a] where+  applyE ts es       = map (`applyE` es) ts+  substApply ts s es = map (\ t -> substApply t s es) ts++instance Apply a => Apply (Dom a) where+  applyE ts es       = fmap (`applyE` es) ts+  substApply ts s es = fmap (\ t -> substApply t s es) ts++instance Apply a => Apply (Arg a) where+  applyE ts es       = fmap (`applyE` es) ts+  substApply ts s es = fmap (\ t -> substApply t s es) ts++instance Apply a => Apply (Elim' a) where+  applyE ts es       = fmap (`applyE` es) ts+  substApply ts s es = fmap (\ t -> substApply t s es) ts++instance Apply Term where+  substApply t s es = case t of+    -- Eliminations+    Var i   -> lookupS s i `applyE` es+    Def f   -> foldl App (Def f) es+    App t u -> substApply t s $ Apply (subst s u) : es+    -- Eliminateables++    -- Types & non-eliminateables+    Type l+      | null es   -> Type $ subst s l+      | otherwise -> __IMPOSSIBLE__+    Size+      | null es   -> Size+      | otherwise -> __IMPOSSIBLE__+    Nat a+      | null es   -> Nat $ subst s a+      | otherwise -> __IMPOSSIBLE__+    Zero+      | null es   -> Zero+      | otherwise -> __IMPOSSIBLE__+    Suc t+      | null es   -> Suc $ subst s t+      | otherwise -> __IMPOSSIBLE__+    Infty+      | null es   -> Infty+      | otherwise -> __IMPOSSIBLE__+    Pi u t+      | null es   -> Pi (subst s u) $ subst s t+      | otherwise -> __IMPOSSIBLE__++instance Apply (Abs Term) where++  substApply (Abs x t) s = \case+    (Apply (Arg _ u) : es) -> substApply t (consS u s) es+    _ -> __IMPOSSIBLE__++  substApply (NoAbs x t) s = \case+    (Apply _ : es) -> substApply t s es+    _ -> __IMPOSSIBLE__+++-}++++-- | Construct the type of the functional for fix.+--+--   @fixType t = .(i : Size) -> ((x : Nat i) -> T i x) -> (x : Nat (i + 1)) -> T (i + 1) x++fixType :: Term -> Term+fixType t =+  Pi (Dom Irrelevant Size) $ Abs "i" $+    Pi (Dom Relevant $ f $ Var 0) $ NoAbs "_" $+      f $ sSuc $ Var 0+  where+  f a = Pi (Dom Relevant (Nat a)) $ Abs "x" $+          raise 2 t+            `App` Apply (Arg ShapeIrr $ raise 1 a)+            `App` Apply (Arg Relevant $ Var 0)
+ src/TypeChecker.hs view
@@ -0,0 +1,662 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE TupleSections #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-}++module TypeChecker where++import Control.Applicative+import Control.Monad+import Control.Monad.Except+import Control.Monad.Identity+import Control.Monad.Reader+import Control.Monad.State++import Data.Functor+import Data.Maybe+import Data.Map (Map)+import qualified Data.Map as Map+import qualified Data.Set as Set++import Debug.Trace++import qualified Sit.Abs as A+import Sit.Print+import Sit.ErrM++import Abstract as A+import Internal+import Substitute+import Evaluation++import Lens+import Impossible+#include "undefined.h"++-- | Type errors are just strings.+type TypeError = String++-- | Local context++type Cxt = [ (Id, Dom VType) ]++data TCEnv = TCEnv+  { _envCxt :: Cxt  -- ^ Typing context.+  , _envEnv :: Env  -- ^ Default environment.+  }++makeLens ''TCEnv++-- | Global state++data TCSt = TCSt+  { _stTySigs :: Map Id VType+  , _stDefs   :: Map Id Val+  }++makeLens ''TCSt++-- | The type checking monad+type Check = ReaderT TCEnv (StateT TCSt (Except TypeError))++-- * Type checker++typeCheck :: [A.Decl] -> Either String ()+typeCheck decls = runExcept (evalStateT (runReaderT (checkDecls decls) initEnv) initSt)+  where+  initEnv = TCEnv { _envCxt   = []        , _envEnv = []        }+  initSt  = TCSt  { _stTySigs = Map.empty , _stDefs = Map.empty }++checkDecls :: [A.Decl] -> Check ()+checkDecls = mapM_ checkDecl++checkDecl :: A.Decl -> Check ()+checkDecl = \case+  A.Blank{} -> return ()+  A.Open{}  -> return ()+  A.Sig x a -> checkSig x a+  A.Def x e -> checkDef x e++-- | Check a type signature.++checkSig :: A.Ident -> A.Exp -> Check ()+checkSig x0@(A.Ident x) a = traceCheck (A.Sig x0 a) $ do++  -- Check that x is not already defined+  mt <- lookupTySig x+  unless (isNothing mt) $+    throwError $ "Duplicate type signature for " ++ x++  -- Check type and add to signature+  t <- checkType a+  -- traceM $ "Adding  " ++ show x ++ "  of type  " ++ show t+  addTySig x =<< evaluate t++-- | Check a definition.++checkDef :: A.Ident -> A.Exp -> Check ()+checkDef x0@(A.Ident x) e = traceCheck (A.Def x0 e) $ do++  -- Check that x has a signature+  let noSig = throwError $ "Missing type signature for " ++ x+  t <- maybe noSig return =<< lookupTySig x++  -- Check that x has not yet a definition+  mv <- lookupDef x+  unless (isNothing mv) $+    throwError $ "Duplicate definition of " ++ x++  -- Check definition and add to signature+  v <- checkExp e t+  -- traceM $ "Adding  " ++ show x ++ "  of value  " ++ show v+  addDef x =<< evaluate v++-- | Check well-formedness of a type.++checkType :: A.Exp -> Check Type+checkType e = fst <$> inferType e++-- | Check that something is a type and infer its universe level.++inferType :: A.Exp -> Check (Type, VLevel)+inferType e = do+  let invalidType = throwError $ "Not a valid type expression: " ++ printTree e+  case e of++    -- Size type (internal use only).++    -- Each universe is closed under size quantification.+    -- Thus, we place Size in Set0.++    A.Size -> return (Size, vsConst 0)++    -- Universes (shape irrelevant)++    A.Set  -> return (Type sZero, vsConst 1)+    A.Set1 -> return (Type $ sSuc sZero, vsConst 2)+    A.Set2 -> return (Type $ sSuc $ sSuc sZero, vsConst 3)+    A.App A.Set l -> do+      a <- resurrect ShapeIrr $ checkLevel l+      v <- evaluate a+      return (Type a, vsSuc v)++    -- Natural number type (shape irrelevant)++    A.App A.Nat s -> do+      a <- resurrect ShapeIrr $ checkSize s+      v <- evaluate a+      return (Nat a, vsZero)++    -- Function types++    A.Arrow a b -> do+      (u, l1) <- inferType a+      (t, l2) <- inferType b+      return (Pi (defaultDom u) (NoAbs "_" t) , maxSize l1 l2)++    A.Pi e a b -> do+      let failure = throwError $ "Expected list of identifiers, found " ++ printTree e+      xs <- maybe failure return $ parseIdUs e+      inferPisType (map (, defaultDom a) xs) $ inferType b++    A.Forall bs c -> inferPisType (fromBind =<< bs) $ inferType c+      where+      fromBind :: A.Bind -> [(A.IdU, Dom A.Exp)]+      fromBind = \case+        A.BIrrel x  -> return (A.Id x, Dom Irrelevant A.Size)+        A.BRel   x  -> return (A.Id x, Dom ShapeIrr   A.Size)+        A.BAnn xs a -> map (\ x -> (A.Id x, defaultDom a)) xs++    -- Neutral types++    e | A.introduction e -> invalidType++    e -> do+      (t,v) <- inferExp e+      case v of+        VType l -> return (t,l)+        _ -> invalidType++inferPisType :: [(A.IdU, Dom A.Exp)] -> Check (Type, VLevel) -> Check (Type, VLevel)+inferPisType = foldr (.) id . map (uncurry inferPiType)++inferPiType :: A.IdU -> Dom A.Exp -> Check (Type, VLevel) -> Check (Type, VLevel)+inferPiType x dom cont = do++  -- Check the domain+  (u, l1) <- inferType $ unDom dom++  -- Check the codomain in the extended context.+  v <- evaluate u+  addContext (x, v) $ do+    (t, l2) <- cont++    -- Compute the universe level of the Pi-type.+    let l0 = maxSize l1 l2++    -- Check that the level does not mention the bound variable+    -- If yes, return oo instead.+    l <- case fromMaybe __IMPOSSIBLE__ $ sizeView l0 of+      SVVar k' _ -> do+        k <- length <$> asks _envCxt+        return $ if k' >= k then VInfty else l0+      _ -> return l0++    -- Construct the function type+    return ( Pi (dom $> u) $ Abs (fromIdU x) t , l )++checkSize :: A.Exp -> Check Size+checkSize e = checkExp e VSize+-- checkSize = \case+--   A.Infty        -> return Infty+--   A.LZero        -> return $ sZero+--   A.App A.LSuc e -> sSuc <$> checkSize e+--   e@(A.Var x)    -> checkExp e VSize+--   e -> throwError $ "Not a valid size expression: " ++ printTree e++checkLevel :: A.Exp -> Check Level+checkLevel = \case+  A.LZero        -> return $ sZero+  A.App A.LSuc e -> sSuc <$> checkLevel e+  e@(A.Var x)    -> checkExp e VSize+  e -> throwError $ "Not a valid level expression: " ++ printTree e++-- maxLevel :: A.Exp -> VLevel -> VLevel -> Check VLevel+-- maxLevel e l1 l2 = maybe failure return $ maxSize l1 l2+--   where failure = throwError $ "Cannot assign a universe level to type " ++ printTree e++checkExp :: A.Exp -> VType -> Check Term+checkExp e0 t = do+  case e0 of++    -- Functions++    A.Lam []     e -> checkExp e t+    A.Lam (x:xs) e -> do+      case t of+        VPi dom cl -> addContext (x, dom) $ do+          t' <- applyClosure cl =<< lastVal+          u  <- checkExp (A.Lam xs e) t'+          return $ Lam (_domInfo dom) $ Abs (fromIdU x) u+        _ -> throwError $ "Lambda abstraction expects function type, but got " ++ show t++    e@(A.ELam ez x0 es) -> do+      case t of+        VPi (Dom r (VNat b)) cl -> do+          let x = A.fromIdU x0+          unless (r == Relevant) $ throwError $+            "Extended lambda constructs relevant function: " ++ printTree e+          -- Infer the type of the case expression+          tt <- reifyType t+          -- Make sure that b is a successor size+          -- let failNotSuc = throwError $ "Splitting Nat is only possible at successor size, when checking " ++ printTree e+          -- a  <- maybe failNotSuc return $ sizePred b+          let a = fromMaybe __IMPOSSIBLE__ $ sizePred b+          ta <- reifySize a+          tz <- checkExp ez =<< applyClosure cl (VZero a)+          (ts0, tS0) <-+            addContext (x, Dom Relevant $ VNat a) $ do+              vts <- applyClosure cl =<< do VSuc a <$> lastVal+              tS0 <- reifyType vts+              (,tS0) <$> checkExp es vts+          let ts = Lam Relevant $ Abs x ts0+          let tS = Pi (Dom Relevant $ Nat ta) $ Abs x tS0+          return $ Lam Relevant $ Abs "x" $ App (Var 0) $ raise 1 $+            Case tt tz tS ts++        _ -> throwError $ "Extended lambda is function from Nat _, but here it got type " ++ show t++    e -> do+      (u, ti) <- inferExp e+      coerce u ti t+    -- e -> nyi $ "checking " ++ printTree e++-- | Infers neutrals, natural numbers, types.++inferExp :: A.Exp -> Check (Term, VType)+inferExp e0 = case (e0, appView e0) of++  (e,_) | mustBeType e -> do+    (t, l) <- inferType e+    return (t, VType l)++  (e, (A.Zero, es)) -> do+    case es of+      [ ea ] -> do+        a <- resurrect Irrelevant $ checkSize ea+        (zero a ,) . VNat . vsSuc <$> evaluate a+      _ -> throwError $ "zero expects exactly 1 argument: " ++ printTree e++  (e, (A.Suc, es)) -> do+    case es of+      [ ea, en ] -> do+        a <- resurrect Irrelevant $ checkSize ea+        va <- evaluate a+        n <- checkExp en $ VNat va+        return (suc a n, VNat $ vsSuc va)+      _ -> throwError $ "suc expects exactly 2 arguments: " ++ printTree e++  (e, (A.Fix, es)) -> do+    case es of+      (et : ef : en : []) -> do+        -- Check the motive of elimination+        tT <- checkExp et fixKindV+        -- Check the functional+        let tF = fixType tT+        tf <- checkExp ef =<< evaluate tF+        -- Check the argument+        (tn, a) <- inferNat en+        -- Compute the type of the elimination+        vT <- evaluate tT+        admissible vT+        vn <- evaluate tn+        ve <- applyArgs vT [ Arg ShapeIrr a , Arg Relevant vn ]+        -- Return as postfix application+        return (App tn $ Fix tT tF tf, ve)++      _ -> throwError $ "fix expects exactly 3 arguments: " ++ printTree e++  (A.Infty, _) -> return (Infty, VSize)++  (A.Plus e k, _) -> do+    u <- checkSize e+    return (sPlus u k, VSize)++  -- (A.Plus x k, _) -> do+  --   (u, t) <- inferId x+  --   subType t VSize+  --   return (sPlus u k, t)++  (A.Var A.Under, _) -> throwError "Illegal expression: _"+  (A.Var (A.Id x), _) -> inferId x++  (e0@(A.App f e), _) -> do+    (tf, t) <- inferExp f+    case t of+      VPi (Dom r tdom) cl -> do+        te <- resurrect r $ checkExp e tdom+        v  <- evaluate te+        (App tf $ Apply $ Arg r te,) <$> applyClosure cl v+      _ -> throwError $ "Function type expected in application " ++ printTree e0+             ++ " ; but found type" ++ show t+++  (A.Case{}, _)  -> nyi "case"++  (e, _) -> nyi $ "inferring type of " ++ printTree e++-- | Infer type of a variable++inferId :: A.Ident -> Check (Term, VType)+inferId (A.Ident x) = do+  (lookupCxt x <$> asks _envCxt) >>= \case+    Just (i, Dom r t)+      | r == Relevant -> return (Var $ Index i, t)+      | otherwise     -> throwError $ "Illegal reference to " ++ show r ++ " variable: " ++ printTree x++    Nothing     -> do+      (Map.lookup x <$> use stTySigs) >>= \case+        Nothing -> throwError $ "Identifier not in scope: " ++ x+        Just t  -> return (Def x, t)++inferNat :: A.Exp -> Check (Term, VSize)+inferNat e = do+  (u,t) <- inferExp e+  case t of+    VNat a -> return (u, a)+    _ -> throwError $ "Expected natural number, but found " ++ printTree e++-- | Coercion / subtype checking.++coerce :: Term -> VType -> VType -> Check Term+coerce u ti tc = do+  subType ti tc+  return u++-- | Type checker auxiliary functions.++traceCheck :: Print a => a -> b -> b+traceCheck a = trace $ "Checking " ++ printTree a++nyi :: String -> Check a+nyi = throwError . ("Not yet implemented: " ++)++-- | Signature auxiliary functions++lookupTySig :: Id -> Check (Maybe VType)+lookupTySig x = Map.lookup x <$> use stTySigs++lookupDef :: Id -> Check (Maybe Val)+lookupDef x = Map.lookup x <$> use stDefs++addTySig :: Id -> VType -> Check ()+addTySig x t = stTySigs %= Map.insert x t++addDef :: Id -> Val -> Check ()+addDef x v = stDefs %= Map.insert x v++-- * Invoking evaluation++instance MonadEval (Reader (Map Id Val)) where+  getDef x = fromMaybe __IMPOSSIBLE__ . Map.lookup x <$> ask++evaluate :: Term -> Check Val+evaluate t = do+  sig   <- use stDefs+  delta <- asks _envEnv+  return $ runReader (evalIn t delta) sig++applyClosure :: VClos -> Val -> Check Val+applyClosure cl v =+  runReader (applyClos cl v) <$> use stDefs++applyElims :: Val -> VElims -> Check Val+applyElims v es =+  runReader (applyEs v es) <$> use stDefs++applyArgs :: Val -> [Arg Val] -> Check Val+applyArgs v = applyElims v . map Apply++reifyType :: VType -> Check Type+reifyType t = do+  n <- length <$> asks _envCxt+  sig <- use stDefs+  return $ runReader (runReaderT (readbackType t) n) sig++reifySize :: VSize -> Check Size+reifySize t = do+  n <- length <$> asks _envCxt+  sig <- use stDefs+  return $ runReader (runReaderT (readbackSize t) n) sig++-- * Context manipulation++-- | Looking up in the typing context++lookupCxt :: Id -> Cxt -> Maybe (Int, Dom VType)+lookupCxt x cxt = loop 0 cxt+  where+  loop i = \case+    [] -> Nothing+    ((y,t) : cxt)+      | x == y    -> Just (i,t)+      | otherwise -> loop (succ i) cxt+++-- | Value of last variable added to context.++lastVal :: Check Val+lastVal = head <$> asks _envEnv++-- | Extending the typing context++class AddContext a where+  addContext :: a -> Check b -> Check b++instance AddContext a => AddContext [a] where+  addContext as = foldr (.) id $ map addContext as++-- A.IdU instances++instance AddContext (A.IdU, Type) where+  addContext (x,t) = addContext (fromIdU x, t)++instance AddContext (A.IdU, VType) where+  addContext (x,t) = addContext (fromIdU x, t)++instance AddContext (A.IdU, Dom VType) where+  addContext (x,t) = addContext (fromIdU x, t)++-- Id instances++instance AddContext (Id, Type) where+  addContext (x,t) cont = do+    t <- evaluate t+    addContext (x,t) cont++instance AddContext (Id, VType) where+  addContext (x,t) = addContext (x, defaultDom t)++instance AddContext (Id, Dom VType) where+  addContext (x,t) = local+    $ over envCxt ((x,t):)+    . over envEnv nextVar+    where nextVar delta = vVar (unDom t) (length delta) : delta++-- | Context: resurrecting irrelevant variables+resurrect :: Relevance -> Check a -> Check a+resurrect = \case+  -- Relevant application: resurrect nothing.+  Relevant   -> id+  -- Irrelevant application: resurrect everything.+  Irrelevant -> local $ over envCxt $ map $ over _2 $ set domInfo Relevant+  -- Shape irrelevant application: resurrect shape-irrelevant variables.+  ShapeIrr   -> local $ over envCxt $ map $ over _2 $ over domInfo $ resSI+    where+    resSI = \case+      ShapeIrr -> Relevant+      r -> r++-- * Subtyping and type equality++subType :: Val -> Val -> Check ()+subType ti tc = do+  let failure = throwError $ "Subtyping failed: type " ++ show ti+        ++ " is not a subtype of " ++ show tc+  case (ti, tc) of+    (VNat  a, VNat  b) -> unless (leqSize a b) failure+    (VType a, VType b) -> unless (leqSize a b) failure+    (VPi dom1 cl1, VPi dom2 cl2) -> do+      unless (_domInfo dom2 <= _domInfo dom1) failure+      subType (unDom dom2) (unDom dom1)+      addContext (absName $ closBody cl2, dom2) $ do+        v  <- lastVal+        b1 <- applyClosure cl1 v+        b2 <- applyClosure cl2 v+        subType b1 b2+    _ -> equalType ti tc++equalType :: Val -> Val -> Check ()+equalType v v' = do+  t  <- reifyType v+  t' <- reifyType v'+  unless (t == t') $+    throwError $ "Inferred type " ++ show t ++ " is not equal to expected type " ++ show t'++-- * Admissibility check for the type of @fix@.++-- | A simple positivity check.+--+--   For the type constructor T of fix we check that+--   @+--     i : ..Size, x : Nat i |- T i x <= T oo x+--   @+--   This does not introduce a new concept an is sound, but excludes+--   @+--     min : forall .i -> Nat i -> Nat i -> Nat i+--   @++admissible :: Val -> Check ()+admissible v = do+  k <- length <$> asks _envCxt+  addContext ("i", VSize) $ do+    va <- lastVal+    addContext ("x", VNat $ va) $ do+      u  <- lastVal+      t1  <- applyArgs v [ Arg ShapeIrr va, Arg Relevant u]+      t2  <- applyArgs v [ Arg ShapeIrr VInfty, Arg Relevant u]+      subType t1 t2++-- | Semi-continuity check (to be completed)++admissibleSemi :: Val -> Check ()+admissibleSemi v = do+  k <- length <$> asks _envCxt+  addContext ("i", VSize) $ do+    va <- lastVal+    addContext ("x", VNat $ va) $ do+      u  <- lastVal+      tv  <- applyArgs v [ Arg ShapeIrr va, Arg Relevant u]+      debug "testing upperSemi" k tv+      ok <- upperSemi k tv+      unless ok $ do+        t <- reifyType tv+        a <- reifySize va+        throwError $+          "Type " ++ show t ++ " of fix needs to be upper semi-continuous in size " ++ show a++debug :: String -> VGen -> VType -> Check ()+debug txt k tv = do+    a <- reifySize $ vsVar k+    t <- reifyType tv+    traceM $ txt ++ " " ++ show a ++ "  " ++ show t++-- | For a function type to be upper semi-continuous,+--   its codomain needs to be so, and+--   the domain needs to be lower semi-continous.++upperSemi :: VGen -> VType -> Check Bool+upperSemi k t = do+  debug "upperSemi" k t+  case t of+    VPi dom cl -> do+      lowerSemi k $ unDom dom+      addContext (absName $ closBody cl, dom) $ do+        v <- lastVal+        upperSemi k =<< applyClosure cl v+    VType{}         -> return True+    VSize           -> return True+    VNat{}          -> return True+    t@(VUp (VType _) _) -> monotone k True t+    t -> do+     traceM $ "upperSemi " ++ show k ++ "  " ++ show t+     __IMPOSSIBLE__++-- | Base types and antitone types are lower semi-continuous.++lowerSemi :: VGen -> VType -> Check Bool+lowerSemi k t = do+  debug "lowerSemi" k t+  case t of+    t@(VPi dom cl)  -> monotone k False t+    VType{}         -> return True+    VSize           -> return True+    VNat{}          -> return True+    t@(VUp (VType _) _) -> monotone k False t+    t -> do+     traceM $ "lowerSemi " ++ show k ++ "  " ++ show t+     __IMPOSSIBLE__++-- antitone :: VGen -> VType -> Check Bool+-- antitone k t = do+--   traceM $ "\nantitone " ++ show k ++ "  " ++ show t+--   return True++monotone :: VGen -> Bool -> VType -> Check Bool+monotone k b t = do+  debug (if b then "monotone" else "antitone") k t+  case t of+    VPi dom cl -> do+      monotone k (not b) $ unDom dom+      addContext (absName $ closBody cl, dom) $ do+        u <- lastVal+        monotone k b =<< applyClosure cl u+    VType a -> monotoneSize k b a+    VNat  a -> monotoneSize k b a+    VSize   -> return True+    -- VInfty  -> return True+    -- VZero _ -> return True+    -- VSuc _ v -> monotone k b v+    -- VLam cl  -> addContext ("#", VSize) $ do+    --   u <- lastVal+    --   monotone k b =<< applyClosure cl u+    -- VUp _ (VNe k' es)+    --   | k == k'   -> return b+    --   | otherwise -> return True+    VUp (VType _) _ -> return True+    _ -> __IMPOSSIBLE__++  -- traceM $ "\nmonotone " ++ show k ++ "  " ++ show t+  -- return True++monotoneSize :: VGen -> Bool -> VSize -> Check Bool+monotoneSize k b t = do+  debugSize (if b then "monotone" else "antitone") k t+  case t of+    VInfty  -> return True+    VZero _ -> return True+    VSuc _ v -> monotoneSize k b v+    VUp _ (VNe k' es)+      | k == k'   -> do+          traceM $ "same var"+          unless b $ throwError "admissibility check failed"+          return b+      | otherwise -> return True+    _ -> __IMPOSSIBLE__++debugSize :: String -> VGen -> VType -> Check ()+debugSize txt k v = do+    a <- reifySize $ vsVar k+    b <- reifySize v+    traceM $ txt ++ " " ++ show a ++ "  " ++ show b
+ src/undefined.h view
@@ -0,0 +1,1 @@+#define __IMPOSSIBLE__ (throwImpossible (Impossible __FILE__ __LINE__))
+ test/Base.agda view
@@ -0,0 +1,32 @@+{-# OPTIONS --experimental-irrelevance #-}++open import Agda.Primitive+  public using (lzero; lsuc)++open import Agda.Builtin.Size+  public using (Size; ↑_) renaming (ω to oo)++open import Agda.Builtin.Nat+  public using (suc) renaming (Nat to ℕ)++_+_ : Size → ℕ → Size+s + 0 = s+s + suc n = ↑ (s + n)++data Nat : ..(i : Size) → Set where+  zero : ∀ .i → Nat (↑ i)+  suc  : ∀ .i → Nat i → Nat (↑ i)++caseof : ∀{a b} {A : Set a} (B : A → Set b) → (x : A) → ((x : A) → B x) → B x+caseof B x f = f x++syntax caseof B x f = case x return B of f++fix : ∀{ℓ}+  (T : ..(i : Size) → Nat i → Set ℓ)+  (f : ∀ .j → ((x : Nat j) → T j x) → (x : Nat (↑ j)) → T (↑ j) x)+  .{i}+  (x : Nat i)+  → T i x+fix T f (zero j)  = f j (fix T f) (zero j)+fix T f (suc j n) = f j (fix T f) (suc j n)
+ test/Makefile view
@@ -0,0 +1,2 @@+default :+	make -C ../src
+ test/Test.agda view
@@ -0,0 +1,175 @@+--- Sample Sit file++{-# OPTIONS --experimental-irrelevance #-}++open import Base++--; --- Leibniz-equality++Eq : forall (A : Set) (a b : A) -> Set1 --;+Eq = \ A a b -> (P : A -> Set) -> (P a) -> P b++--; --- Reflexivity++refl : forall (A : Set) (a : A) -> Eq A a a --;+refl = \ A a P pa -> pa++--; --- Symmetry++sym : forall (A : Set) (a b : A) -> Eq A a b -> Eq A b a --;+sym = \ A a b eq P pb ->  eq (\ x -> P x -> P a) (\ pa -> pa) pb++--; --- Transitivity++trans : forall (A : Set) (a b c : A) -> Eq A a b -> Eq A b c -> Eq A a c --;+trans = \ A a b c p q P pa -> q P (p P pa)++--; --- Congruence++cong : forall (A B : Set) (f : A -> B) (a a' : A) -> Eq A a a' -> Eq B (f a) (f a') --;+cong = \ A B f a a' eq P pfa -> eq (\ x -> P (f x)) pfa++--; --- Addition++plus : forall .i -> Nat i -> Nat oo -> Nat oo --;+plus = \ i x y ->+  fix (\ i x -> Nat oo)+      (\ _ f -> \+              { (zero _)   -> y+              ; (suc _ x) -> suc oo (f x)+              })+      x++--; --- Unit tests for plus++inc : Nat oo -> Nat oo --;+inc = \ x -> suc oo x  --;++one : Nat oo        --;+one = inc (zero oo) --;++two : Nat oo  --;+two = inc one --;++three : Nat oo  --;+three = inc two --;++four : Nat oo  --;+four = inc three --;++five : Nat oo  --;+five = inc four --;++six : Nat oo  --;+six = inc five --;++plus_one_zero : Eq (Nat oo) (plus oo one (zero oo)) one --;+plus_one_zero = refl (Nat oo) one  --;++plus_one_one : Eq (Nat oo) (plus oo one one) two --;+plus_one_one = refl (Nat oo) two  --;++--; --- Reduction rules for plus++plus_red_zero : forall .i (y : Nat oo) -> Eq (Nat oo) (plus (i + 1) (zero i) y) y  --;+plus_red_zero = \ i y -> refl (Nat oo) y  --;++plus_red_suc : forall .i (x : Nat i) (y : Nat oo) -> Eq (Nat oo) (plus (i + 1) (suc i x) y) (suc oo (plus i x y))  --;+plus_red_suc = \ i x y -> refl (Nat oo) (suc oo (plus i x y))  --;++--; --- Law: x + 0 = x++plus_zero : forall .i (x : Nat i) -> Eq (Nat oo) (plus i x (zero oo)) x  --;+plus_zero = \ i x ->+  fix (\ i x -> Eq (Nat oo) (plus i x (zero oo)) x)+      (\ j f -> \+         { (zero _)  -> refl (Nat oo) (zero oo)+         ; (suc _ y) -> cong (Nat oo) (Nat oo) inc (plus j y (zero oo)) y (f y)+         })+      x++--; --- Law: x + suc y = suc x + y++plus_suc : forall .i (x : Nat i) (y : Nat oo) -> Eq (Nat oo) (plus i x (inc y)) (inc (plus i x y))  --;+plus_suc = \ i x y ->+  fix (\ i x -> Eq (Nat oo) (plus i x (inc y)) (inc (plus i x y)))+      (\ j f -> \+         { (zero _)  -> refl (Nat oo) (inc y)+         ; (suc _ x') -> cong (Nat oo) (Nat oo) inc (plus j x' (inc y)) (inc (plus j x' y)) (f x')+         })+      x++--; --- Another definition of addition++plus' : forall .i -> Nat i -> Nat oo -> Nat oo  --;+plus' = \ i x ->+  fix (\ i x -> Nat oo -> Nat oo)+      (\ _ f -> \+         { (zero _)  -> \ y -> y+         ; (suc _ x) -> \ y -> suc oo (f x y)+         })+      x++--; --- Predecessor++pred  : forall .i -> Nat i -> Nat i  --;+pred = \ i n ->+  fix (\ i _ -> Nat i)+      (\ i _ -> \{ (zero _) -> zero i ; (suc _ y) -> y })+      n++--; --- Subtraction++sub : forall .j -> Nat j -> forall .i -> Nat i -> Nat i  --;+sub = \ j y ->+  fix (\ _ _ -> forall .i -> Nat i -> Nat i)+      (\ _ f -> \+        { (zero _) -> \ i x -> x+        ; (suc _ y) -> \ i x -> f y i (pred i x)+        }) --- pred i (f y i x) })+      y++--; --- Lemma: x - x == 0++sub_diag : forall .i (x : Nat i) -> Eq (Nat oo) (sub i x i x) (zero oo)  --;+sub_diag = \ i x ->+  fix (\ i x -> Eq (Nat oo) (sub i x i x) (zero oo))+      (\ _ f -> \+        { (zero _) -> refl (Nat oo) (zero oo)+        ; (suc _ y) -> f y+        })+      x++--- Large eliminations++--; --- Varying arity++Fun : forall .i (n : Nat i) (A : Set) (B : Set) -> Set --;+Fun = \ i n A B ->+  fix (\ _ _ -> Set)+      (\ _ f -> \+         { (zero _) -> B+         ; (suc _ x) -> A -> f x+         })+      n++--; --- Type of n-ary Sum function++Sum : forall .i (n : Nat i) -> Set  --;+Sum = \ i n -> Nat oo -> Fun i n (Nat oo) (Nat oo)++--; --- n-ary summation function++sum : forall .i (n : Nat i) -> Sum i n --;+sum = \ _ n ->+  fix (\ i n -> Sum i n)+      (\ _ f -> \+        { (zero _) -> \ acc -> acc+        ; (suc _ x) -> \ acc -> \ k -> f x (plus oo k acc)+        })+      n++--; --- Testing sum++sum123 : Eq (Nat oo) (sum oo three (zero oo) one two three) six --;+sum123 = refl (Nat oo) six