Network.URI - MIN_VERSION_base problem, or finger-trouble?

Graham Klyne GK at
Sat Dec 29 19:25:45 CET 2012

A couple of problems with Network.URI have been brought to my attention, so I 
thought I'd have a go at seeing if I could fix them.  It's been a while (years) 
since I used the Haskell toolchain in anger, so I'm a bit out of touch with how 
thinks are working now.

So far, I have:

1. Installed Haskell platform (64-bit version for MacOS).
2. Checked out the 'network' project from
3. cabal install test-framework
4. cabal install test-framework-hunit
5. changed to the 'test' directory of the checked out 'network' project

Then when I try to run GHC, I get this error:
conina:tests graham$ ghc -v -XDeriveDataTypeable ../Network/URI.hs uri001.hs
Glasgow Haskell Compiler, Version 7.4.2, stage 2 booted by GHC version 7.0.4
Using binary package database: 
Using binary package database: 
wired-in package ghc-prim mapped to 
wired-in package integer-gmp mapped to 
wired-in package base mapped to base-
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to 
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -static
*** Chasing dependencies:
Chasing modules from: *../Network/URI.hs,*uri001.hs
Created temporary directory: /tmp/ghc65140_0
*** C pre-processor:
'/usr/bin/gcc' '-E' '-undef' '-traditional' '-m64' '-fno-stack-protector' '-m64' 
'-D__GLASGOW_HASKELL__=704' '-Ddarwin_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' 
'-Ddarwin_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' '-U __PIC__' '-D__PIC__' '-x' 'c' 
'../Network/URI.hs' '-o' '/tmp/ghc65140_0/ghc65140_0.hscpp'

      error: missing binary operator before token "("
*** Deleting temp files:
Deleting: /tmp/ghc65140_0/ghc65140_0.hscpp
Warning: deleting non-existent /tmp/ghc65140_0/ghc65140_0.hscpp
*** Deleting temp dirs:
Deleting: /tmp/ghc65140_0

The problem seems to be with the following lines in URI.hs (starting at line 135):
# if MIN_VERSION_base(4,0,0)
import Data.Data (Data)
# else
import Data.Generics (Data)
# endif

If I remove these lines, and just leave
import Data.Generics (Data)

I can compile and run the test suite just fine:
          Test Cases    Total
  Passed  319           319
  Failed  0             0
  Total   319           319

I'm _guessing_ the problem here is something to do with 
"MIN_VERSION_base(4,0,0)" - not being familiar with the current build 
environment setup, I'm not sure where it is or should be defined, or what it is 
intended to mean.

I did find these:
but they didn't help me.

It seems there's a fix that involves using __GLASGOW_HASKELL__ instead of 
MIN_VERSION_base(4,0,0), but I'm not sure exactly how that would play out - or 
indeed if that's the correct approach for a permanent fix.

Is there something else I should be doing to set up the development and test 
environment for this library module?

Thanks for any pointers.


More information about the Libraries mailing list