summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T8883.hs
blob: d2d5c1eca61abe7cdeb655cb0c514ed6412a7ffd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TypeFamilies #-}

-- #8883

module T8883 where

type family PF a :: * -> *

class Regular a where
  from :: a -> PF a a

-- For fold we infer following type signature:
--
-- fold :: (Functor (PF a), Regular a) => (PF a b -> b) -> a -> b
--
-- However, this signature requires FlexibleContexts since the first
-- type-class constraint is not of the form (class type-variable) nor
-- (class (type-variable type1 type2 ... typen)). Since this extension
-- is not enabled compilation should fail.
fold f = f . fmap (fold f) . from