summaryrefslogtreecommitdiff
path: root/testsuite/tests/impredicative/icfp20-fail.hs
blob: 2e077d7ec10ff99bca947d2ee6a1da5a5369dce8 (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
{-# LANGUAGE ScopedTypeVariables, TypeApplications, RankNTypes, ImpredicativeTypes #-}

module ICFP20 where

import Control.Monad.ST( ST, runST )

type SId = forall a. a->a

choose :: a -> a -> a
choose x y = x

single :: a -> [a]
single x = [x]

auto'2 :: SId -> b -> b
auto'2 x = id @SId x

-- Fails, and should fail
auto'1 :: SId -> b -> b
auto'1 = id

-- Fails, and should do so
a6 = id auto'2

-- Fails, and should do so
a8 = choose id auto'2

-- Fails, and should do so
st2 :: forall a. (forall s. ST s a) -> a
st2 x = id runST x