Proposal: Add getFullProgName

Johan Tibell johan.tibell at gmail.com
Tue Jun 19 18:19:46 CEST 2012


On Tue, Jun 19, 2012 at 8:54 AM, Johan Tibell <johan.tibell at gmail.com>wrote:

> Hi!
>
> On Tue, Jun 19, 2012 at 7:53 AM, Heinrich Apfelmus <
> apfelmus at quantentunnel.de> wrote:
>
>> 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.
>
>
> Since
>
>  * we can't implement this reliably,
>  * the distinction into these three groups doesn't necessarily work for
> all compilers, and
>  * the distinction (I assume) isn't useful in most use cases
>

Another problem with the executable-path like distinction is that it's no
longer possible to find out which executable (i.e. ghc) is running the
script. At a minimum the Script and Interactive constructors would have to
expose that.

    getExecutablePath :: IO FilePath

has a clear meaning: return the path to the executable that's currently
executing. If we want a function that provides the
script/interactive/executable guessing, we should provide both functions.
The guessing one should have this warning:

-- N.B. This function might return Executable in the case of
Script/Interactive and vice versa.

-- Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120619/1764fb46/attachment.htm>


More information about the Libraries mailing list