summaryrefslogtreecommitdiff
path: root/testsuite/tests/rep-poly/RepPolyRule3.hs
blob: c8fccaf5d560aff0e10871823c635374af915bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE DataKinds, PolyKinds, StandaloneKindSignatures, TypeFamilyDependencies #-}

module RepPolyRule3 where

import GHC.Exts

type F :: RuntimeRep -> RuntimeRep
type family F rep  = r | r -> rep where
  F IntRep  = WordRep
  F WordRep = IntRep
  F rep     = rep

g :: forall rep (a :: TYPE (F rep)). a -> a
g = undefined

{-# NOINLINE g #-}
{-# RULES "g_id" forall (x :: (a :: TYPE (F WordRep))). g x = x #-}

h :: forall rep (a :: TYPE (F rep)). a -> a
h = undefined

{-# NOINLINE h #-}
{-# RULES "h_id" forall (x :: (a :: TYPE IntRep)). h x = x #-}