Ticket #2668: deriving.hs
| File deriving.hs, 320 bytes (added by ryani, 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | {-# LANGUAGE StandaloneDeriving, GeneralizedNewtypeDeriving #-} |
| 2 | module Deriving where |
| 3 | |
| 4 | class IxMonad m where |
| 5 | ret :: a -> m i i a |
| 6 | |
| 7 | data M s x y a = M |
| 8 | data S = S |
| 9 | |
| 10 | instance IxMonad (M s) where ret _ = M |
| 11 | |
| 12 | newtype S1 x y a = S1 (M S x y a) deriving IxMonad |
| 13 | |
| 14 | newtype S2 x y a = S2 (M S x y a) |
| 15 | deriving instance IxMonad S2 |
