mgsloan / store

Fast binary serialization in Haskell
MIT License
109 stars 35 forks source link

Error with makeStore (from Data.Store.TH) #139

Closed cdisselkoen closed 5 years ago

cdisselkoen commented 5 years ago

Let me start by saying that I'm not sure if this is actually a bug in store or in something else; or it may be out of scope. However, it does impact the ability to use store, so any suggestions for workarounds are welcome.

For certain data types, using makeStore on that data type results in the error

    A 115-tuple is too large for GHC
      (max size is 62)
      Workaround: use nested tuples or define a data type

Here's a simple example reproducing the error (using the llvm-hs-pure library):

{-# LANGUAGE TemplateHaskell #-}

import Data.Store.TH
import LLVM.AST.Constant

makeStore ''Constant

Note, the same error occurs with TH.Derive:

{-# LANGUAGE TemplateHaskell #-}

import Data.Store
import LLVM.AST.Constant
import TH.Derive

$($(derive [d| instance Deriving (Store Constant) |]))
cdisselkoen commented 5 years ago

Here is output of compiling the first example with GHC's -ddump-splices command. We can clearly see that there are 115-tuples being used. Again, not sure if this is store's problem or someone else's.

mgsloan commented 5 years ago

Ah yes, I encountered this myself, and fixed it in https://github.com/fpco/store/commit/287e252516b1a6a7b19c25dc5a584116dbf5fd4f . I just forgot to make a release - I've just now released version 0.5.1.0. Please verify that this version fixes the issue for you. Thanks!

mgsloan commented 5 years ago

Going to go ahead and close this, assuming that the problem has been fixed by the release.