summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T7019.hs
blob: ea482f0301e67a9c22d142692f306d1561e2f3fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeFamilies         #-}
{-# LANGUAGE RankNTypes           #-}
{-# LANGUAGE ConstraintKinds      #-}
{-# LANGUAGE UndecidableInstances #-}

module T7019a where

newtype Free c a = Free { runFree :: forall r. c r => (a -> r) -> r }

type C c = forall a. c (Free c a)

-- Notice that C is a synonym, illegal!
instance C c => Monad (Free c) where
  return a = Free ($ a)
  Free f >>= g = f g