summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_compile/T3346.hs
blob: bba57a06f9dc172b84fec7e480f48fee8783e59b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# OPTIONS_GHC -XTypeFamilies  #-}

-- Trac #3346

module Foo where

class EP a where
  type Result a
  from :: a -> Result a
  to   :: Result a -> a

{-# RULES "rule1"   forall x. to (from x) = x #-}
{-# RULES "rule2"   forall x. from (to x) = x #-}

foo :: EP a => a -> a
-- This is typed in a way rather similarly to RULE rule1
foo x = to (from x)

bar x = from (to x)