summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T10390.hs
blob: e0648c9554a770aca8a4f494f7eedf54eab11b18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{-# LANGUAGE RankNTypes #-}

module T10390 where

class ApPair r where
  apPair :: (forall a . (ApPair a, Num a) => Maybe a) -> Maybe r

instance (ApPair a, ApPair b) => ApPair (a,b) where
  apPair = apPair'

apPair' :: (ApPair b, ApPair c)
        => (forall a . (Num a, ApPair a) => Maybe a) -> Maybe (b,c)
            -- NB constraints in a different order to apPair
apPair' f =  let (Just a) = apPair f
                 (Just b) = apPair f
          in Just $ (a, b)