Proposal: Add getFullProgName
apfelmus at quantentunnel.de
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
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.
More information about the Libraries