
On Tue, Aug 17, 2010 at 7:07 PM, Christopher Done
Sadly this is true. I went ahead and tested this to confirm; compiled mueval (which uses hint), copied the executable to a virtual machine and it required the GHC package repo among other GHC-related libraries.
The size is indeed a problem. But how much? How does this compare to Lua et al?
IIRC, the Haskell Platform installer for Windows has around 70 MiB. So, if you want a simple installer to include in your installer, be prepared to have another 70 MiB. I said a dozen mebibytes (12 MiB) because I think the bare minimum needs to have at least this size to have something useful for an app, but this isn't backed up by anything. Lua, on the other hand, is embedded in the executable and weights less than 200 KiB, probably much less than a typical Haskell executable. I don't know about other interpreters. I just did a quick look at some executables I had in hand (compiled by GHC 6.12.3) and the smallest one weights at 2.3 MiB. Hmmm, let me see something: $ du -hs /usr/lib/ghc-6.12.3/ 588M /usr/lib/ghc-6.12.3/ Wow! That was unexpected. =) $ du -sm /usr/lib/ghc-6.12.3/* | sort -n | tail -n 5 23 /usr/lib/ghc-6.12.3/template-haskell-2.4.0.1 24 /usr/lib/ghc-6.12.3/ghc 77 /usr/lib/ghc-6.12.3/Cabal-1.8.0.6 78 /usr/lib/ghc-6.12.3/base-4.2.0.2 265 /usr/lib/ghc-6.12.3/ghc-6.12.3 $ du -sm /usr/lib/ghc-6.12.3/ghc-6.12.3/* | sort -n | tail -n 5 1 /usr/lib/ghc-6.12.3/ghc-6.12.3/ZipDataflow.p_hi 30 /usr/lib/ghc-6.12.3/ghc-6.12.3/libHSghc-6.12.3-ghc6.12.3.so 43 /usr/lib/ghc-6.12.3/ghc-6.12.3/HSghc-6.12.3.o 56 /usr/lib/ghc-6.12.3/ghc-6.12.3/libHSghc-6.12.3.a 111 /usr/lib/ghc-6.12.3/ghc-6.12.3/libHSghc-6.12.3_p.a Ah, so this one file alone takes 111 MiB =). But 30 MiB of libHSghc.so probably will need to be included. $ xz -9 < /usr/lib/ghc-6.12.3/ghc-6.12.3/libHSghc-6.12.3-ghc6.12.3.so | wc -c 4507512 So using one of the best generic compression algorithms available, the size of one of the biggest libraries that a program using hint may need comes down to 4.5 MiB. Probably if someone is careful enough to include only what really is necessary, the program installer will be at most 10 MiB and will need at most 50 MiB on disk. I think this is doable, but a lot more than Lua; hint can't be used on set-top boxes =).
Sandboxing and import whitelisting with hint is also a no-brainer -- see mueval and http://tryhaskell.org/. I also implement import filtering here with haskell-src-exts: http://github.com/chrisdone/haskell-json/blob/master/haskell-json.hs#L137 So import whitelisting is trivial.
Sweet, I had forgotten about mueval. And wouldn't it be nice if we could hand haskell-src-exts's parse tree directly into GHC? Cheers! =) -- Felipe.