1{-# LANGUAGE FlexibleContexts #-}
2{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE RankNTypes #-}
4
5{-# OPTIONS_GHC -Wall #-}
6
7module T10931 ( BugC(..) ) where
8
9data IdT f a = IdC (f a)
10
11class ( m ~ Outer m (Inner m) ) => BugC (m :: * -> *) where
12    type Inner m :: * -> *
13    type Outer m :: (* -> *) -> * -> *
14
15    bug :: ( forall n. ( n ~ Outer n (Inner n)
16                       , Outer n ~ Outer m
17                       )
18            => Inner n a)
19        -> m a
20
21instance BugC (IdT m) where
22    type Inner (IdT m) = m
23    type Outer (IdT m) = IdT
24
25    bug f = IdC f
26