blob: 8e4ef2a3b52fc9f1b92f628b5bfd46b63797c24e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts #-}
type family Id x
type instance Id Int = Int
type instance Id Bool = Bool
class Convert x y where convert :: x -> y
instance Convert x x where convert = id
f :: Convert a (Id a) => a -> Id a
f x = convert x
g :: Convert a (Id a) => a -> Id a
g x = let x' = f x in x'
|