Compiler versions

Graham Klyne GK at
Wed Apr 7 16:16:30 EDT 2004

I started (and stalled, though not permanently I hope) on a similar idea, 
to offer as part of the library infrastructure.  Mine was somewhat more 
complex, maybe too much so, dealing with a combination of static and 
dynamic information, and also hoping to circumvent or minimize the CPP problem.

Copies of the initial code and test module are at:


At 10:59 07/04/04 +0100, Simon Peyton-Jones wrote:
>Library folk
>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
>         import GHC.Version
>         $( 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
>gives another.
>* 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.
>-----Original Message-----
>From: George Russell [mailto:ger at]
>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
>     data GhcVersion
>     instance Read GhcVersion
>     instance Ord GhcVersion
>     thisVersion :: GhcVersion
>then you can do
>     $( if thisVersion >= read "6.4.1"
>        then
>           [dd| -- use whizzo new features
>              ...
>              |]
>        else
>           [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,
>Libraries mailing list
>Libraries at

Graham Klyne
For email:

More information about the Libraries mailing list