summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/ExplicitForAllFams1.hs
blob: 067127cf8aacfd3e38de7ee068af993e2aa4f6ce (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
25
26
27
28
29
30
31
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeInType #-}

module ExplicitForAllFams where

import Data.Proxy
import Data.Kind

-- From Proposal 0007

data family F a
data instance forall (x :: Bool). F (Proxy x) = MkF

class C a where
  type G a b
instance forall a. C [a] where
  type forall b. G [a] b = Int

type family H a b where
  forall x y. H [x] (Proxy y) = Double
  forall z.   H z   z         = Bool

-- More tests

type family D a b where
  forall (a :: Type -> Type) (b :: a Int) (c :: k). D (Proxy b) (Proxy c) = ()
  forall (a :: Bool) (b :: Proxy a). D (Proxy b) () = Int
  forall (a :: Type). D a a = Maybe a