Skip to content

Commit

Permalink
Merge pull request #20 from commercialhaskell/fix16
Browse files Browse the repository at this point in the history
Fix #16 Reflect change in `instance Binary NameSpace`
  • Loading branch information
mpilgrem authored Nov 4, 2023
2 parents 864195f + 297e57a commit 63ea75a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
10 changes: 10 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## 0.1.6.0 - 2023-11-04

* Add further support for GHC 9.8 (GHC 9.8.1 onward). See
[#20](https://github.com/commercialhaskell/hi-file-parser/pull/20)

## 0.1.5.0 - 2023-10-11

* Add support for GHC 9.8 (GHC 9.8.1 onward). See
[#17](https://github.com/commercialhaskell/hi-file-parser/pull/17)

## 0.1.4.0 - 2023-04-28

* Add further support for GHC 9.4 (GHC 9.4.5 onward) and support for GHC 9.6.
Expand Down
2 changes: 1 addition & 1 deletion hi-file-parser.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: hi-file-parser
version: 0.1.5.0
version: 0.1.6.0
synopsis: Parser for GHC's hi files
description: Please see the README on Github at <https://github.com/commercialhaskell/hi-file-parser/blob/master/README.md>
category: Development
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: hi-file-parser
version: 0.1.5.0
version: 0.1.6.0
github: commercialhaskell/hi-file-parser
license: BSD3
author: Hussein Ait-Lahcen
Expand Down
23 changes: 22 additions & 1 deletion src/HiFileParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ getInterfaceRecent version d = do
since V9045 $ void getFastString -- usg_unit_id
void getFP -- usg_mod_hash
void (getMaybe getFP) -- usg_exports
void (getList (getTuple (getWord8 *> getFastString) getFP)) -- usg_entities
void getEntitiesList -- usg_entities
void getBool -- usg_safe
pure Nothing

Expand All @@ -621,6 +621,27 @@ getInterfaceRecent version d = do

_ -> fail $ "Invalid usageType: " <> show usageType

getEntitiesList :: Get (List (ByteString, ()))
getEntitiesList = getList (getTuple (getNameSpace *> getFastString) getFP)

-- See `instance Binary NameSpace` in module GHC.Types.Name.Occurrence. We
-- discard the information.
getNameSpace :: Get ()
getNameSpace = if version >= V9081
then do
nameSpaceType <- getWord8
case nameSpaceType of
0 -> pure ()
1 -> pure ()
2 -> pure ()
3 -> pure ()
-- Unlike the original, we test that the byte we have obtained is
-- valid.
4 -> do
void getFastString
_ -> fail $ "Invalid NameSpace type: " <> show nameSpaceType
else void getWord8

getInterface :: Get Interface
getInterface = do
let enableLEB128 = modify (\c -> c { useLEB128 = True})
Expand Down

0 comments on commit 63ea75a

Please sign in to comment.