summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/tc242.hs
blob: 1faa70734db9f9b28ecfbd2c968e8bfaf10cddec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# LANGUAGE ScopedTypeVariables #-}
module Bug where

f1 :: forall a. [a] -> [a]
f1 (x:xs) = xs ++ [ x :: a ]   -- OK

f2 :: forall a. [a] -> [a]
f2 = \(x:xs) -> xs ++ [ x :: a ]   -- OK

-- This pair is a cut-down version of #2030
isSafe alts = isSafeAlts alts

isSafeAlts :: forall m . Int -> m Int
isSafeAlts x = error "urk"
  where
    isSafeAlt :: Int -> m Int
    isSafeAlt alt = isSafe `seq` error "urk"