testsuite: Add test for #13524
[ghc.git] / testsuite / tests / typecheck / should_compile / T13524.hs
1 {-# LANGUAGE PartialTypeSignatures #-}
2 {-# LANGUAGE ScopedTypeVariables #-}
3 {-# LANGUAGE TypeApplications #-}
4
5 {-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
6
7 type Empty a = ()
8
9 foo :: expr a -> expr a -> expr (Empty a)
10 foo = undefined
11
12 newtype Expr a = SPT {run :: String}
13
14 pt1 :: forall a ptexpr . ptexpr a -> ptexpr (Empty a)
15 pt1 a = foo a a
16
17 pt2 :: forall a ptexpr . ptexpr a -> ptexpr _
18 pt2 a = foo a a
19
20 main :: IO ()
21 main = do
22 -- This typechecks without any trouble.
23 putStrLn $ run $ pt1 @Int @Expr undefined
24
25 -- This should also typecheck, but doesn't since GHC seems to mix up the
26 -- order of the type variables.
27 putStrLn $ run $ pt2 @Int @Expr undefined