blob: c5b5e6acfc3ece90686c64c4320b6a8444f778f5 (
plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
{-# LANGUAGE ScopedTypeVariables, TypeApplications, RankNTypes, ImpredicativeTypes #-}
module ICFP20 where
import Control.Monad.ST( ST, runST )
type SId = forall a. a->a
ids :: [SId]
ids = [id,id]
choose :: a -> a -> a
choose x y = x
auto :: SId -> SId
auto = id
single :: a -> [a]
single x = [x]
auto'2 :: SId -> b -> b
auto'2 x = id @SId x
auto3 :: SId -> b -> b
auto3 x = id x
poly :: SId -> (Int,Bool)
poly f = (f (3::Int), f True)
f :: (a->a) -> [a] -> a
f g xs = g (head xs)
inc :: Int -> Int
inc x = x+1
app :: (a->b) -> a -> b
app f x = f x
revapp :: a -> (a->b) -> b
revapp x f = f x
a3 = choose [] ids
a5 = id auto
a7 = choose id auto
a9 = f (choose id) ids
a10 = poly id
a11 = poly (\x -> x)
a12 = id poly (\x -> x)
c1 = length ids
c2 = tail ids
c3 = head ids
c4 = single id :: [SId]
c5 = id : ids
c6 = id : id : ids
c7 = single inc ++ single id
c8a = ids ++ single id
c8b = single id ++ ids
c9 = map poly (single id)
argST :: forall s. ST s Int
argST = error "urk"
d1a = poly $ id
d1b = app poly id
d2 = revapp id poly
d3 = runST argST
d4 = runST $ argST
st1 :: forall a. (forall s. ST s a) -> a
st1 x = id (runST @a) x
-- Not in the paper's table
c10 = head ids True
|