~ubuntu-branches/ubuntu/raring/agda/raring-proposed

« back to all changes in this revision

Viewing changes to src/full/Agda/Auto/Syntax.hs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane
  • Date: 2010-01-05 23:43:20 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100105234320-6ksc0sdsfhtweknu
Tags: 2.2.6-1
* New upstream release 2.2.6, for headlines please see:
  http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.Version-2-2-6
* debian/control
  + Bump standards-version to 3.8.3, no changes
  + Fix Vcs-Git to point to correct URL
  + Update build-depends for new upstream release
  + Undo arch/indep split per current pkg-haskell practice
  + Add Homepage field
* debian/copyright: Fix encoding to UTF-8 (thanks Lintian) 
* debian/README.source: Remove, no repacking so not necessary any more 
* debian/50agda.el:
  + Only load file if it exists, prevents a non-intrusive emacs warning
    where 50agda.el is left on system when package is removed. 
    (Closes: #559197). 
  + Do not load file on XEmacs — agda-mode is not compatible with XEmacs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{-# OPTIONS -fglasgow-exts #-}
 
2
 
 
3
module Agda.Auto.Syntax where
 
4
 
 
5
import Data.IORef
 
6
 
 
7
import Agda.Auto.NarrowingSearch
 
8
 
 
9
 
 
10
data RefInfo o = RIEnv [ConstRef o]
 
11
               | RIMainInfo Nat (HNExp o)
 
12
               | forall a . RIUnifInfo (Metavar a (RefInfo o)) [CAction o] (HNExp o)  -- metavar is the flexible side of the equality
 
13
 
 
14
type MyPB o = PB (RefInfo o)
 
15
type MyMB a o = MB a (RefInfo o)
 
16
 
 
17
type Nat = Int
 
18
 
 
19
data FMode = Hidden
 
20
           | NotHidden
 
21
 deriving Eq
 
22
 
 
23
data MId = Id String
 
24
         | NoId
 
25
 
 
26
data Abs a = Abs MId a
 
27
 
 
28
data ConstDef o = ConstDef {cdname :: String, cdorigin :: o, cdtype :: MExp o, cdcont :: DeclCont o}  -- contains no metas
 
29
 
 
30
data DeclCont o = Def Nat [Clause o]
 
31
                | Datatype [ConstRef o]  -- constructors
 
32
                | Constructor
 
33
                | Postulate
 
34
 
 
35
type Clause o = ([Pat o], MExp o)
 
36
 
 
37
data Pat o = PatConApp (ConstRef o) [Pat o]
 
38
           | PatVar
 
39
           | PatExp
 
40
 
 
41
type ConstRef o = IORef (ConstDef o)
 
42
 
 
43
data Elr o = Var Nat
 
44
           | Const (ConstRef o)
 
45
 
 
46
data Sort = SortLevel Nat
 
47
          | Type
 
48
 
 
49
data Exp o = App (Elr o) (MArgList o)
 
50
           | Lam FMode (Abs (MExp o))
 
51
           | Fun FMode (MExp o) (MExp o)
 
52
           | Pi FMode Bool (MExp o) (Abs (MExp o))  -- true if possibly dependent (var not known to not occur)
 
53
           | Sort Sort
 
54
 
 
55
type MExp o = MM (Exp o) (RefInfo o)
 
56
 
 
57
data ArgList o = ALNil
 
58
               | ALCons FMode (MExp o) (MArgList o)
 
59
               | ALConPar (MArgList o)  -- inserted to cover glitch of polymorphic constructor applications coming from Agda
 
60
 
 
61
type MArgList o = MM (ArgList o) (RefInfo o)
 
62
 
 
63
data HNExp o = HNApp (Elr o) (CArgList o)
 
64
             | HNLam (Abs (CExp o))
 
65
             | HNFun FMode (CExp o) (CExp o)
 
66
             | HNPi FMode Bool (CExp o) (Abs (CExp o))
 
67
             | HNSort Sort
 
68
 
 
69
data HNArgList o = HNALNil
 
70
                 | HNALCons (CExp o) (CArgList o)
 
71
                 | HNALConPar (CArgList o)
 
72
 
 
73
type CExp o = Clos (MExp o) o
 
74
 
 
75
data CArgList o = CALNil
 
76
                | CALConcat (Clos (MArgList o) o) (CArgList o)
 
77
 -- !! (CALCons and CALConcat are used differently by eta rule in hncomp, but could replace those uses by a new CALSnoc construction)
 
78
 
 
79
data Clos a o = Clos [CAction o] a
 
80
 
 
81
data CAction o = Sub (CExp o)
 
82
               | Skip
 
83
               | Weak Nat
 
84
 
 
85
type Ctx o = [(MId, CExp o)]
 
86
 
 
87
type EE = IO
 
88
 
 
89
data Elrs o = ElrsNil
 
90
            | ElrsCons (Elr o) (Elrs o)
 
91
            | ElrsWeak (Elrs o)
 
92
 
 
93