{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} module Representations2 where -- -------------------------------------- -- Structure constructors -- -------------------------------------- data Fst r1 r2 = Fst { unFst :: r1 } deriving Show data Snd r1 r2 = Snd { unSnd :: r2 } deriving Show data K2 a r1 r2 = K2 a deriving Show data Unit2 r1 r2 = Unit2 deriving Show data Sum2 f g r1 r2 = Inl2 (f r1 r2) | Inr2 (g r1 r2) deriving Show data Prod2 f g r1 r2 = Prod2 (f r1 r2) (g r1 r2) deriving Show data Lift1 f r1 r2 = Lift1 (f r1)