    {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
    {-# HLINT ignore "Redundant multi-way if" #-}
    {-# HLINT ignore "Reduce duplication"     #-}

    {-# LANGUAGE BangPatterns               #-}
    {-# LANGUAGE CPP                        #-}
    {-# LANGUAGE DeriveGeneric              #-}
    {-# LANGUAGE DerivingStrategies         #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE LambdaCase                 #-}
    {-# LANGUAGE MultiWayIf                 #-}
    {-# LANGUAGE ScopedTypeVariables        #-}

    module HiFileParser
      ( Interface (..)
      , List (..)
      , Dictionary (..)
      , Module (..)
      , Usage (..)
      , Dependencies (..)
      , getInterface
      , fromFile
      ) where

    import           Control.Monad ( replicateM, replicateM_, when )
    import           Control.Monad.State
                       ( StateT, evalStateT, get, gets, lift, modify )
    import           Data.Binary ( Word32, Word64, Word8)
    import qualified Data.Binary.Get as G
                       ( Decoder (..), Get, bytesRead, getByteString, getInt64be
                       , getWord32be, getWord64be, getWord8, lookAhead
                       , runGetIncremental, skip
                       )
    import           Data.Bits
                       ( FiniteBits (..), (.|.), clearBit, complement, testBit
                       , unsafeShiftL
                       )
    import           Data.Bool ( bool )
    import           Data.ByteString.Lazy.Internal ( defaultChunkSize )
    import           Data.Char ( chr )
    import           Data.Functor ( ($>), void )
    import           Data.Maybe ( catMaybes )
    #if !MIN_VERSION_base(4,11,0)
    import           Data.Semigroup ( (<>) )
    #endif
    import qualified Data.Text as Text
    import qualified Data.Text.Encoding as Text
    import qualified Data.Vector as V
    import qualified Debug.Trace
    import           GHC.IO.IOMode ( IOMode (..) )
    import           Numeric ( showHex )
    import           RIO ( Generic, Int64, NFData )
    import           RIO.ByteString as B ( ByteString, hGetSome, null )
    import           System.IO ( withBinaryFile )

    newtype IfaceGetState = IfaceGetState
      { IfaceGetState -> Bool
    useLEB128 :: Bool -- ^ Use LEB128 encoding for numbers

      }

    data IfaceVersion
      = V7021
      | V7041
      | V7061
      | V7081
      | V8001
      | V8021
      | V8041
      | V8061
      | V8101
      | V9001
      | V9041
      | V9045
      | V9081
      | V9121
      | V9140
      deriving (IfaceVersion -> IfaceVersion -> Bool
    (IfaceVersion -> IfaceVersion -> Bool)
    -> (IfaceVersion -> IfaceVersion -> Bool) -> Eq IfaceVersion
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: IfaceVersion -> IfaceVersion -> Bool
    == :: IfaceVersion -> IfaceVersion -> Bool
    $c/= :: IfaceVersion -> IfaceVersion -> Bool
    /= :: IfaceVersion -> IfaceVersion -> Bool
    Eq, Int -> IfaceVersion
    IfaceVersion -> Int
    IfaceVersion -> [IfaceVersion]
    IfaceVersion -> IfaceVersion
    IfaceVersion -> IfaceVersion -> [IfaceVersion]
    IfaceVersion -> IfaceVersion -> IfaceVersion -> [IfaceVersion]
    (IfaceVersion -> IfaceVersion)
    -> (IfaceVersion -> IfaceVersion)
    -> (Int -> IfaceVersion)
    -> (IfaceVersion -> Int)
    -> (IfaceVersion -> [IfaceVersion])
    -> (IfaceVersion -> IfaceVersion -> [IfaceVersion])
    -> (IfaceVersion -> IfaceVersion -> [IfaceVersion])
    -> (IfaceVersion -> IfaceVersion -> IfaceVersion -> [IfaceVersion])
    -> Enum IfaceVersion
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: IfaceVersion -> IfaceVersion
    succ :: IfaceVersion -> IfaceVersion
    $cpred :: IfaceVersion -> IfaceVersion
    pred :: IfaceVersion -> IfaceVersion
    $ctoEnum :: Int -> IfaceVersion
    toEnum :: Int -> IfaceVersion
    $cfromEnum :: IfaceVersion -> Int
    fromEnum :: IfaceVersion -> Int
    $cenumFrom :: IfaceVersion -> [IfaceVersion]
    enumFrom :: IfaceVersion -> [IfaceVersion]
    $cenumFromThen :: IfaceVersion -> IfaceVersion -> [IfaceVersion]
    enumFromThen :: IfaceVersion -> IfaceVersion -> [IfaceVersion]
    $cenumFromTo :: IfaceVersion -> IfaceVersion -> [IfaceVersion]
    enumFromTo :: IfaceVersion -> IfaceVersion -> [IfaceVersion]
    $cenumFromThenTo :: IfaceVersion -> IfaceVersion -> IfaceVersion -> [IfaceVersion]
    enumFromThenTo :: IfaceVersion -> IfaceVersion -> IfaceVersion -> [IfaceVersion]
    Enum, Eq IfaceVersion
    Eq IfaceVersion =>
    (IfaceVersion -> IfaceVersion -> Ordering)
    -> (IfaceVersion -> IfaceVersion -> Bool)
    -> (IfaceVersion -> IfaceVersion -> Bool)
    -> (IfaceVersion -> IfaceVersion -> Bool)
    -> (IfaceVersion -> IfaceVersion -> Bool)
    -> (IfaceVersion -> IfaceVersion -> IfaceVersion)
    -> (IfaceVersion -> IfaceVersion -> IfaceVersion)
    -> Ord IfaceVersion
    IfaceVersion -> IfaceVersion -> Bool
    IfaceVersion -> IfaceVersion -> Ordering
    IfaceVersion -> IfaceVersion -> IfaceVersion
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: IfaceVersion -> IfaceVersion -> Ordering
    compare :: IfaceVersion -> IfaceVersion -> Ordering
    $c< :: IfaceVersion -> IfaceVersion -> Bool
    < :: IfaceVersion -> IfaceVersion -> Bool
    $c<= :: IfaceVersion -> IfaceVersion -> Bool
    <= :: IfaceVersion -> IfaceVersion -> Bool
    $c> :: IfaceVersion -> IfaceVersion -> Bool
    > :: IfaceVersion -> IfaceVersion -> Bool
    $c>= :: IfaceVersion -> IfaceVersion -> Bool
    >= :: IfaceVersion -> IfaceVersion -> Bool
    $cmax :: IfaceVersion -> IfaceVersion -> IfaceVersion
    max :: IfaceVersion -> IfaceVersion -> IfaceVersion
    $cmin :: IfaceVersion -> IfaceVersion -> IfaceVersion
    min :: IfaceVersion -> IfaceVersion -> IfaceVersion
    Ord, Int -> IfaceVersion -> ShowS
    [IfaceVersion] -> ShowS
    IfaceVersion -> String
    (Int -> IfaceVersion -> ShowS)
    -> (IfaceVersion -> String)
    -> ([IfaceVersion] -> ShowS)
    -> Show IfaceVersion
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> IfaceVersion -> ShowS
    showsPrec :: Int -> IfaceVersion -> ShowS
    $cshow :: IfaceVersion -> String
    show :: IfaceVersion -> String
    $cshowList :: [IfaceVersion] -> ShowS
    showList :: [IfaceVersion] -> ShowS
    Show)
      -- careful, the Ord matters!

    type Get a = StateT IfaceGetState G.Get a

    -- | Change this to 'True' to enable debugging.

    enableDebug :: Bool
    enableDebug :: Bool
    enableDebug = Bool
    False

    traceGet :: String -> Get ()
    traceGet :: String -> Get ()
    traceGet String
    s
      | Bool
    enableDebug = String -> Get () -> Get ()
    forall a. String -> a -> a
    Debug.Trace.trace String
    s (() -> Get ()
    forall a. a -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ())
      | Bool
    otherwise   = () -> Get ()
    forall a. a -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    traceShow :: Show a => String -> Get a -> Get a
    traceShow :: forall a. Show a => String -> Get a -> Get a
    traceShow String
    s Get a
    g
      | Bool -> Bool
    not Bool
    enableDebug = Get a
    g
      | Bool
    otherwise = do
        a <- Get a
    g
        traceGet (s ++ " " ++ show a)
        return a

    runGetIncremental :: Get a -> G.Decoder a
    runGetIncremental :: forall a. Get a -> Decoder a
    runGetIncremental Get a
    g = Get a -> Decoder a
    forall a. Get a -> Decoder a
    G.runGetIncremental (Get a -> IfaceGetState -> Get a
    forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a
    evalStateT Get a
    g IfaceGetState
    emptyState)
     where
      emptyState :: IfaceGetState
    emptyState = Bool -> IfaceGetState
    IfaceGetState Bool
    False

    getByteString :: Int -> Get ByteString
    getByteString :: Int -> Get ByteString
    getByteString Int
    i = Get ByteString -> Get ByteString
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Int -> Get ByteString
    G.getByteString Int
    i)

    getWord8 :: Get Word8
    getWord8 :: Get Word8
    getWord8 = Get Word8 -> Get Word8
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Get Word8
    G.getWord8

    -- | Like 'getWord8' but we discard the information.

    skipWord8 :: Get ()
    skipWord8 :: Get ()
    skipWord8 = Get Word8 -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void Get Word8
    getWord8

    bytesRead :: Get Int64
    bytesRead :: Get Int64
    bytesRead = Get Int64 -> Get Int64
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Get Int64
    G.bytesRead

    skip :: Int -> Get ()
    skip :: Int -> Get ()
    skip = Get () -> Get ()
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift (Get () -> Get ()) -> (Int -> Get ()) -> Int -> Get ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> Get ()
    G.skip

    uleb :: Get a -> Get a -> Get a
    uleb :: forall a. Get a -> Get a -> Get a
    uleb Get a
    f Get a
    g = do
      c <- (IfaceGetState -> Bool) -> StateT IfaceGetState Get Bool
    forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a
    gets IfaceGetState -> Bool
    useLEB128
      if c then f else g

    getWord32be :: Get Word32
    getWord32be :: Get Word32
    getWord32be = Get Word32 -> Get Word32 -> Get Word32
    forall a. Get a -> Get a -> Get a
    uleb Get Word32
    forall a. (Integral a, FiniteBits a) => Get a
    getULEB128 (Get Word32 -> Get Word32
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Get Word32
    G.getWord32be)

    getWord64be :: Get Word64
    getWord64be :: Get Word64
    getWord64be = Get Word64 -> Get Word64 -> Get Word64
    forall a. Get a -> Get a -> Get a
    uleb Get Word64
    forall a. (Integral a, FiniteBits a) => Get a
    getULEB128 (Get Word64 -> Get Word64
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Get Word64
    G.getWord64be)

    getInt64be :: Get Int64
    getInt64be :: Get Int64
    getInt64be = Get Int64 -> Get Int64 -> Get Int64
    forall a. Get a -> Get a -> Get a
    uleb Get Int64
    forall a. (Integral a, FiniteBits a) => Get a
    getSLEB128 (Get Int64 -> Get Int64
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Get Int64
    G.getInt64be)

    lookAhead :: Get b -> Get b
    lookAhead :: forall b. Get b -> Get b
    lookAhead Get b
    g = do
      s <- StateT IfaceGetState Get IfaceGetState
    forall s (m :: * -> *). MonadState s m => m s
    get
      lift $ G.lookAhead (evalStateT g s)

    getPtr :: Get Word32
    getPtr :: Get Word32
    getPtr = Get Word32 -> Get Word32
    forall (m :: * -> *) a. Monad m => m a -> StateT IfaceGetState m a
    forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
    (MonadTrans t, Monad m) =>
    m a -> t m a
    lift Get Word32
    G.getWord32be

    -- | Like 'getPtr' but we discard the information.

    skipPtr :: Get ()
    skipPtr :: Get ()
    skipPtr = Get Word32 -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void Get Word32
    getPtr

    type IsBoot = Bool

    type ModuleName = ByteString

    newtype List a = List
      { forall a. List a -> [a]
    unList :: [a]
      } deriving newtype (List a -> ()
    (List a -> ()) -> NFData (List a)
    forall a. NFData a => List a -> ()
    forall a. (a -> ()) -> NFData a
    $crnf :: forall a. NFData a => List a -> ()
    rnf :: List a -> ()
    NFData, Int -> List a -> ShowS
    [List a] -> ShowS
    List a -> String
    (Int -> List a -> ShowS)
    -> (List a -> String) -> ([List a] -> ShowS) -> Show (List a)
    forall a. Show a => Int -> List a -> ShowS
    forall a. Show a => [List a] -> ShowS
    forall a. Show a => List a -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall a. Show a => Int -> List a -> ShowS
    showsPrec :: Int -> List a -> ShowS
    $cshow :: forall a. Show a => List a -> String
    show :: List a -> String
    $cshowList :: forall a. Show a => [List a] -> ShowS
    showList :: [List a] -> ShowS
    Show)

    newtype Dictionary = Dictionary
      { Dictionary -> Vector ByteString
    unDictionary :: V.Vector ByteString
      } deriving newtype (Dictionary -> ()
    (Dictionary -> ()) -> NFData Dictionary
    forall a. (a -> ()) -> NFData a
    $crnf :: Dictionary -> ()
    rnf :: Dictionary -> ()
    NFData, Int -> Dictionary -> ShowS
    [Dictionary] -> ShowS
    Dictionary -> String
    (Int -> Dictionary -> ShowS)
    -> (Dictionary -> String)
    -> ([Dictionary] -> ShowS)
    -> Show Dictionary
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Dictionary -> ShowS
    showsPrec :: Int -> Dictionary -> ShowS
    $cshow :: Dictionary -> String
    show :: Dictionary -> String
    $cshowList :: [Dictionary] -> ShowS
    showList :: [Dictionary] -> ShowS
    Show)

    newtype Module = Module
      { Module -> ByteString
    unModule :: ModuleName
      } deriving newtype (Module -> ()
    (Module -> ()) -> NFData Module
    forall a. (a -> ()) -> NFData a
    $crnf :: Module -> ()
    rnf :: Module -> ()
    NFData, Int -> Module -> ShowS
    [Module] -> ShowS
    Module -> String
    (Int -> Module -> ShowS)
    -> (Module -> String) -> ([Module] -> ShowS) -> Show Module
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Module -> ShowS
    showsPrec :: Int -> Module -> ShowS
    $cshow :: Module -> String
    show :: Module -> String
    $cshowList :: [Module] -> ShowS
    showList :: [Module] -> ShowS
    Show)

    newtype Usage = Usage
      { Usage -> String
    unUsage :: FilePath
      } deriving newtype (Usage -> ()
    (Usage -> ()) -> NFData Usage
    forall a. (a -> ()) -> NFData a
    $crnf :: Usage -> ()
    rnf :: Usage -> ()
    NFData, Int -> Usage -> ShowS
    [Usage] -> ShowS
    Usage -> String
    (Int -> Usage -> ShowS)
    -> (Usage -> String) -> ([Usage] -> ShowS) -> Show Usage
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Usage -> ShowS
    showsPrec :: Int -> Usage -> ShowS
    $cshow :: Usage -> String
    show :: Usage -> String
    $cshowList :: [Usage] -> ShowS
    showList :: [Usage] -> ShowS
    Show)

    data Dependencies = Dependencies
      { Dependencies -> List (ByteString, Bool)
    dmods    :: List (ModuleName, IsBoot)
      , Dependencies -> List (ByteString, Bool)
    dpkgs    :: List (ModuleName, Bool)
      , Dependencies -> List Module
    dorphs   :: List Module
      , Dependencies -> List Module
    dfinsts  :: List Module
      , Dependencies -> List ByteString
    dplugins :: List ModuleName
      } deriving ((forall x. Dependencies -> Rep Dependencies x)
    -> (forall x. Rep Dependencies x -> Dependencies)
    -> Generic Dependencies
    forall x. Rep Dependencies x -> Dependencies
    forall x. Dependencies -> Rep Dependencies x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. Dependencies -> Rep Dependencies x
    from :: forall x. Dependencies -> Rep Dependencies x
    $cto :: forall x. Rep Dependencies x -> Dependencies
    to :: forall x. Rep Dependencies x -> Dependencies
    Generic, Int -> Dependencies -> ShowS
    [Dependencies] -> ShowS
    Dependencies -> String
    (Int -> Dependencies -> ShowS)
    -> (Dependencies -> String)
    -> ([Dependencies] -> ShowS)
    -> Show Dependencies
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Dependencies -> ShowS
    showsPrec :: Int -> Dependencies -> ShowS
    $cshow :: Dependencies -> String
    show :: Dependencies -> String
    $cshowList :: [Dependencies] -> ShowS
    showList :: [Dependencies] -> ShowS
    Show)

    instance NFData Dependencies

    data Interface = Interface
      { Interface -> Dependencies
    deps  :: Dependencies
      , Interface -> List Usage
    usage :: List Usage
      } deriving ((forall x. Interface -> Rep Interface x)
    -> (forall x. Rep Interface x -> Interface) -> Generic Interface
    forall x. Rep Interface x -> Interface
    forall x. Interface -> Rep Interface x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. Interface -> Rep Interface x
    from :: forall x. Interface -> Rep Interface x
    $cto :: forall x. Rep Interface x -> Interface
    to :: forall x. Rep Interface x -> Interface
    Generic, Int -> Interface -> ShowS
    [Interface] -> ShowS
    Interface -> String
    (Int -> Interface -> ShowS)
    -> (Interface -> String)
    -> ([Interface] -> ShowS)
    -> Show Interface
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Interface -> ShowS
    showsPrec :: Int -> Interface -> ShowS
    $cshow :: Interface -> String
    show :: Interface -> String
    $cshowList :: [Interface] -> ShowS
    showList :: [Interface] -> ShowS
    Show)

    instance NFData Interface

    -- | The 'String' is for debugging messages. Provided for consistency with

    -- 'skipWith'.

    with :: Show a => String -> Get a -> Get a
    with :: forall a. Show a => String -> Get a -> Get a
    with = String -> Get a -> Get a
    forall a. Show a => String -> Get a -> Get a
    traceShow

    -- | Like 'with' but we discard the information.

    skipWith :: Show a => String -> Get a -> Get ()
    skipWith :: forall a. Show a => String -> Get a -> Get ()
    skipWith String
    s = StateT IfaceGetState Get a -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (StateT IfaceGetState Get a -> Get ())
    -> (StateT IfaceGetState Get a -> StateT IfaceGetState Get a)
    -> StateT IfaceGetState Get a
    -> Get ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> StateT IfaceGetState Get a -> StateT IfaceGetState Get a
    forall a. Show a => String -> Get a -> Get a
    traceShow String
    s

    -- | Read a block prefixed with its length

    withBlockPrefix :: Get a -> Get a
    withBlockPrefix :: forall b. Get b -> Get b
    withBlockPrefix Get a
    f = Get Word32
    getPtr Get Word32 -> Get a -> Get a
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get a
    f

    -- | Skip a block prefixed with its length. The 'String' is for debugging

    -- messages

    skipWithBlockPrefix :: String -> Get ()
    skipWithBlockPrefix :: String -> Get ()
    skipWithBlockPrefix String
    s = do
      l <- String -> Get Word32 -> Get Word32
    forall a. Show a => String -> Get a -> Get a
    traceShow (String
    s String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> String
    ", skipping:") Get Word32
    getPtr
      skip (fromIntegral l - 4)

    getBool :: Get Bool
    getBool :: StateT IfaceGetState Get Bool
    getBool = Int -> Bool
    forall a. Enum a => Int -> a
    toEnum (Int -> Bool) -> (Word8 -> Int) -> Word8 -> Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word8 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Word8 -> Bool) -> Get Word8 -> StateT IfaceGetState Get Bool
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Word8
    getWord8

    -- | Like 'getBool' but we discard the information.

    skipBool :: Get ()
    skipBool :: Get ()
    skipBool = StateT IfaceGetState Get Bool -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Bool
    getBool

    getString :: Get String
    getString :: Get String
    getString = (Word32 -> Char) -> [Word32] -> String
    forall a b. (a -> b) -> [a] -> [b]
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Int -> Char
    chr (Int -> Char) -> (Word32 -> Int) -> Word32 -> Char
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Word32 -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral) ([Word32] -> String)
    -> (List Word32 -> [Word32]) -> List Word32 -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List Word32 -> [Word32]
    forall a. List a -> [a]
    unList (List Word32 -> String)
    -> StateT IfaceGetState Get (List Word32) -> Get String
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get Word32 -> StateT IfaceGetState Get (List Word32)
    forall a. Get a -> Get (List a)
    getList Get Word32
    getWord32be

    getMaybe :: Get a -> Get (Maybe a)
    getMaybe :: forall a. Get a -> Get (Maybe a)
    getMaybe Get a
    f = StateT IfaceGetState Get (Maybe a)
    -> StateT IfaceGetState Get (Maybe a)
    -> Bool
    -> StateT IfaceGetState Get (Maybe a)
    forall a. a -> a -> Bool -> a
    bool (Maybe a -> StateT IfaceGetState Get (Maybe a)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Maybe a
    forall a. Maybe a
    Nothing) (a -> Maybe a
    forall a. a -> Maybe a
    Just (a -> Maybe a) -> Get a -> StateT IfaceGetState Get (Maybe a)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get a
    f) (Bool -> StateT IfaceGetState Get (Maybe a))
    -> StateT IfaceGetState Get Bool
    -> StateT IfaceGetState Get (Maybe a)
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< StateT IfaceGetState Get Bool
    getBool

    -- | Like 'getMaybe' but we discard the information.

    skipMaybe :: Get a -> Get ()
    skipMaybe :: forall a. Get a -> Get ()
    skipMaybe = StateT IfaceGetState Get (Maybe a) -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (StateT IfaceGetState Get (Maybe a) -> Get ())
    -> (Get a -> StateT IfaceGetState Get (Maybe a)) -> Get a -> Get ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Get a -> StateT IfaceGetState Get (Maybe a)
    forall a. Get a -> Get (Maybe a)
    getMaybe

    getList :: Get a -> Get (List a)
    getList :: forall a. Get a -> Get (List a)
    getList Get a
    f = do
      use_uleb <- (IfaceGetState -> Bool) -> StateT IfaceGetState Get Bool
    forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a
    gets IfaceGetState -> Bool
    useLEB128
      if use_uleb
        then do
          l <- (getSLEB128 :: Get Int64)
          List <$> replicateM (fromIntegral l) f
        else do
          i <- getWord8
          l <-
            if i == 0xff
              then getWord32be
              else pure (fromIntegral i :: Word32)
          List <$> replicateM (fromIntegral l) f

    -- | Like 'getList' but we discard the information.

    skipList :: Get a -> Get ()
    skipList :: forall a. Get a -> Get ()
    skipList = StateT IfaceGetState Get (List a) -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (StateT IfaceGetState Get (List a) -> Get ())
    -> (Get a -> StateT IfaceGetState Get (List a)) -> Get a -> Get ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Get a -> StateT IfaceGetState Get (List a)
    forall a. Get a -> Get (List a)
    getList

    getTuple :: Get a -> Get b -> Get (a, b)
    getTuple :: forall a b. Get a -> Get b -> Get (a, b)
    getTuple Get a
    f Get b
    g = (,) (a -> b -> (a, b))
    -> Get a -> StateT IfaceGetState Get (b -> (a, b))
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get a
    f StateT IfaceGetState Get (b -> (a, b))
    -> Get b -> StateT IfaceGetState Get (a, b)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Get b
    g

    getByteStringSized :: Get ByteString
    getByteStringSized :: Get ByteString
    getByteStringSized = do
      size <- Get Int64
    getInt64be
      getByteString (fromIntegral size)

    getDictionary :: Int -> Get Dictionary
    getDictionary :: Int -> Get Dictionary
    getDictionary Int
    ptr = do
      offset <- Get Int64
    bytesRead
      skip $ ptr - fromIntegral offset
      size <- fromIntegral <$> getInt64be
      traceGet ("Dictionary size: " ++ show size)
      dict <- Dictionary <$> V.replicateM size getByteStringSized
      traceGet ("Dictionary: " ++ show dict)
      return dict

    -- | Get a FastString

    --

    -- FastStrings are stored in a global FastString table and only the index (a

    -- Word32be) is stored at the expected position.

    getCachedBS :: Dictionary -> Get ByteString
    getCachedBS :: Dictionary -> Get ByteString
    getCachedBS Dictionary
    d = Word32 -> Get ByteString
    forall {a} {f :: * -> *}.
    (Integral a, MonadFail f, Show a) =>
    a -> f ByteString
    go (Word32 -> Get ByteString) -> Get Word32 -> Get ByteString
    forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
    =<< String -> Get Word32 -> Get Word32
    forall a. Show a => String -> Get a -> Get a
    with String
    "Dict index:" Get Word32
    getWord32be
     where
      go :: a -> f ByteString
    go a
    i =
        case Dictionary -> Vector ByteString
    unDictionary Dictionary
    d Vector ByteString -> Int -> Maybe ByteString
    forall a. Vector a -> Int -> Maybe a
    V.!? a -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral a
    i of
          Just ByteString
    bs -> ByteString -> f ByteString
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ByteString
    bs
          Maybe ByteString
    Nothing -> String -> f ByteString
    forall a. String -> f a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> f ByteString) -> String -> f ByteString
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid dictionary index: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> a -> String
    forall a. Show a => a -> String
    show a
    i

    -- | Get Fingerprint

    getFP :: Get String
    getFP :: Get String
    getFP = do
      x <- Get Word64
    getWord64be
      y <- getWord64be
      return (showHex x (showHex y ""))

    -- Like 'getFP' but we discard the information.

    skipFP :: Get ()
    skipFP :: Get ()
    skipFP = Get String -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void Get String
    getFP

    getInterface721 :: Dictionary -> Get Interface
    getInterface721 :: Dictionary -> Get Interface
    getInterface721 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      Get ()
    skipBool
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    2 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get Module
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> (ByteString -> Module
    Module (ByteString -> Module)
    -> Get ByteString -> StateT IfaceGetState Get Module
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d)
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        List ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([ByteString] -> List ByteString
    forall a. [a] -> List a
    List [])
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterface741 :: Dictionary -> Get Interface
    getInterface741 :: Dictionary -> Get Interface
    getInterface741 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      Get ()
    skipBool
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    3 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get Module
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> (ByteString -> Module
    Module (ByteString -> Module)
    -> Get ByteString -> StateT IfaceGetState Get Module
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d)
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        List ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([ByteString] -> List ByteString
    forall a. [a] -> List a
    List [])
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    2 -> Usage -> Maybe Usage
    forall a. a -> Maybe a
    Just (Usage -> Maybe Usage)
    -> (String -> Usage) -> String -> Maybe Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Usage
    Usage (String -> Maybe Usage) -> Get String -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get String
    getString Get (Maybe Usage) -> Get Word64 -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get Word64
    getWord64be Get (Maybe Usage) -> Get Word64 -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get Word64
    getWord64be
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterface761 :: Dictionary -> Get Interface
    getInterface761 :: Dictionary -> Get Interface
    getInterface761 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      Get ()
    skipBool
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    3 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get Module
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> (ByteString -> Module
    Module (ByteString -> Module)
    -> Get ByteString -> StateT IfaceGetState Get Module
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d)
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        List ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([ByteString] -> List ByteString
    forall a. [a] -> List a
    List [])
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    2 -> Usage -> Maybe Usage
    forall a. a -> Maybe a
    Just (Usage -> Maybe Usage)
    -> (String -> Usage) -> String -> Maybe Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Usage
    Usage (String -> Maybe Usage) -> Get String -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get String
    getString Get (Maybe Usage) -> Get Word64 -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get Word64
    getWord64be Get (Maybe Usage) -> Get Word64 -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get Word64
    getWord64be
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterface781 :: Dictionary -> Get Interface
    getInterface781 :: Dictionary -> Get Interface
    getInterface781 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      Get ()
    skipBool
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    3 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get Module
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> (ByteString -> Module
    Module (ByteString -> Module)
    -> Get ByteString -> StateT IfaceGetState Get Module
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d)
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        List ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([ByteString] -> List ByteString
    forall a. [a] -> List a
    List [])
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    2 -> Usage -> Maybe Usage
    forall a. a -> Maybe a
    Just (Usage -> Maybe Usage)
    -> (String -> Usage) -> String -> Maybe Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Usage
    Usage (String -> Maybe Usage) -> Get String -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get String
    getString Get (Maybe Usage) -> Get () -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get ()
    skipFP
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterface801 :: Dictionary -> Get Interface
    getInterface801 :: Dictionary -> Get Interface
    getInterface801 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      Get ()
    skipWord8
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    3 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get Module
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> (ByteString -> Module
    Module (ByteString -> Module)
    -> Get ByteString -> StateT IfaceGetState Get Module
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d)
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        List ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([ByteString] -> List ByteString
    forall a. [a] -> List a
    List [])
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    2 -> Usage -> Maybe Usage
    forall a. a -> Maybe a
    Just (Usage -> Maybe Usage)
    -> (String -> Usage) -> String -> Maybe Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Usage
    Usage (String -> Maybe Usage) -> Get String -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get String
    getString Get (Maybe Usage) -> Get () -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get ()
    skipFP
            Word8
    3 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet () -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterface821 :: Dictionary -> Get Interface
    getInterface821 :: Dictionary -> Get Interface
    getInterface821 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      StateT IfaceGetState Get Module -> Get ()
    forall a. Get a -> Get ()
    skipMaybe StateT IfaceGetState Get Module
    getModule
      Get ()
    skipWord8
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    3 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = do
        idType <- Get Word8
    getWord8
        case idType of
          Word8
    0 -> Get ByteString -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (Get ByteString -> Get ()) -> Get ByteString -> Get ()
    forall a b. (a -> b) -> a -> b
    $ Dictionary -> Get ByteString
    getCachedBS Dictionary
    d
          Word8
    _ ->
              StateT IfaceGetState Get (List (ByteString, Module)) -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (StateT IfaceGetState Get (List (ByteString, Module)) -> Get ())
    -> StateT IfaceGetState Get (List (ByteString, Module)) -> Get ()
    forall a b. (a -> b) -> a -> b
    $
              Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get (List (ByteString, Module))
    -> StateT IfaceGetState Get (List (ByteString, Module))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get (ByteString, Module)
    -> StateT IfaceGetState Get (List (ByteString, Module))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Module -> Get (ByteString, Module)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Module
    getModule)
        Module <$> getCachedBS d
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        List ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([ByteString] -> List ByteString
    forall a. [a] -> List a
    List [])
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    2 -> Usage -> Maybe Usage
    forall a. a -> Maybe a
    Just (Usage -> Maybe Usage)
    -> (String -> Usage) -> String -> Maybe Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Usage
    Usage (String -> Maybe Usage) -> Get String -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get String
    getString Get (Maybe Usage) -> Get () -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get ()
    skipFP
            Word8
    3 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet () -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterface841 :: Dictionary -> Get Interface
    getInterface841 :: Dictionary -> Get Interface
    getInterface841 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      StateT IfaceGetState Get Module -> Get ()
    forall a. Get a -> Get ()
    skipMaybe StateT IfaceGetState Get Module
    getModule
      Get ()
    skipWord8
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    5 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = do
        idType <- Get Word8
    getWord8
        case idType of
          Word8
    0 -> Get ByteString -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (Get ByteString -> Get ()) -> Get ByteString -> Get ()
    forall a b. (a -> b) -> a -> b
    $ Dictionary -> Get ByteString
    getCachedBS Dictionary
    d
          Word8
    _ ->
              StateT IfaceGetState Get (List (ByteString, Module)) -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (StateT IfaceGetState Get (List (ByteString, Module)) -> Get ())
    -> StateT IfaceGetState Get (List (ByteString, Module)) -> Get ()
    forall a b. (a -> b) -> a -> b
    $
              Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get (List (ByteString, Module))
    -> StateT IfaceGetState Get (List (ByteString, Module))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get (ByteString, Module)
    -> StateT IfaceGetState Get (List (ByteString, Module))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Module -> Get (ByteString, Module)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Module
    getModule)
        Module <$> getCachedBS d
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        List ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ([ByteString] -> List ByteString
    forall a. [a] -> List a
    List [])
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    2 -> Usage -> Maybe Usage
    forall a. a -> Maybe a
    Just (Usage -> Maybe Usage)
    -> (String -> Usage) -> String -> Maybe Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Usage
    Usage (String -> Maybe Usage) -> Get String -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get String
    getString Get (Maybe Usage) -> Get () -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get ()
    skipFP
            Word8
    3 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet () -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterface861 :: Dictionary -> Get Interface
    getInterface861 :: Dictionary -> Get Interface
    getInterface861 Dictionary
    d = do
      StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule
      StateT IfaceGetState Get Module -> Get ()
    forall a. Get a -> Get ()
    skipMaybe StateT IfaceGetState Get Module
    getModule
      Get ()
    skipWord8
      Int -> Get () -> Get ()
    forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
    replicateM_ Int
    6 Get ()
    skipFP
      Get ()
    skipBool
      Get ()
    skipBool
      Dependencies -> List Usage -> Interface
    Interface (Dependencies -> List Usage -> Interface)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get (List Usage -> Interface)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> StateT IfaceGetState Get Dependencies
    getDependencies StateT IfaceGetState Get (List Usage -> Interface)
    -> StateT IfaceGetState Get (List Usage) -> Get Interface
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> StateT IfaceGetState Get (List Usage)
    getUsage
     where
      getModule :: StateT IfaceGetState Get Module
    getModule = do
        idType <- Get Word8
    getWord8
        case idType of
          Word8
    0 -> Get ByteString -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (Get ByteString -> Get ()) -> Get ByteString -> Get ()
    forall a b. (a -> b) -> a -> b
    $ Dictionary -> Get ByteString
    getCachedBS Dictionary
    d
          Word8
    _ ->
               StateT IfaceGetState Get (List (ByteString, Module)) -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void (StateT IfaceGetState Get (List (ByteString, Module)) -> Get ())
    -> StateT IfaceGetState Get (List (ByteString, Module)) -> Get ()
    forall a b. (a -> b) -> a -> b
    $
               Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString
    -> StateT IfaceGetState Get (List (ByteString, Module))
    -> StateT IfaceGetState Get (List (ByteString, Module))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get (ByteString, Module)
    -> StateT IfaceGetState Get (List (ByteString, Module))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Module -> Get (ByteString, Module)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Module
    getModule)
        Module <$> getCachedBS d
      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $
        List (ByteString, Bool)
    -> List (ByteString, Bool)
    -> List Module
    -> List Module
    -> List ByteString
    -> Dependencies
    Dependencies (List (ByteString, Bool)
     -> List (ByteString, Bool)
     -> List Module
     -> List Module
     -> List ByteString
     -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List (ByteString, Bool)
          -> List Module -> List Module -> List ByteString -> Dependencies)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List (ByteString, Bool)
       -> List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT
         IfaceGetState
         Get
         (List Module -> List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) StateT IfaceGetState Get Bool
    getBool) StateT
      IfaceGetState
      Get
      (List Module -> List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT
         IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT
      IfaceGetState Get (List Module -> List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List Module)
    -> StateT IfaceGetState Get (List ByteString -> Dependencies)
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        StateT IfaceGetState Get Module
    -> StateT IfaceGetState Get (List Module)
    forall a. Get a -> Get (List a)
    getList StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get (List ByteString -> Dependencies)
    -> StateT IfaceGetState Get (List ByteString)
    -> StateT IfaceGetState Get Dependencies
    forall a b.
    StateT IfaceGetState Get (a -> b)
    -> StateT IfaceGetState Get a -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*>
        Get ByteString -> StateT IfaceGetState Get (List ByteString)
    forall a. Get a -> Get (List a)
    getList (Dictionary -> Get ByteString
    getCachedBS Dictionary
    d)
      getUsage :: StateT IfaceGetState Get (List Usage)
    getUsage = StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix (StateT IfaceGetState Get (List Usage)
     -> StateT IfaceGetState Get (List Usage))
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a b. (a -> b) -> a -> b
    $ [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- Get Word8
    getWord8
          case usageType of
            Word8
    0 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    1 ->
                 Dictionary -> Get ByteString
    getCachedBS Dictionary
    d Get ByteString -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet ()
    -> StateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (Maybe ())
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get () -> StateT IfaceGetState Get (Maybe ())
    forall a. Get a -> Get (Maybe a)
    getMaybe Get ()
    skipFPStateT IfaceGetState Get (Maybe ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 Get (ByteString, ())
    -> StateT IfaceGetState Get (List (ByteString, ()))
    forall a. Get a -> Get (List a)
    getList (Get ByteString -> Get () -> Get (ByteString, ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple (Get Word8
    getWord8 Get Word8 -> Get ByteString -> Get ByteString
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Dictionary -> Get ByteString
    getCachedBS Dictionary
    d) Get ()
    skipFP) StateT IfaceGetState Get (List (ByteString, ()))
    -> StateT IfaceGetState Get Bool -> StateT IfaceGetState Get Bool
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *>
                 StateT IfaceGetState Get Bool
    getBool StateT IfaceGetState Get Bool -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    2 -> Usage -> Maybe Usage
    forall a. a -> Maybe a
    Just (Usage -> Maybe Usage)
    -> (String -> Usage) -> String -> Maybe Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Usage
    Usage (String -> Maybe Usage) -> Get String -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get String
    getString Get (Maybe Usage) -> Get () -> Get (Maybe Usage)
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get a
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
    <* Get ()
    skipFP
            Word8
    3 -> StateT IfaceGetState Get Module
    getModule StateT IfaceGetState Get Module -> Get () -> Get ()
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
    *> Get ()
    skipFPGet () -> Maybe Usage -> Get (Maybe Usage)
    forall (f :: * -> *) a b. Functor f => f a -> b -> f b
    $> Maybe Usage
    forall a. Maybe a
    Nothing
            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

    getInterfaceRecent :: IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent :: IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    version Dictionary
    d = do
      if
        | IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    >= IfaceVersion
    V9140 -> do
            Get ()
    skipIfaceModInfo -- mi_mod_info_

            Get ()
    skipFP           -- mi_iface_hash_

            ddeps <- StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix StateT IfaceGetState Get Dependencies
    getDependencies
            skipWithBlockPrefix "mi_public_"
            skipWithBlockPrefix "mi_top_env_"
            skipMaybe (skipWithBlockPrefix "mi_docs_")
            mDusage <- getMaybe (withBlockPrefix getIfaceSelfRecompInfo)
            case mDusage of
              Maybe (List Usage)
    Nothing ->
                -- There are no usages. Is that problematic for Stack?

                Interface -> Get Interface
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Dependencies -> List Usage -> Interface
    Interface Dependencies
    ddeps ([Usage] -> List Usage
    forall a. [a] -> List a
    List []))
              Just List Usage
    dusage -> Interface -> Get Interface
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Dependencies -> List Usage -> Interface
    Interface Dependencies
    ddeps List Usage
    dusage)
        | Bool
    otherwise -> do
            String -> StateT IfaceGetState Get Module -> Get ()
    forall a. Show a => String -> Get a -> Get ()
    skipWith String
    "Module:" StateT IfaceGetState Get Module
    getModule
            String -> Get (Maybe Module) -> Get ()
    forall a. Show a => String -> Get a -> Get ()
    skipWith String
    "Sig:" (Get (Maybe Module) -> Get ()) -> Get (Maybe Module) -> Get ()
    forall a b. (a -> b) -> a -> b
    $ StateT IfaceGetState Get Module -> Get (Maybe Module)
    forall a. Get a -> Get (Maybe a)
    getMaybe StateT IfaceGetState Get Module
    getModule
            Get ()
    skipWord8 -- hsc_src

            Get ()
    skipFP    -- iface_hash

            Get ()
    skipFP    -- mod_hash

            Get ()
    skipFP    -- flag_hash

            Get ()
    skipFP    -- opt_hash

            Get ()
    skipFP    -- hpc_hash

            Get ()
    skipFP    -- plugin_hash

            Get ()
    skipBool  -- orphan

            Get ()
    skipBool  -- hasFamInsts

            ddeps  <- String
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a. Show a => String -> Get a -> Get a
    with String
    "Dependencies:" (StateT IfaceGetState Get Dependencies
     -> StateT IfaceGetState Get Dependencies)
    -> StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall a b. (a -> b) -> a -> b
    $ StateT IfaceGetState Get Dependencies
    -> StateT IfaceGetState Get Dependencies
    forall b. Get b -> Get b
    withBlockPrefix StateT IfaceGetState Get Dependencies
    getDependencies
            dusage <- with "Usage:" $ withBlockPrefix getFileUsage
            pure (Interface ddeps dusage)
     where
      since :: IfaceVersion -> f () -> f ()
    since IfaceVersion
    v = Bool -> f () -> f ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    >= IfaceVersion
    v)

      getFastString :: Get ByteString
    getFastString = Dictionary -> Get ByteString
    getCachedBS Dictionary
    d

      -- Like 'getFastString' but we discard the information.

      skipFastString :: Get ()
      skipFastString :: Get ()
    skipFastString = Get ByteString -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void Get ByteString
    getFastString

      getModule :: Get Module
      getModule :: StateT IfaceGetState Get Module
    getModule = do
        idType <- String -> Get Word8 -> Get Word8
    forall a. Show a => String -> Get a -> Get a
    with String
    "Unit type:" Get Word8
    getWord8
        case idType of
          Word8
    0 -> Get ()
    skipFastString
          Word8
    1 -> do
            Get ()
    skipFastString
            Get (ByteString, Module) -> Get ()
    forall a. Get a -> Get ()
    skipList (Get ByteString
    -> StateT IfaceGetState Get Module -> Get (ByteString, Module)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple Get ByteString
    getFastString StateT IfaceGetState Get Module
    getModule)
          Word8
    _ -> String -> Get ()
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get ()) -> String -> Get ()
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid unit type: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    idType
        Module <$> getFastString

      -- See `instance Binary Dependencies` in module GHC.Unit.Module.Deps.

      getDependencies :: StateT IfaceGetState Get Dependencies
    getDependencies =
        if
          | IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    >= IfaceVersion
    V9041 -> do
              -- warning: transitive dependencies are no longer stored, only direct

              -- imports!

              -- Modules are now prefixed with their UnitId (should have been

              -- ModuleWithIsBoot ...)

              direct_mods <- String
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Show a => String -> Get a -> Get a
    with String
    "direct_mods:" (StateT IfaceGetState Get (List (ByteString, Bool))
     -> StateT IfaceGetState Get (List (ByteString, Bool)))
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a b. (a -> b) -> a -> b
    $
                if
                  | IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    >= IfaceVersion
    V9140 -> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get (ByteString, Bool)
     -> StateT IfaceGetState Get (List (ByteString, Bool)))
    -> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a b. (a -> b) -> a -> b
    $ do
                      Get ()
    skipIfaceImportLevel
                      Get ()
    skipFastString
                      Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple Get ByteString
    getFastString StateT IfaceGetState Get Bool
    getBool
                  | Bool
    otherwise -> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get (ByteString, Bool)
     -> StateT IfaceGetState Get (List (ByteString, Bool)))
    -> Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a b. (a -> b) -> a -> b
    $ do
                      Get ()
    skipFastString
                      Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple Get ByteString
    getFastString StateT IfaceGetState Get Bool
    getBool
              direct_pkgs <-
                if
                  | version >= V9140 -> getList $ do
                      skipIfaceImportLevel
                      getFastString
                  | otherwise -> getList getFastString

              -- plugin packages are now stored separately

              plugin_pkgs <- getList getFastString
              let all_pkgs = List ByteString -> [ByteString]
    forall a. List a -> [a]
    unList List ByteString
    plugin_pkgs [ByteString] -> [ByteString] -> [ByteString]
    forall a. [a] -> [a] -> [a]
    ++ List ByteString -> [ByteString]
    forall a. List a -> [a]
    unList List ByteString
    direct_pkgs

              -- instead of a trust bool for each unit, we have an additional

              -- list of trusted units (transitive)

              trusted_pkgs <- getList getFastString
              let trusted ByteString
    u = ByteString
    u ByteString -> [ByteString] -> Bool
    forall a. Eq a => a -> [a] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` List ByteString -> [ByteString]
    forall a. List a -> [a]
    unList List ByteString
    trusted_pkgs
                  all_pkgs_trust = [(ByteString, Bool)] -> List (ByteString, Bool)
    forall a. [a] -> List a
    List ([ByteString] -> [Bool] -> [(ByteString, Bool)]
    forall a b. [a] -> [b] -> [(a, b)]
    zip [ByteString]
    all_pkgs ((ByteString -> Bool) -> [ByteString] -> [Bool]
    forall a b. (a -> b) -> [a] -> [b]
    map ByteString -> Bool
    trusted [ByteString]
    all_pkgs))

              -- these are new

              skipList getModule -- sig_mods

              skipList $ do -- boot_mods

                skipFastString
                getTuple skipFastString skipBool

              dep_orphs  <- getList getModule
              dep_finsts <- getList getModule

              -- plugin names are no longer stored here

              let dep_plgins = [a] -> List a
    forall a. [a] -> List a
    List []

              pure Dependencies
                { dmods    = direct_mods
                , dpkgs    = all_pkgs_trust
                , dorphs   = dep_orphs
                , dfinsts  = dep_finsts
                , dplugins = dep_plgins
                }
          | Bool
    otherwise -> do
              dep_mods   <- Get (ByteString, Bool)
    -> StateT IfaceGetState Get (List (ByteString, Bool))
    forall a. Get a -> Get (List a)
    getList (Get ByteString
    -> StateT IfaceGetState Get Bool -> Get (ByteString, Bool)
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple Get ByteString
    getFastString StateT IfaceGetState Get Bool
    getBool)
              dep_pkgs   <- getList (getTuple getFastString getBool)
              dep_orphs  <- getList getModule
              dep_finsts <- getList getModule
              dep_plgins <- getList getFastString
              pure Dependencies
                { dmods    = dep_mods
                , dpkgs    = dep_pkgs
                , dorphs   = dep_orphs
                , dfinsts  = dep_finsts
                , dplugins = dep_plgins
                }

      -- See `newtype IfaceImportLevel` and

      -- `deriving Binary via EnumBinary ImportLevel` in module

      -- GHC.Unit.Module.Deps. We discard this information.

      skipIfaceImportLevel :: Get ()
      skipIfaceImportLevel :: Get ()
    skipIfaceImportLevel = Get ()
    skipImportLevel

      -- See `data ImportLevel` and

      -- `deriving via (EnumBinary ImportLevel) instance Binary ImportLevel` in

      -- module GHC.Types.Basic. We discard this information.

      skipImportLevel :: Get ()
      skipImportLevel :: Get ()
    skipImportLevel = Get Int64 -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void Get Int64
    getInt64be

      -- See `data Usage` and `instance Binary Usage` in module

      -- GHC.Module.Unit.Deps. We discard most of the information, except about the

      -- usage of files.

      getFileUsage :: StateT IfaceGetState Get (List Usage)
    getFileUsage = [Usage] -> List Usage
    forall a. [a] -> List a
    List ([Usage] -> List Usage)
    -> (List (Maybe Usage) -> [Usage])
    -> List (Maybe Usage)
    -> List Usage
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [Maybe Usage] -> [Usage]
    forall a. [Maybe a] -> [a]
    catMaybes ([Maybe Usage] -> [Usage])
    -> (List (Maybe Usage) -> [Maybe Usage])
    -> List (Maybe Usage)
    -> [Usage]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . List (Maybe Usage) -> [Maybe Usage]
    forall a. List a -> [a]
    unList (List (Maybe Usage) -> List Usage)
    -> StateT IfaceGetState Get (List (Maybe Usage))
    -> StateT IfaceGetState Get (List Usage)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get (Maybe Usage) -> StateT IfaceGetState Get (List (Maybe Usage))
    forall a. Get a -> Get (List a)
    getList Get (Maybe Usage)
    go
       where
        go :: Get (Maybe Usage)
        go :: Get (Maybe Usage)
    go = do
          usageType <- String -> Get Word8 -> Get Word8
    forall a. Show a => String -> Get a -> Get a
    with String
    "Usage type:" Get Word8
    getWord8
          case usageType of
            Word8
    0 -> do
              String -> StateT IfaceGetState Get Module -> Get ()
    forall a. Show a => String -> Get a -> Get ()
    skipWith String
    "Module:" StateT IfaceGetState Get Module
    getModule -- usg_mod

              Get ()
    skipFP                       -- usg_mod_hash

              Get ()
    skipBool                     -- usg_safe

              Maybe Usage -> Get (Maybe Usage)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Maybe Usage
    forall a. Maybe a
    Nothing

            Word8
    1 -> do
              String -> Get ByteString -> Get ()
    forall a. Show a => String -> Get a -> Get ()
    skipWith String
    "Home module:" Get ByteString
    getFastString -- usg_mod_name

              IfaceVersion -> Get () -> Get ()
    forall {f :: * -> *}. Applicative f => IfaceVersion -> f () -> f ()
    since IfaceVersion
    V9045 (Get () -> Get ()) -> Get () -> Get ()
    forall a b. (a -> b) -> a -> b
    $ Get ByteString -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void Get ByteString
    getFastString      -- usg_unit_id

              Get ()
    skipFP                                -- usg_mod_hash

              if                                    -- usg_exports

                | IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    < IfaceVersion
    V9140 -> Get () -> Get ()
    forall a. Get a -> Get ()
    skipMaybe Get ()
    skipFP
                | Bool
    otherwise -> Get () -> Get ()
    forall a. Get a -> Get ()
    skipMaybe Get ()
    skipHomeModImport
              Get ()
    skipEntitiesList                      -- usg_entities

              Get ()
    skipBool                              -- usg_safe

              Maybe Usage -> Get (Maybe Usage)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Maybe Usage
    forall a. Maybe a
    Nothing

            Word8
    2 -> do
              -- usg_file_path

              file_path  <- String -> Get String -> Get String
    forall a. Show a => String -> Get a -> Get a
    with String
    "File:" (Get String -> Get String) -> Get String -> Get String
    forall a b. (a -> b) -> a -> b
    $
                if
                  | IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    >= IfaceVersion
    V9081 -> Text -> String
    Text.unpack (Text -> String) -> (ByteString -> Text) -> ByteString -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ByteString -> Text
    Text.decodeUtf8 (ByteString -> String) -> Get ByteString -> Get String
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Get ByteString
    getFastString
                  | Bool
    otherwise -> Get String
    getString
              skipWith "FP:" getFP                  -- usg_file_hash

              since V9041 $ skipWith "File label:" (getMaybe getString)-- usg_file_label

              pure (Just (Usage file_path))

            Word8
    3 -> do
              StateT IfaceGetState Get Module -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void StateT IfaceGetState Get Module
    getModule -- usg_mod

              Get ()
    skipFP         -- usg_mod_hash

              Maybe Usage -> Get (Maybe Usage)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Maybe Usage
    forall a. Maybe a
    Nothing

            Word8
    4 | IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    >= IfaceVersion
    V9041 -> do -- UsageHomeModuleInterface

              Get ()
    skipFastString             -- usg_mod_name

              IfaceVersion -> Get () -> Get ()
    forall {f :: * -> *}. Applicative f => IfaceVersion -> f () -> f ()
    since IfaceVersion
    V9045 Get ()
    skipFastString -- usg_unit_id

              Get ()
    skipFP                     -- usg_iface_hash

              Maybe Usage -> Get (Maybe Usage)
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure Maybe Usage
    forall a. Maybe a
    Nothing

            Word8
    _ -> String -> Get (Maybe Usage)
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get (Maybe Usage)) -> String -> Get (Maybe Usage)
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid usageType: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    usageType

      -- See `data HomeModImport` and `instance Binary HomeModImport` in module

      -- GHC.Unit.Module.Deps. We discard the information.

      skipHomeModImport :: Get ()
      skipHomeModImport :: Get ()
    skipHomeModImport = do
        Get ()
    skipFP
        Get ()
    skipHomeModImportedAvails

      -- See `data HomeModImportedAvails` and

      -- `instance Binary HomeModImportedAvails` in module GHC.Unit.Module.Deps. We

      -- discard the information.

      skipHomeModImportedAvails :: Get ()
      skipHomeModImportedAvails :: Get ()
    skipHomeModImportedAvails = do
        homeModImportedAvailsType <- String -> Get Word8 -> Get Word8
    forall a. Show a => String -> Get a -> Get a
    with String
    "HomeModImportedAvails:" Get Word8
    getWord8
        case homeModImportedAvailsType of
          Word8
    0 -> do
            Get ()
    skipDetOrdAvails
            Get () -> Get ()
    forall a. Get a -> Get ()
    skipList Get ()
    skipName
          Word8
    1 -> Get ()
    skipFP
          Word8
    _ -> String -> Get ()
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get ()) -> String -> Get ()
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid HomeModImportedAvails type: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    homeModImportedAvailsType

      -- See `newtype DetOrdAvails` in module GHC.Types.Avail. We discard the

      -- information.

      skipDetOrdAvails :: Get ()
      skipDetOrdAvails :: Get ()
    skipDetOrdAvails = Get () -> Get ()
    forall a. Get a -> Get ()
    skipList Get ()
    skipAvailInfo

      -- See `instance Binary AvailInfo` in module GHC.Types.Avail. We discard the

      -- information.

      skipAvailInfo :: Get ()
      skipAvailInfo :: Get ()
    skipAvailInfo = do
        availInfoType <- String -> Get Word8 -> Get Word8
    forall a. Show a => String -> Get a -> Get a
    with String
    "AvailInfo type:" Get Word8
    getWord8
        case availInfoType of
          Word8
    0 -> Get ()
    skipName
          Word8
    1 -> do
            Get ()
    skipName
            Get () -> Get ()
    forall a. Get a -> Get ()
    skipList Get ()
    skipName
          Word8
    _ -> String -> Get ()
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get ()) -> String -> Get ()
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid AvailInfo type: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    availInfoType

      -- See `instance Binary Name` in module GHC.Types.Name. We discard the

      -- information.

      skipName :: Get ()
      skipName :: Get ()
    skipName = Get Int64 -> Get ()
    forall (f :: * -> *) a. Functor f => f a -> f ()
    void Get Int64
    getInt64be

      -- See `data Usage` and `UsageHomeModule` in module GHC.Unit.Module.Deps. We

      -- discard the information.

      skipEntitiesList :: Get ()
      skipEntitiesList :: Get ()
    skipEntitiesList = Get ((), ()) -> Get ()
    forall a. Get a -> Get ()
    skipList (Get () -> Get () -> Get ((), ())
    forall a b. Get a -> Get b -> Get (a, b)
    getTuple Get ()
    skipOccName Get ()
    skipFP)

      -- See `data OccName` and `instance Binary OccName` in module

      -- GHC.Types.Name.Occurrence. We discard the information.

      skipOccName :: Get ()
      skipOccName :: Get ()
    skipOccName = do
        Get ()
    skipNameSpace
        Get ()
    skipFastString

      -- See `instance Binary NameSpace` in module GHC.Types.Name.Occurrence. We

      -- discard the information.

      skipNameSpace :: Get ()
      skipNameSpace :: Get ()
    skipNameSpace =
        if
          | IfaceVersion
    version IfaceVersion -> IfaceVersion -> Bool
    forall a. Ord a => a -> a -> Bool
    >= IfaceVersion
    V9081 -> do
              nameSpaceType <- Get Word8
    getWord8
              case nameSpaceType of
                Word8
    0 -> () -> Get ()
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ()
                Word8
    1 -> () -> Get ()
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ()
                Word8
    2 -> () -> Get ()
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ()
                Word8
    3 -> () -> Get ()
    forall a. a -> StateT IfaceGetState Get a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure ()
                Word8
    4 -> Get ()
    skipFastString
                -- Unlike the original, we test that the byte we have obtained is

                -- valid.

                Word8
    _ -> String -> Get ()
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get ()) -> String -> Get ()
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid NameSpace type: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word8 -> String
    forall a. Show a => a -> String
    show Word8
    nameSpaceType
          | Bool
    otherwise -> Get ()
    skipWord8

      -- See `instance Binary IfaceModInfo` in module GHC.Unit.Module.ModIface. We

      -- discard the information.

      skipIfaceModInfo :: Get ()
      skipIfaceModInfo :: Get ()
    skipIfaceModInfo = do
        String -> StateT IfaceGetState Get Module -> Get ()
    forall a. Show a => String -> Get a -> Get ()
    skipWith String
    "Module:" StateT IfaceGetState Get Module
    getModule         -- mi_mod_info_module

        String -> Get (Maybe Module) -> Get ()
    forall a. Show a => String -> Get a -> Get ()
    skipWith String
    "Sig:" (Get (Maybe Module) -> Get ()) -> Get (Maybe Module) -> Get ()
    forall a b. (a -> b) -> a -> b
    $ StateT IfaceGetState Get Module -> Get (Maybe Module)
    forall a. Get a -> Get (Maybe a)
    getMaybe StateT IfaceGetState Get Module
    getModule -- mi_mod_info_sig_of

        Get ()
    skipWord8                            -- mi_mod_info_hsc_src

      -- See `data IfaceSelfRecomp` and `instance Binary IfaceSelfRecomp` in module

      -- GHC.Iface.Recomp.Types. We discard most of this information.

      getIfaceSelfRecompInfo :: Get (List Usage)
      getIfaceSelfRecompInfo :: StateT IfaceGetState Get (List Usage)
    getIfaceSelfRecompInfo = do
        Get ()
    skipFP -- sr_src_hash

        dusage <- String
    -> StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall a. Show a => String -> Get a -> Get a
    with String
    "Usage:" (StateT IfaceGetState Get (List Usage)
    -> StateT IfaceGetState Get (List Usage)
    forall b. Get b -> Get b
    withBlockPrefix StateT IfaceGetState Get (List Usage)
    getFileUsage) -- sr_usages

        skipFP -- sr_flag_hash

        skipFP -- sr_opt_hash

        skipFP -- sr_hpc_hash

        skipFP -- sr_plugin_hash

        pure dusage

    getInterface :: Get Interface
    getInterface :: Get Interface
    getInterface = do
      let enableLEB128 :: Get ()
    enableLEB128 = (IfaceGetState -> IfaceGetState) -> Get ()
    forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
    modify (\IfaceGetState
    c -> IfaceGetState
    c { useLEB128 = True})
          -- read a relative bin pointer

          getRelPtr :: Get Word32
    getRelPtr = do
            c <- Get Int64
    bytesRead
            p <- getPtr
            pure (fromIntegral c + p)

      magic <- Get Word32 -> Get Word32
    forall b. Get b -> Get b
    lookAhead Get Word32
    getWord32be Get Word32 -> (Word32 -> Get Word32) -> Get Word32
    forall a b.
    StateT IfaceGetState Get a
    -> (a -> StateT IfaceGetState Get b) -> StateT IfaceGetState Get b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \case
        -- normal magic

        Word32
    0x1face      -> Get Word32
    getWord32be
        Word32
    0x1face64    -> Get Word32
    getWord32be
        Word32
    m            -> do
          -- GHC 8.10 mistakenly encoded header fields with LEB128

          -- so it gets special treatment

          Get Word32 -> Get Word32
    forall b. Get b -> Get b
    lookAhead (Get ()
    enableLEB128 Get () -> Get Word32 -> Get Word32
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Get Word32
    getWord32be) Get Word32 -> (Word32 -> Get Word32) -> Get Word32
    forall a b.
    StateT IfaceGetState Get a
    -> (a -> StateT IfaceGetState Get b) -> StateT IfaceGetState Get b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \case
            Word32
    0x1face      -> Get ()
    enableLEB128 Get () -> Get Word32 -> Get Word32
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Get Word32
    getWord32be
            Word32
    0x1face64    -> Get ()
    enableLEB128 Get () -> Get Word32 -> Get Word32
    forall a b.
    StateT IfaceGetState Get a
    -> StateT IfaceGetState Get b -> StateT IfaceGetState Get b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> Get Word32
    getWord32be
            Word32
    _            -> String -> Get Word32
    forall a. String -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. MonadFail m => String -> m a
    fail (String -> Get Word32) -> String -> Get Word32
    forall a b. (a -> b) -> a -> b
    $ String
    "Invalid magic: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> Word32 -> ShowS
    forall a. Integral a => a -> ShowS
    showHex Word32
    m String
    ""

      traceGet ("Magic: " ++ showHex magic "")

      -- empty field (removed in 9.0...)

      case magic of
        Word32
    0x1face      -> do
          e <- Get Word32 -> Get Word32
    forall b. Get b -> Get b
    lookAhead Get Word32
    getWord32be
          if e == 0
            then void getWord32be
            else enableLEB128 -- > 9.0

        Word32
    0x1face64    -> do
          e <- Get Word64 -> Get Word64
    forall b. Get b -> Get b
    lookAhead Get Word64
    getWord64be
          if e == 0
            then void getWord64be
            else enableLEB128 -- > 9.0

        Word32
    _            -> () -> Get ()
    forall a. a -> StateT IfaceGetState Get a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

      -- ghc version

      version <- getString
      traceGet ("Version: " ++ version)

      let !ifaceVersion
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "9140" = IfaceVersion
    V9140 -- Support GHC 9.14.1-alpha1

            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "9121" = IfaceVersion
    V9121
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "9081" = IfaceVersion
    V9081
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "9045" = IfaceVersion
    V9045
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "9041" = IfaceVersion
    V9041
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "9001" = IfaceVersion
    V9001
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "8101" = IfaceVersion
    V8101
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "8061" = IfaceVersion
    V8061
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "8041" = IfaceVersion
    V8041
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "8021" = IfaceVersion
    V8021
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "8001" = IfaceVersion
    V8001
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "7081" = IfaceVersion
    V7081
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "7061" = IfaceVersion
    V7061
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "7041" = IfaceVersion
    V7041
            | String
    version String -> String -> Bool
    forall a. Ord a => a -> a -> Bool
    >= String
    "7021" = IfaceVersion
    V7021
            | Bool
    otherwise         = String -> IfaceVersion
    forall a. HasCallStack => String -> a
    error (String -> IfaceVersion) -> String -> IfaceVersion
    forall a b. (a -> b) -> a -> b
    $ String
    "Unsupported version: " String -> ShowS
    forall a. Semigroup a => a -> a -> a
    <> String
    version

      -- way

      way <- getString
      traceGet ("Ways: " ++ show way)

      -- source hash (GHC >= 9.4 && GHC < 9.14)

      when (ifaceVersion >= V9041 && ifaceVersion < V9140) skipFP

      -- extensible fields (GHC >= 9.0)

      when (ifaceVersion >= V9001) skipPtr

      -- dict_ptr

      dictPtr <- if ifaceVersion >= V9121 -- 9.12 uses relative pointers

        then getRelPtr
        else getPtr
      traceGet ("Dict ptr: " ++ show dictPtr)

      -- dict

      dict <- lookAhead $ getDictionary $ fromIntegral dictPtr

      -- symtable_ptr

      skipPtr

      -- IfaceType table

      when (ifaceVersion >= V9121) skipPtr

      case ifaceVersion of
        IfaceVersion
    V9140 -> IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    ifaceVersion Dictionary
    dict
        IfaceVersion
    V9121 -> IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    ifaceVersion Dictionary
    dict
        IfaceVersion
    V9081 -> IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    ifaceVersion Dictionary
    dict
        IfaceVersion
    V9045 -> IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    ifaceVersion Dictionary
    dict
        IfaceVersion
    V9041 -> IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    ifaceVersion Dictionary
    dict
        IfaceVersion
    V9001 -> IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    ifaceVersion Dictionary
    dict
        IfaceVersion
    V8101 -> IfaceVersion -> Dictionary -> Get Interface
    getInterfaceRecent IfaceVersion
    ifaceVersion Dictionary
    dict
        IfaceVersion
    V8061 -> Dictionary -> Get Interface
    getInterface861 Dictionary
    dict
        IfaceVersion
    V8041 -> Dictionary -> Get Interface
    getInterface841 Dictionary
    dict
        IfaceVersion
    V8021 -> Dictionary -> Get Interface
    getInterface821 Dictionary
    dict
        IfaceVersion
    V8001 -> Dictionary -> Get Interface
    getInterface801 Dictionary
    dict
        IfaceVersion
    V7081 -> Dictionary -> Get Interface
    getInterface781 Dictionary
    dict
        IfaceVersion
    V7061 -> Dictionary -> Get Interface
    getInterface761 Dictionary
    dict
        IfaceVersion
    V7041 -> Dictionary -> Get Interface
    getInterface741 Dictionary
    dict
        IfaceVersion
    V7021 -> Dictionary -> Get Interface
    getInterface721 Dictionary
    dict

    fromFile :: FilePath -> IO (Either String Interface)
    fromFile :: String -> IO (Either String Interface)
    fromFile String
    fp = String
    -> IOMode
    -> (Handle -> IO (Either String Interface))
    -> IO (Either String Interface)
    forall r. String -> IOMode -> (Handle -> IO r) -> IO r
    withBinaryFile String
    fp IOMode
    ReadMode Handle -> IO (Either String Interface)
    forall {f :: * -> *}.
    MonadIO f =>
    Handle -> f (Either String Interface)
    go
     where
      go :: Handle -> f (Either String Interface)
    go Handle
    h =
        let feed :: Decoder b -> f (Either String b)
    feed (G.Done ByteString
    _ Int64
    _ b
    iface) = Either String b -> f (Either String b)
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Either String b -> f (Either String b))
    -> Either String b -> f (Either String b)
    forall a b. (a -> b) -> a -> b
    $ b -> Either String b
    forall a b. b -> Either a b
    Right b
    iface
            feed (G.Fail ByteString
    _ Int64
    _ String
    msg) = Either String b -> f (Either String b)
    forall a. a -> f a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (Either String b -> f (Either String b))
    -> Either String b -> f (Either String b)
    forall a b. (a -> b) -> a -> b
    $ String -> Either String b
    forall a b. a -> Either a b
    Left String
    msg
            feed (G.Partial Maybe ByteString -> Decoder b
    k) = do
              chunk <- Handle -> Int -> f ByteString
    forall (m :: * -> *). MonadIO m => Handle -> Int -> m ByteString
    hGetSome Handle
    h Int
    defaultChunkSize
              feed $ k $ if B.null chunk then Nothing else Just chunk
        in  Decoder Interface -> f (Either String Interface)
    forall {f :: * -> *} {b}.
    MonadIO f =>
    Decoder b -> f (Either String b)
    feed (Decoder Interface -> f (Either String Interface))
    -> Decoder Interface -> f (Either String Interface)
    forall a b. (a -> b) -> a -> b
    $ Get Interface -> Decoder Interface
    forall a. Get a -> Decoder a
    runGetIncremental Get Interface
    getInterface

    getULEB128 :: forall a. (Integral a, FiniteBits a) => Get a
    getULEB128 :: forall a. (Integral a, FiniteBits a) => Get a
    getULEB128 =
      Int -> a -> Get a
    go Int
    0 a
    0
     where
      go :: Int -> a -> Get a
      go :: Int -> a -> Get a
    go Int
    shift a
    w = do
        b <- Get Word8
    getWord8
        let !hasMore = Word8 -> Int -> Bool
    forall a. Bits a => a -> Int -> Bool
    testBit Word8
    b Int
    7
            !val = a
    w a -> a -> a
    forall a. Bits a => a -> a -> a
    .|. (a -> Int -> a
    forall a. Bits a => a -> Int -> a
    clearBit (Word8 -> a
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word8
    b) Int
    7 a -> Int -> a
    forall a. Bits a => a -> Int -> a
    `unsafeShiftL` Int
    shift) :: a
        if hasMore
          then do
            go (shift+7) val
          else
            return $! val

    getSLEB128 :: forall a. (Integral a, FiniteBits a) => Get a
    getSLEB128 :: forall a. (Integral a, FiniteBits a) => Get a
    getSLEB128 = do
      (val,shift,signed) <- Int -> a -> Get (a, Int, Bool)
    go Int
    0 a
    0
      if signed && (shift < finiteBitSize val )
        then return $! ((complement 0 `unsafeShiftL` shift) .|. val)
        else return val
     where
      go :: Int -> a -> Get (a,Int,Bool)
      go :: Int -> a -> Get (a, Int, Bool)
    go Int
    shift a
    val = do
        byte <- Get Word8
    getWord8
        let !byteVal = Word8 -> a
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Word8 -> Int -> Word8
    forall a. Bits a => a -> Int -> a
    clearBit Word8
    byte Int
    7) :: a
            !val' = a
    val a -> a -> a
    forall a. Bits a => a -> a -> a
    .|. (a
    byteVal a -> Int -> a
    forall a. Bits a => a -> Int -> a
    `unsafeShiftL` Int
    shift)
            !more = Word8 -> Int -> Bool
    forall a. Bits a => a -> Int -> Bool
    testBit Word8
    byte Int
    7
            !shift' = Int
    shiftInt -> Int -> Int
    forall a. Num a => a -> a -> a
    +Int
    7
        if more
          then go shift' val'
          else do
            let !signed = Word8 -> Int -> Bool
    forall a. Bits a => a -> Int -> Bool
    testBit Word8
    byte Int
    6
            return (val',shift',signed)