Rev | Line | |
---|
[22] | 1 | {-# LANGUAGE NoMonomorphismRestriction #-} |
---|
| 2 | |
---|
| 3 | module Tests.SizeTest where |
---|
| 4 | |
---|
| 5 | import Size |
---|
| 6 | import Lambda |
---|
| 7 | import Ops |
---|
| 8 | import Prelude ( ($), Int, (==), return, sequence, (>>=), and, (.), IO, Bool ) |
---|
| 9 | |
---|
| 10 | testEmpty1 :: (Size l) => l [Unsized] |
---|
| 11 | testEmpty1 = list (const 0) (lam $ \_ -> unsized) |
---|
| 12 | |
---|
| 13 | testNil :: (Size l) => l [a] |
---|
| 14 | testNil = list (const 0) (lam $ \_ -> bottom) |
---|
| 15 | |
---|
| 16 | testHead :: (Size l) => l ([a] -> a) |
---|
| 17 | testHead = slam $ \s f -> f `app` (s - const 1) |
---|
| 18 | |
---|
| 19 | testTail :: (Size l) => l ([a] -> [a]) |
---|
| 20 | testTail = slam $ \s f -> list (s - const 1) f |
---|
| 21 | |
---|
| 22 | testCons :: Size l => l (a -> [a] -> [a]) |
---|
| 23 | testCons = 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.