summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Grammar/Values.hs
blob: c8fcb3945fd27e91a277a5c5f417bd88e06c475f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
----------------------------------------------------------------------
-- |
-- Module      : Values
-- Maintainer  : AR
-- Stability   : (stable)
-- Portability : (portable)
--
-- > CVS $Date: 2005/04/21 16:22:32 $
-- > CVS $Author: bringert $
-- > CVS $Revision: 1.7 $
--
-- (Description of the module)
-----------------------------------------------------------------------------

module GF.Grammar.Values (
               -- ** Values used in TC type checking
               Val(..), Env,
               -- ** Annotated tree used in editing
               Binds, Constraints, MetaSubst,
               -- ** For TC
               valAbsInt, valAbsFloat, valAbsString, vType,
               isPredefCat,
               eType,
              ) where

import GF.Infra.Ident
import GF.Grammar.Grammar
import GF.Grammar.Predef

-- values used in TC type checking

data Val = VGen Int Ident | VApp Val Val | VCn QIdent | VRecType [(Label,Val)] | VType | VClos Env Term
  deriving (Eq,Show)

type Env = [(Ident,Val)]

type Binds = [(Ident,Val)]
type Constraints = [(Val,Val)]
type MetaSubst = [(MetaId,Val)]


-- for TC

valAbsInt :: Val
valAbsInt = VCn (cPredefAbs, cInt)

valAbsFloat :: Val
valAbsFloat = VCn (cPredefAbs, cFloat)

valAbsString :: Val
valAbsString = VCn (cPredefAbs, cString)

vType :: Val
vType = VType

eType :: Term
eType = Sort cType