simonpj at microsoft.com
Wed Apr 7 11:59:45 EDT 2004
Below is a suggestion from George that initially appears to be about
Template Haskell: access to the GHC version identity. But of course
it's not strictly a TH thing: we could simply provide a module
module GHC.Version where
ghcVersion :: Int
and then you could import that module anywhere, including in your TH
$( if ghcVersion > ... then ... )
And indeed such a thing might be more generally useful, across all
Haskell implementations not just GHC. Perhaps it should be
module System.Compiler where
compilerName :: String
releaseDate :: CalendarTime -- or (Day,Month,Year)?
version :: (Int,Int)
patchLevel :: Int
So then a program could ask whether it was being run by Hugs or GHC or
* Would this be a good thing to agree across compilers?
* What should the interface be? I gave one possibility above; George
* I imagine this'd be useful for the library infrastructure project,
Would anyone like to run with this to get an interface agreed? From the
GHC end we'd be happy to implement any agreed interface.
From: George Russell [mailto:ger at informatik.uni-bremen.de]
Sent: 07 April 2004 10:46
To: Simon Peyton-Jones
Subject: Re: mkName and qualified names
George Russell wrote:
> incidentally you asked for priorities. Mine are (still)
Oh, and another one,
(3) access to the current GHC version. For example
instance Read GhcVersion
instance Ord GhcVersion
thisVersion :: GhcVersion
then you can do
$( if thisVersion >= read "6.4.1"
[dd| -- use whizzo new features
[dd| -- sigh. painful workaround for Luddites
This isn't nearly as important to me as the other two suggestions
I made, however I presume it would be easier to implement.
best wishes and thanks,
More information about the Libraries