module Lens.Family.Identical where
import Control.Applicative
import Control.Applicative.Backwards (Backwards(..))
import Data.Functor.Identity (Identity(..))
import Data.Functor.Compose (Compose(..))
-- It would really be much better if comonads was in tranformers
class Applicative f =>Identicalf where
extract :: fa -> a
instance IdenticalIdentity where
extract (Identityx) = x
instance Identical f =>Identical (Backwardsf) where
extract (Backwardsx) = extractx
instance (Identical f, Identical g) =>Identical (Composefg) where
extract (Composex) = extract (extractx)