Skip to content

Commit

Permalink
fixup! Add template haskell helpers to generate Unbox instances
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed Jul 5, 2023
1 parent 9d02794 commit 603dea2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/src/Streamly/Internal/Data/Unbox/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ mkOffsetDecls :: Int -> [Field] -> [Q Dec]
mkOffsetDecls tagSize fields =
init
((:) (valD
(varP (mkOffsetName 0))
(normalB [|tagSize + $(varE _initialOffset)|])
[])
(varP (mkOffsetName 0))
(normalB
[|$(litE (IntegerL (fromIntegral tagSize))) +
$(varE _initialOffset)|])
[])
(map mkOffsetExpr (zip [1 ..] fields)))

where
Expand Down

0 comments on commit 603dea2

Please sign in to comment.