Making small haskell executables?

With the development branch of GHC (anyone know exactly which version this was added in?): $ ghc -o hello hello.hs $ strip -p –strip-unneeded –remove-section=.comment -o hello-small hello $ du hello hello-small 700 hello 476 hello-small Add the -dynamic flag for a dynamically linked RTS: $ ghc -dynamic -o hello hello.hs $ strip -p –strip-unneeded … Read more

Restricting string literals to Text only

It’s a little bit of overkill, but one solution is to combine OverloadedStrings and RebindableSyntax. The RebindableSyntax extension causes all the implicit function calls that Haskell syntax uses to refer to whatever functions are in scope; for instance, integer literals use any fromIntegral, not necessarily Prelude.fromIntegral. As a side effect, Prelude is no longer implicitly … Read more

Creating Haskell shared libraries on OS X

It is possible to create working shared libraries on 64-bit OS X, with the latest Haskell Platform release (2012.4 64bit) The invocation line works for me: ghc -O2 –make \ -no-hs-main -optl ‘-shared’ -optc ‘-DMODULE=Test’ \ -o libTest.so Test.hs module_init.c module_init.c should be something like: #define CAT(a,b) XCAT(a,b) #define XCAT(a,b) a ## b #define STR(a) … Read more

What is fusion in Haskell?

In general, fusion refers to transformations whose purpose is to get rid of intermediate data structures. You fuse function calls that result in wasteful memory allocations into something more efficient. This is actually IMO one of the biggest applications of Haskell being pure. And you pretty much don’t need to do anything to get it, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)