Skip to content

Commit 731b618

Browse files
committed
fixes
1 parent 7888599 commit 731b618

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

bench/data/Tuple.bcbin

4.09 MB
Binary file not shown.

bench/data/Types.bcbin

8.97 MB
Binary file not shown.

data-bitcode.cabal

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,19 @@ test-suite spec
5959
-- , data-bitcode-llvm
6060
default-language: Haskell2010
6161

62+
6263
benchmark writer
6364
type: exitcode-stdio-1.0
64-
main-is: Bench.hs
65+
main-is: Prof.hs
6566
hs-source-dirs:
66-
bench/src
67-
ghc-options: -main-is Bench
67+
prof/src
68+
ghc-options: -main-is Prof
6869
build-depends:
6970
base >= 4.10 && < 5
70-
, pretty >= 1.1
71-
, bytestring >= 0.10
72-
, binary >= 0.8
73-
, containers >= 0.5
74-
, criterion
71+
, binary
7572
, data-bitcode
7673
other-modules:
77-
Bench
74+
Prof
7875
default-language: Haskell2010
7976

8077
benchmark bitcode

prof/src/Prof.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{-# LANGUAGE LambdaCase #-}
2+
module Prof where
3+
4+
import qualified Data.BitCode.Writer.Monad as Bitcode (writeFile, withHeader)
5+
import qualified Data.BitCode.Writer as Bitcode (emitTopLevel)
6+
7+
import System.Environment (getArgs)
8+
import Data.Binary (decodeFile)
9+
10+
main :: IO ()
11+
main = getArgs >>= \case
12+
[inf, outf] -> Bitcode.writeFile outf
13+
. Bitcode.withHeader True
14+
. Bitcode.emitTopLevel =<< decodeFile inf
15+
_ -> putStrLn "expected InputFile OutputFile"
16+

src/Data/BitCode.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ lookupRecord e bs = lookup (fromEnum e) [(c,v) | NRec c v <- bs]
170170
class ToVal a where
171171
toVal :: a -> [Val]
172172

173+
instance ToVal Word64 where
174+
toVal = pure
175+
173176
instance {-# OVERLAPPABLE #-} (Enum a) => ToVal a where
174177
toVal = pure . fromIntegral . fromEnum
175178

0 commit comments

Comments
 (0)