Proposal: Add getFullProgName

Simon Meier iridcode at
Thu Jun 21 10:51:13 CEST 2012

2012/6/20 Johan Tibell <johan.tibell at>:
> Hi Heinrich,
> On Wed, Jun 20, 2012 at 2:02 AM, Heinrich Apfelmus
> <apfelmus at> wrote:
>> The only trouble I have is that these semantics don't seem to be useful.
>>  For what purpose would you like to know the executable path? The only use
>> case that I have encountered is to find data files relative to the program,
>> but in this case, I need it to work equally well in GHCi, runghc and
>> compiled.
> The most common use case I can think of is having the binary invoke
> itself in some way e.g. using execv. The particular use case I have in
> mind is having the binary copy itself elsewhere (i.e. to another
> machine) and then execute itself again.

I know this a special case and slightly off-topic. However, I'm not
sure, if this use-case provides a good justification for
'getExecutablePath'. Couldn't you just pass an explicit argument with
the path to the file to copy when executing this binary?

Your shortcut via 'getExecutablePath' somehow reminds me of an
arbitrary IO action deep-down in some module trying to call 'main'
again. This requires quite some impurity to achieve and entails a slew
of composability issues. The pure construction of explicitly passing
all arguments was always much simpler in my code.

best regards,

More information about the Libraries mailing list