{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoImplicitPrelude #-} module Hcompta.Expr.Trans where import Data.Function ((.)) -- | -- * 'trans_lift' is generally not /surjective/ -- * 'trans_apply' is not /injective/ -- * 'trans_apply' . 'trans_lift' == 'id' -- * 'trans_lift' . 'trans_apply' /= 'id' class Trans trans repr where trans_lift :: repr a -> trans repr a trans_apply :: trans repr a -> repr a trans_map1 :: (repr a -> repr b) -> (trans repr a -> trans repr b) trans_map1 f = trans_lift . f . trans_apply trans_map2 :: (repr a -> repr b -> repr c) -> (trans repr a -> trans repr b -> trans repr c) trans_map2 f e1 e2 = trans_lift (f (trans_apply e1) (trans_apply e2))