Renick Bell
Linux, coding
20130304
algorave
I have started posting examples of using Conductive to make bass music. Have a listen! http://www.renickbell.net/doku.php?id=algorave
20100112
using the parseargs package
This week I found the parseargs package in Hackage to be useful. It makes handling command-line arguments for your program easy, and gives the user a very pleasant command-line interface to your program.
However, I also needed to use the command line options for the GHC runtime system in my compiled program.
The important thing to note (which I missed on a first sleepy reading) is this:
When your Haskell program starts up, its RTS extracts command-line arguments bracketed between
+RTS
and-RTS
as its own. For example:% ./a.out -f +RTS -p -S -RTS -h foo barThe RTS will snaffle
-p
-S
for itself, and the remaining arguments-f -h foo bar
will be handed to your program if/when it callsSystem.getArgs
.
If you do that, then you can use the command line arguments for the RTS along with whatever you have written into your program.
20100105
profiling your Haskell program: enable profiling for libraries
Having read this chapter in Real World Haskell, I wanted to profile the program I'm working on.
In the section called 2.2 Enable profiling on libraries, this information should absolutely be included, particularly the answer:
That is so much easier than doing each library by hand, though. I was about to get really frustrated until I read that post on StackOverflow.
http://book.realworldhaskell.org/read/profiling-and-optimization.htmlUnfortunately, right away I got errors because profiling hadn't been enabled for the modules I was importing. The Haskell wiki has this page:
http://www.haskell.org/haskellwiki/How_to_profile_a_Haskell_programThe process described there for enabling profiling in libraries is fine if you just need one library, but as it turned out, I needed to enable profiling in about six libraries. What a pain!
In the section called 2.2 Enable profiling on libraries, this information should absolutely be included, particularly the answer:
http://stackoverflow.com/questions/1704421/cabal-not-installing-dependencies-when-needing-profiling-librariesYou just need to do this:
vim ~/.cabal/configUncomment this line and set it to True:
library-profiling: TrueAfter that, you need to cabal install __(module)__ --reinstall for each module you are using, and their dependencies as well. Unfortunately, cabal isn't smart enough to do it all the way down automatically yet.
That is so much easier than doing each library by hand, though. I was about to get really frustrated until I read that post on StackOverflow.
20090802
ghc 6.10.4 solves the previous problem with sendtorepl
Upgrading to ghc 6.10.4 does solve the problem that I previously wrote about with 6.10.3:
http://renick-bell.blogspot.com/2009/05/upgrade-to-ghc-6103-broke-my-vim-script.htmlBecause of that, the workaround that I described previously is no longer needed:
http://renick-bell.blogspot.com/2009/05/workaround-for-sendtorepl-and-ghci.htmlThanks to the tireless developers!
20090531
Workaround for sendtorepl and ghci
Judah, the author of haskeline, says:
"This was probably caused by a bug which has been fixed in the latestIn the meantime, he gave me this solution, which works here:
release of Haskeline (0.6.1.6).
That fix should ship with ghc-6.10.4"
cabal update && cabal install ghci-haskelineThen, you should not interact with your 6.10.3 ghci; rather, you should interact with the executable ghci-haskeline, which is probably here:
~/.cabal/bin/ghci-haskelineSo now, when I start my screen session that I plan to interact with, I use this line:
screen -S haskellSession -t haskellSession ~/.cabal/bin/ghci-haskelineGhc-6.10.4 should not require this simple workaround.
20090530
Upgrade to ghc 6.10.3 broke my vim script
If you by chance tried my vim script, it no longer works in ghci 6.10.3 for multiple lines. I'm not sure why, yet. Some amount of the beginning of the string is cut, and the final bit of the string, :}\n is also cut. There was a change from editline to haskeline. Could that be the reason?
Subscribe to:
Posts (Atom)