blob: 88fefde55ab72ea8179dbcfa4bcdac0dac3d1e2e (
plain) (
blame)
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
|
definition module Snug.Syntax
from Data.Set import :: Set
:: TypeIdent :== String
:: TypeVarIdent :== String
:: ConstructorIdent :== String
:: SymbolIdent :== String
:: Type
= Type !TypeIdent
| TyVar !TypeVarIdent
| TyApp !Type !Type
| TyFun !Type !Type
| ..
:: ConstructorDef
= ConstructorDef !ConstructorIdent ![Type]
:: BasicValue
= BVInt !Int
| BVChar !Char
:: Pattern
= Wildcard
| BasicValuePattern !BasicValue
| IdentPattern !SymbolIdent
| ConstructorPattern !ConstructorIdent ![SymbolIdent]
:: CaseAlternative
= CaseAlternative !Pattern !Expression
:: Expression
= BasicValue !BasicValue
| Symbol !SymbolIdent
| Constructor !ConstructorIdent
| Case !Expression ![CaseAlternative]
| ExpApp !Expression !Expression
:: Definition
= DataDef !TypeIdent ![TypeVarIdent] ![ConstructorDef]
| TypeDef !TypeIdent !Type
| FunDef !SymbolIdent ![(SymbolIdent, Type)] !Type !Expression
| TestDef !String !Type !Expression !String
class usedSymbols a :: !a -> Set SymbolIdent
instance usedSymbols [a] | usedSymbols a
instance usedSymbols (a, b) | usedSymbols a & usedSymbols b
instance usedSymbols CaseAlternative, Expression, Pattern
|