[Haskell-cafe] Linking in Large ByteStrings

2010-01-01 Thread Tom Hawkins
I have a large tarball I want to link into an executable as a ByteString. What is the best way to do this? I can convert the tarball into a haskell file, but I'm afraid ghc would take a long time to compile it. Is there any way to link constant data directly with ghc? If not, what's the most

Re: [Haskell-cafe] Linking in Large ByteStrings

2010-01-01 Thread Svein Ove Aas
On Fri, Jan 1, 2010 at 4:09 PM, Tom Hawkins tomahawk...@gmail.com wrote: I have a large tarball I want to link into an executable as a ByteString.  What is the best way to do this?  I can convert the tarball into a haskell file, but I'm afraid ghc would take a long time to compile it.  Is

Re: [Haskell-cafe] Linking in Large ByteStrings

2010-01-01 Thread John Millikin
On Fri, Jan 1, 2010 at 08:49, Svein Ove Aas svein@aas.no wrote: foo.hs === foreign import ptr bytestring :: Ptr Word8 foreign import ptr bytestring_end :: Ptr Word8 Is this valid syntax? I get a syntax error in 6.10.1, and I don't see it documented in the FFI report.

Re: [Haskell-cafe] Linking in Large ByteStrings

2010-01-01 Thread Judah Jacobson
On Fri, Jan 1, 2010 at 7:09 AM, Tom Hawkins tomahawk...@gmail.com wrote: I have a large tarball I want to link into an executable as a ByteString.  What is the best way to do this?  I can convert the tarball into a haskell file, but I'm afraid ghc would take a long time to compile it.  Is

Re: [Haskell-cafe] Linking in Large ByteStrings

2010-01-01 Thread Svein Ove Aas
On Fri, Jan 1, 2010 at 8:11 PM, John Millikin jmilli...@gmail.com wrote: On Fri, Jan 1, 2010 at 08:49, Svein Ove Aas svein@aas.no wrote: foo.hs === foreign import ptr bytestring :: Ptr Word8 foreign import ptr bytestring_end :: Ptr Word8 Is this valid syntax? I get a syntax error in

Re: [Haskell-cafe] Linking in Large ByteStrings

2010-01-01 Thread Tom Hawkins
Thanks, this worked great. Just a few seconds to link in a 5M tarball. Details: test.s: .global test_data test_data: .byte 0 .byte 1 .byte 2 ... Foo.hs: import Foreign import Data.ByteString.Internal import Data.Word import System.IO.Unsafe foreign import ccall test_data :: Ptr Word8