_SystemStrictLists.dcl 1007 Bytes
Newer Older
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 _SystemStrictLists;

class List .l e where {
	_cons :: .e u:(l .e) -> u:(l .e);
	_decons :: !u:(l .e) -> (.e,u:(l .e));
};

class UList e where {
	_cons_u :: !.e u:[#.e] -> u:[#.e];
	_decons_u :: !u:[#.e] -> (!.e,u:[#.e]);
};

class UTSList e where {
	_cons_uts :: !.e !u:[#.e!] -> u:[#.e!];
	_decons_uts :: !u:[#.e!] -> (!.e,!u:[#.e!]);
};

_nil :: u:(l .e) | List l e , [u<=e];
_nil_u :: .[#.e] | UList e;
_nil_uts :: .[#.e!] | UTSList e;

instance List [] a;
instance List [!] a;
instance List [ !] a;
instance List [!!] a;

instance List [#] a | UList a;
instance List [#!] a | UTSList a;

instance UList a;

instance UList Int;
instance UList Real;
instance UList Char;
instance UList Bool;
instance UList File;
instance UList {.a};
instance UList {!.a};
instance UList {#.a};

instance UTSList a;

instance UTSList Int;
instance UTSList Real;
instance UTSList Char;
instance UTSList Bool;
instance UTSList File;
instance UTSList {.a};
instance UTSList {!.a};
instance UTSList {#.a};