Compiler versions

Graham Klyne GK at ninebynine.org
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:
http://www.ninebynine.org/Software/HaskellUtils/LibraryInfrastructure/Distribution/HaskellConfig.hs
http://www.ninebynine.org/Software/HaskellUtils/LibraryInfrastructure/Distribution/HaskellConfigTest.hs

#g
--

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
>program:
>
>         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
>whatever.
>
>Questions:
>
>* 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,
>somehow.
>
>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.
>
>Simon
>
>-----Original Message-----
>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
>
>     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,
>
>George
>_______________________________________________
>Libraries mailing list
>Libraries at haskell.org
>http://www.haskell.org/mailman/listinfo/libraries

------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Libraries mailing list