never executed always true always false
    1 {-# OPTIONS_GHC -fno-warn-orphans #-}
    2 {-# LANGUAGE FlexibleInstances #-}
    3 {-# LANGUAGE PolyKinds #-}
    4 {-# LANGUAGE ScopedTypeVariables #-}
    5 {-# LANGUAGE GADTs #-}
    6 
    7 -- This module is full of orphans, unfortunately
    8 module GHCi.TH.Binary () where
    9 
   10 import Prelude -- See note [Why do we import Prelude here?]
   11 import Data.Binary
   12 import qualified Data.ByteString as B
   13 import qualified Data.ByteString.Internal as B
   14 import GHC.Serialized
   15 import qualified Language.Haskell.TH        as TH
   16 import qualified Language.Haskell.TH.Syntax as TH
   17 -- Put these in a separate module because they take ages to compile
   18 
   19 instance Binary TH.Loc
   20 instance Binary TH.Name
   21 instance Binary TH.ModName
   22 instance Binary TH.NameFlavour
   23 instance Binary TH.PkgName
   24 instance Binary TH.NameSpace
   25 instance Binary TH.Module
   26 instance Binary TH.Info
   27 instance Binary TH.Type
   28 instance Binary TH.TyLit
   29 instance Binary TH.Specificity
   30 instance Binary flag => Binary (TH.TyVarBndr flag)
   31 instance Binary TH.Role
   32 instance Binary TH.Lit
   33 instance Binary TH.Range
   34 instance Binary TH.Stmt
   35 instance Binary TH.Pat
   36 instance Binary TH.Exp
   37 instance Binary TH.Dec
   38 instance Binary TH.Overlap
   39 instance Binary TH.DerivClause
   40 instance Binary TH.DerivStrategy
   41 instance Binary TH.Guard
   42 instance Binary TH.Body
   43 instance Binary TH.Match
   44 instance Binary TH.Fixity
   45 instance Binary TH.TySynEqn
   46 instance Binary TH.FunDep
   47 instance Binary TH.AnnTarget
   48 instance Binary TH.RuleBndr
   49 instance Binary TH.Phases
   50 instance Binary TH.RuleMatch
   51 instance Binary TH.Inline
   52 instance Binary TH.Pragma
   53 instance Binary TH.Safety
   54 instance Binary TH.Callconv
   55 instance Binary TH.Foreign
   56 instance Binary TH.Bang
   57 instance Binary TH.SourceUnpackedness
   58 instance Binary TH.SourceStrictness
   59 instance Binary TH.DecidedStrictness
   60 instance Binary TH.FixityDirection
   61 instance Binary TH.OccName
   62 instance Binary TH.Con
   63 instance Binary TH.AnnLookup
   64 instance Binary TH.ModuleInfo
   65 instance Binary TH.Clause
   66 instance Binary TH.InjectivityAnn
   67 instance Binary TH.FamilyResultSig
   68 instance Binary TH.TypeFamilyHead
   69 instance Binary TH.PatSynDir
   70 instance Binary TH.PatSynArgs
   71 instance Binary TH.DocLoc
   72 
   73 -- We need Binary TypeRep for serializing annotations
   74 
   75 instance Binary Serialized where
   76     put (Serialized tyrep wds) = put tyrep >> put (B.pack wds)
   77     get = Serialized <$> get <*> (B.unpack <$> get)
   78 
   79 instance Binary TH.Bytes where
   80    put (TH.Bytes ptr off sz) = put bs
   81       where bs = B.PS ptr (fromIntegral off) (fromIntegral sz)
   82    get = do
   83       B.PS ptr off sz <- get
   84       return (TH.Bytes ptr (fromIntegral off) (fromIntegral sz))