[jhc] Compiling DrIFT with GHC >= 7.2 (was Re: [bug][jhc 7.7] about newIOArray: variable undeclared in the generated C source)

Dirk Ullrich dirk.ullrich at googlemail.com
Wed Jan 18 01:34:03 CET 2012

Hi John

2012/1/18 John Meacham <john at repetae.net>:
> Hi, I'd rather have DrIFT depend only on haskell98, that will give it
> the widest range of compilers it will work on.
To only depend on Haskell 98 if possible to be portable is a good idea imho.
> as far as i know, it is
> already pure haskell 98 so it should just need the right compile flag
> on new versions of ghc.
You are right: passing
--with-hcflags='-hide-all-packages -package haskell98'
to configure does the trick ... nearly: When using GHC 7.4 even then
`Num' seems to be no subclass of `Show' (and `Eq') anymore. But to fix
this one only have to change one line in `src/GenUtils.hs':

diff -r cb15d1da1c66 -r 5d1dc6b5a679 src/GenUtil.hs
--- a/src/GenUtil.hs	Tue Jan 17 21:42:44 2012 +0100
+++ b/src/GenUtil.hs	Wed Jan 18 01:04:16 2012 +0100
@@ -482,7 +482,7 @@
 _ `overlaps` _ = True

 -- | translate a number of seconds to a string representing the
duration expressed.
-showDuration :: Integral a => a -> String
+showDuration :: (Integral a, Show a) => a -> String
 showDuration x = st "d" dayI ++ st "h" hourI ++ st "m" minI ++ show
secI ++ "s" where
         (dayI, hourI) = divMod hourI' 24
         (hourI', minI) = divMod minI' 60

and this adding of the `Show a' constraint to the definition of
`showDuration' is backward compatible, isn't it?
> I tend to mainly keep jhc compatible with what is in ubuntus stable
> release, which is ghc 7.0.2 at the moment. though patches for newer
> versions would be appreciated of course.
Other than DrIFT jhc does use a few of GHC's Haskell extensions (at
least at the moment). So I guess that for jhc one have to remove the
usage of `haskell98' package in favor of `base'.

By the way: A first try to compile DrIFT with UHC
(http://www.cs.uu.nl/wiki/UHC) fails: UHC does not understand (at
least) the options `--make', `-hidir' or `-odir' (but `--odir').


More information about the jhc mailing list