Ticket #4008: Pain.hs
| File Pain.hs, 468 bytes (added by nr, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | {-# LANGUAGE RankNTypes, EmptyDataDecls, LiberalTypeSynonyms #-} |
| 2 | |
| 3 | module Pain |
| 4 | where |
| 5 | |
| 6 | data O |
| 7 | data C |
| 8 | |
| 9 | type Counter n e x = n e x -> Int |
| 10 | type ExTriple a = (a C O, a O O, a O C) -- ^ entry/exit triple |
| 11 | |
| 12 | scalar :: forall a . (forall e x . a e x) -> ExTriple a |
| 13 | scalar a = (a, a, a) |
| 14 | |
| 15 | -- Claim: the type of 'wrap' is an instance of the type of 'scalar' |
| 16 | -- obtained by substituting 'counter n' for 'a'. |
| 17 | wrap :: (forall e x . Counter n e x) -> ExTriple (Counter n) |
| 18 | wrap = scalar |
