summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T10390.hs
blob: facb26a26d3d0cdac60b7638012358235317d31f (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 x = apPair' x

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)