Ticket #4338: Bar.hs
| File Bar.hs, 344 bytes (added by illissius, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} |
| 2 | |
| 3 | class Bar a b | a -> b, b -> a where |
| 4 | there :: a -> b |
| 5 | back :: b -> a |
| 6 | tickle :: b -> b |
| 7 | |
| 8 | instance Bar Char Int where |
| 9 | there = fromEnum |
| 10 | back = toEnum |
| 11 | tickle = (+1) |
| 12 | |
| 13 | test :: (Bar a b) => a -> a |
| 14 | test = back . tickle . there |
| 15 | |
| 16 | main :: IO () |
| 17 | main = print $ test 'F' |
