summaryrefslogtreecommitdiff
path: root/testsuite/tests/pmcheck/should_compile/T12949.hs
blob: 90fe0240679681dda7155ddd1322f0e658989c7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE ScopedTypeVariables #-}
module T12949 where

class Foo a where
  foo :: Maybe a

data Result a b = Neither | This a | That b | Both a b

q :: forall a b . (Foo a, Foo b) => Result a b
q = case foo :: Maybe a of
      Nothing -> case foo :: Maybe b of
                   Nothing -> Neither
                   Just c -> That c
      Just i -> case foo :: Maybe b of
                   Nothing -> This i
                   Just c -> Both i c