summaryrefslogtreecommitdiff
path: root/testsuite/tests/quantified-constraints/T21037.hs
blob: 8fa4a6ca09bde5fb382dac50e7b05e1545387e92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{-# LANGUAGE QuantifiedConstraints #-}

module T21037 where

type f ~> g = forall x. f x -> g x

class (forall f. Functor f => Functor (h f)) => HFunctor h where
  hmap :: (f ~> g) -> (h f ~> h g)

class (forall m. Monad m => Monad (h m), HFunctor h) => HMonad h where
  hreturn :: Monad m => m ~> h m
  hdnib :: (Monad m, Monad n) => (m ~> h n) -> h m ~> h n

bar :: (HMonad h, Monad f) => (Functor (h f) => c) -> c
bar x = x

baz ::
  ( forall m. Monad m => Monad (h m),
    forall f. Functor f => Functor (h f),
    Monad f
  ) =>
  (Functor (h f) => c) ->
  c
baz x = x