blob: 42e584ce0af13aef96b68c339ede286d83b413af (
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
|
{-# LANGUAGE TypeApplications, RankNTypes, PolyKinds #-}
module VtaFail1 where
pairup_nosig x y = (x, y)
answer_nosig = pairup_nosig @Int @Bool 5 True
addOne :: Num a => a -> a
addOne x = x + 1
answer_constraint_fail = addOne @Bool 5
answer_lambda = (\x -> x) @Int 12
pair :: forall a. a -> forall b. b -> (a, b)
pair x = (,) x
-- Without this eta-expansion, the two have
-- different types under simple subsumption (#17775)
a = pair 3 @Int @Bool True
data First (a :: * -> *) = F
first :: First a -> Int
first _ = 0
fInt = first @Int F -- should fail
data Proxy (a :: k) = P -- This expands to P (kind variable) (type variable)
foo :: Proxy a -> Int
foo _ = 0
baz = foo @Bool (P :: Proxy Int) -- should fail
data Three (a :: * -> k -> *) = T
too :: Three a -> Int
too _ = 3
threeBad = too @Maybe T
threeWorse = too @( -> ) (T :: Three Either)
plus :: Int -> Int -> Int
plus = (+)
b = plus @Int 5 7
c = plus @Rational 5 10
d = (+) @Int @Int @Int 12 14
e = show @Int @Float (read "5")
f = show (read @Int @Bool @Float "3")
silly :: a -> Bool
silly _ = False
g = silly @Maybe -- should fail
|