typesupport.dcl 1.65 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
8
9
do_fusion :== False
// MW: this switch is used to en(dis)able the fusion algorithm which currently isn't ready

10
11
12
13
14
15
16
17
18
19
20
21
22
23
errorHeading :: !String !*ErrorAdmin -> *ErrorAdmin

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

:: Format =
	{	form_properties :: !BITVECT
	,	form_position	:: ![Int]
	}

cNoProperties		:== 0
cAttributed			:== 4
cAnnotated			:== 8

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

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

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

31
32
33
cleanUpSymbolType :: !TempSymbolType ![TypeContext] ![ExprInfoPtr] !{! CoercionTree} !AttributePartition
						!*VarEnv !*AttributeEnv !*TypeHeaps !*ExpressionHeap !*ErrorAdmin
							-> (!SymbolType, !*VarEnv, !*AttributeEnv, !*TypeHeaps, !*ExpressionHeap, !*ErrorAdmin)
Ronny Wichers Schreur's avatar
Ronny Wichers Schreur committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

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

equivalent :: !SymbolType  !TempSymbolType !{# CommonDefs} !*AttributeEnv !*TypeHeaps -> (!Bool, !*AttributeEnv, !*TypeHeaps) 

::	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]
	}

class substitute a :: !a !u:TypeHeaps -> (!a, !u:TypeHeaps)

instance substitute AType, Type, TypeContext, AttrInequality, [a] | substitute a
instance <<< TempSymbolType