packages feed

uhc-light-1.1.7.0: src/UHC/Light/Compiler/Gam/ClGam.hs

module UHC.Light.Compiler.Gam.ClGam
( ClGamInfo (..), ClGam, emptyCLGI
, initClGam )
where
import UHC.Util.Pretty
import UHC.Util.Utils
import UHC.Light.Compiler.Base.Common
import UHC.Light.Compiler.Base.TermLike
import UHC.Light.Compiler.Base.HsName.Builtin
import UHC.Light.Compiler.Ty
import UHC.Light.Compiler.Ty.Pretty
import UHC.Light.Compiler.Gam
import Control.Monad
import UHC.Util.Binary
import UHC.Util.Serialize





{-# LINE 37 "src/ehc/Gam/ClGam.chs" #-}
-- If this changes, also change {%{EH}ConfigInternalVersions}
data ClGamInfo
  =  ClGamInfo
       { clgiPrToEvidTy         :: !Ty                  -- mapping from predicate type -> dictionary structure record, encoded as function
       , clgiRuleTy             :: !Ty
       , clgiDfltDictNm         :: !HsName              -- dictionary name of default instance fields constructing function
       , clgiDictTag            :: !CTag                -- tag of dictionary
       , clgiGenerDerivableL    :: [(HsName,HsName)]    -- list of fields with default value which can be derived using generic deriving
       }
       deriving Show

type ClGam     = Gam HsName ClGamInfo

emptyCLGI
  = ClGamInfo
      Ty_Any Ty_Any hsnUnknown CTagRec
      []

{-# LINE 69 "src/ehc/Gam/ClGam.chs" #-}
deriving instance Typeable ClGamInfo
deriving instance Data ClGamInfo

{-# LINE 74 "src/ehc/Gam/ClGam.chs" #-}
instance PP ClGamInfo where
  pp clgi = pp (clgiDfltDictNm clgi) >#< "::" >#< ppTy (clgiRuleTy clgi) >#< "::" >#< ppTy (clgiPrToEvidTy clgi)

{-# LINE 79 "src/ehc/Gam/ClGam.chs" #-}
initClGam
  = assocLToGam
      [ (hsnPrArrow,    emptyCLGI)
      ]

{-# LINE 94 "src/ehc/Gam/ClGam.chs" #-}
instance Serialize ClGamInfo where
  sput (ClGamInfo a b c d e) = sput a >> sput b >> sput c >> sput d >> sput e
  sget = liftM5 ClGamInfo sget sget sget sget sget