typesupport.dcl 2.12 KB
Newer Older
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
1
2
3
4
5
6
definition module typesupport

import checksupport, StdCompare

from unitype import Coercions, CoercionTree, AttributePartition

7
// MW: this switch is used to en(dis)able the fusion algorithm
Sjaak Smetsers's avatar
Sjaak Smetsers committed
8
SwitchFusion fuse dont_fuse :== dont_fuse
9

10
11
12
13
14
errorHeading :: !String !*ErrorAdmin -> *ErrorAdmin

class (<::) infixl a :: !*File (!Format, !a) -> *File

:: Format =
15
16
	{	form_properties 	:: !BITVECT
	,	form_attr_position	:: Optional ([Int], Coercions)
17
18
19
	}

cNoProperties		:== 0
20
21
22
cAttributed			:== 1
cAnnotated			:== 2
cMarkAttribute		:== 4
23
24

instance <:: SymbolType, Type, AType, [a] | <:: a
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
25
26
27
28
29
30
31

::	AttributeEnv	:== {! TypeAttribute }
::	VarEnv 			:== {! Type }

cleanSymbolType :: !Int !*TypeHeaps -> (!SymbolType, !*TypeHeaps)
extendSymbolType :: !SymbolType !Int !*TypeHeaps -> (!SymbolType, !*TypeHeaps)

Sjaak Smetsers's avatar
Sjaak Smetsers committed
32
33
34
35
36
37
cSpecifiedType	:== True
cDerivedType	:== False

cleanUpSymbolType :: !Bool !TempSymbolType ![TypeContext] ![ExprInfoPtr] !{! CoercionTree} !AttributePartition
						!*VarEnv !*AttributeEnv !*TypeHeaps !*VarHeap !*ExpressionHeap !*ErrorAdmin
							-> (!SymbolType, !*VarEnv, !*AttributeEnv, !*TypeHeaps, !*VarHeap, !*ExpressionHeap, !*ErrorAdmin)
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
38
39
40

expandTypeApplication :: ![ATypeVar] !TypeAttribute !Type ![AType] !TypeAttribute !*TypeHeaps -> (!Type, !*TypeHeaps)

Sjaak Smetsers's avatar
Sjaak Smetsers committed
41
equivalent :: !SymbolType !TempSymbolType !Int !{# CommonDefs} !*AttributeEnv !*TypeHeaps -> (!Bool, !*AttributeEnv, !*TypeHeaps) 
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

::	AttrCoercion =
	{	ac_demanded	:: !Int
	,	ac_offered	:: !Int
	}

::	TempSymbolType =
	{	tst_args		:: ![AType]
	,	tst_arity		:: !Int
	,	tst_lifted		:: !Int
	,	tst_result		:: !AType
	,	tst_context		:: ![TypeContext]
	,	tst_attr_env	:: ![AttrCoercion]
	}

Sjaak Smetsers's avatar
Sjaak Smetsers committed
57
58
59
60
::	FunctionType = CheckedType !SymbolType | SpecifiedType !SymbolType ![AType] !TempSymbolType
				 | UncheckedType !TempSymbolType | ExpandedType !SymbolType !TempSymbolType !TempSymbolType  | EmptyFunctionType


61
updateExpressionTypes :: !SymbolType !SymbolType ![ExprInfoPtr] !*TypeHeaps !*ExpressionHeap -> (!*TypeHeaps, !*ExpressionHeap)
62

63
class substitute a :: !a !*TypeHeaps -> (!a, !*TypeHeaps)
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
64

65
instance substitute AType, Type, TypeContext, AttrInequality, CaseType, [a] | substitute a
66

Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
67
instance <<< TempSymbolType