Ticket #4008: Pain.hs

File Pain.hs, 468 bytes (added by nr, 3 years ago)
Line 
1{-# LANGUAGE RankNTypes, EmptyDataDecls, LiberalTypeSynonyms #-}
2
3module Pain
4where
5
6data O
7data C
8
9type Counter n e x = n e x -> Int
10type ExTriple a = (a C O, a O O, a O C) -- ^ entry/exit triple
11
12scalar :: forall a . (forall e x . a e x) -> ExTriple a
13scalar 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'.
17wrap :: (forall e x . Counter n e x) -> ExTriple (Counter n)
18wrap = scalar