source: sizechecking/branches/macs/tests/SizeTest.hs @ 22

Last change on this file since 22 was 22, checked in by gobi, 11 years ago

Expressions

File size: 659 bytes
Line 
1{-# LANGUAGE NoMonomorphismRestriction #-}
2
3module Tests.SizeTest where
4
5import Size
6import Lambda
7import Ops
8import Prelude ( ($), Int, (==), return, sequence, (>>=), and, (.), IO, Bool )
9
10testEmpty1 :: (Size l) => l [Unsized]
11testEmpty1 = list (const 0) (lam $ \_ -> unsized)
12
13testNil :: (Size l) => l [a]
14testNil = list (const 0) (lam $ \_ -> bottom)
15
16testHead :: (Size l) => l ([a] -> a)
17testHead = slam $ \s f -> f `app` (s - const 1)
18
19testTail :: (Size l) => l ([a] -> [a])
20testTail = slam $ \s f -> list (s - const 1) f
21
22testCons :: Size l => l (a -> [a] -> [a])
23testCons = lam $ \x -> slam $ \s f ->
24    list (s + const 1) $ shift f s (lam $ \_ -> x)
Note: See TracBrowser for help on using the repository browser.