How to determine the directory in which a running Haskell script or application lives?

There is a FindBin package which seems to suit your needs and it also works for compiled programs.

As I understand it, this is historically tricky in *nix. There are libraries for some languages to provide this behavior, including FindBin for Haskell: hackage.haskell.org/package/FindBin I'm not sure what this will report with a script though. Probably the location of the binary that runhaskell compiled just prior to executing it.

Also, for compiled Haskell projects, the Cabal build system provides data-dir and data-files and the corresponding generated Paths_. Hs for locating installed files for your project at runtime. haskell.org/cabal/release/cabal-latest/d....

The FindBin package seems to work okay for runhaskell-based scripts too. – Chris W. Jul 26 '10 at 21:08.

I could not find a way to determine script path from Haskell (which is a real pity IMHO). However, as a workaround, you can wrap your Haskell script inside a shell script: #! /bin/sh SCRIPT_DIR=`dirname $0` runhaskell.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions