obelisk
obelisk copied to clipboard
Support ghci options like -fobject-code and -fno-code
-fobject-code
is necessary if you want to use unboxed sums in your code.
Resolved by #529
It seems this is not working, here is the code to test on skeleton project
The ob run
will fail
# LANGUAGE UnboxedSums #-}
module Common.Api where
commonStuff :: String
commonStuff = "Here is a string defined in Common.Api"
where
testval :: (# Int | Bool #)
and in common.cabal
ghc-options: -Wall -fobject-code
common/src/Common/Api.hs:9:4: warning: [-Wunused-local-binds]
Defined but not used: ‘testval’
|
9 | testval = (# | True #)
| ^^^^^^^
Error: bytecode compiler can't handle unboxed tuples and sums.
Possibly due to foreign import/export decls in source.
Workaround: use -fobject-code, or compile this module to .o separately.
well the reason I want to use the -fobject-code
is to make ghci faster, and I hope that will also work once this is fixed.
My guess is the issue is that -fobject-code
needs to be used for the entire GHCi session, and so the stuff that would set package flags just on those modules is too smart.
The options -fobject-code
and -fno-code
are intended for the GHCi session only, as they are not relevant for the native compilation.
So adding them to the .cabal
file sounds like a bad idea. ob run
should provide a separate mechanism to specifying these.