Ticket #8476: panic.hs

File panic.hs, 1.9 KB (added by DMcGill, 6 months ago)

Demonstrating case

Line 
1import Control.Monad.Trans
2import Control.Monad.Identity
3
4test1 :: (MonadTrans t, Monad m) => t m (Identity Int)
5test1 = lift return (Identity 1) {- causes the following error:
6
7C:\Users\David McGillicuddy\Desktop\panic.hs:6:9:
8    Couldn't match kind `* -> *' with `*'
9    Expected type: Identity a0 -> t m (Identity Int)
10      Actual type: Identity a0 -> t m (Identity Int)
11    Kind incompatibility when matching types:
12      Identity a_tu :: * -> *
13      Identity a0 :: *
14    The function `lift'ghc: panic! (the 'impossible' happened)
15  (GHC version 7.6.3 for i386-unknown-mingw32):
16    kindFunResult
17<<details unavailable>>
18
19Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug -}
20
21test2 :: (MonadTrans t, Monad m) => t m (Identity Int)
22test2 = lift (return (Identity 1)) -- works fine, of course
23
24-- test3 :: (MonadTrans t, Monad m) => t m (Identity Int)
25-- test3 = lift return (return 1) -- causes the following (non-panic) error:
26
27{-
28C:\Users\David McGillicuddy\Desktop\panic.hs:27:9:
29    Couldn't match kind `* -> *' with `*'
30    Expected type: (->) (Identity Int) -> t m (Identity Int)
31      Actual type: (->) (Identity Int) -> t m (Identity Int)
32    Kind incompatibility when matching types:
33      (->) (Identity Int) :: * -> *
34      (->) (Identity Int) :: *
35    The function `lift' is applied to two arguments,
36    but its type `(Identity Int -> t m (Identity Int))
37                  -> (->) (Identity Int) -> t m (Identity Int)'
38    has only two
39    In the expression: lift return (return 1)
40
41C:\Users\David McGillicuddy\Desktop\panic.hs:27:14:
42    Couldn't match kind `*' with `* -> *'
43    Expected type: Identity Int -> t m (Identity Int)
44      Actual type: Identity Int -> t m (Identity Int)
45    Kind incompatibility when matching types:
46      (->) :: * -> *
47      (->) :: * -> * -> *
48    In the first argument of `lift', namely `return'
49    In the expression: lift return (return 1)
50-}
51