Proposal: Add getFullProgName

Heinrich Apfelmus apfelmus at
Tue Jun 19 16:53:57 CEST 2012

Johan Tibell wrote:
> On Sun, Jun 17, 2012 at 2:20 AM, Heinrich Apfelmus
>> Reading Simon Hengel's email, I think that distinguishing between different
>> invocation methods (program, script, interactive) via a data type
>>    data ExecutablePath = Binary FilePath
>>                        | Script FilePath
>>                        | Interactive
>> is an excellent idea! This allows us to use the  getExecutablePath  both in
>> a compiled program and for testing in GHCi.
> I'm a bit undecided whether this distinction is useful. If the user is
> really looking for the executable path there's not much to do except
> call error if the return value is Script or Interactive.

The main use I have in mind is that it makes it easier to develop and 
test your program in GHCi. By distinguishing cases, you can invoke the 
program as either



    runhaskell myprogram.hs

and still get a good path.

> In addition, I don't know how to implement this function correctly.
> For example, if you alias ghc to another name the heuristic in the
> executable-path package fails:

Good point. For the use case mentioned above, any quick and dirty 
heuristic that works most of the time would be sufficient, though.

Ideally, Haskell interpreters would set an environment variable when 
they interpret a source file.

Best regards,
Heinrich Apfelmus


More information about the Libraries mailing list