patch applied (cabal): Change handling of bool command line args to allow an unset state

Tue Apr 29 13:11:23 PDT 2008 Duncan Coutts

Tue Apr 29 13:11:23 PDT 2008 Duncan Coutts
* Change handling of bool command line args to allow an unset state For bool valued flags we were always producing the command line string corresponding to a false flag value, even if the flag was not set. For example we'd always get "--disable-shared". It is important for cabal-install to be able to take an empty set of flags, override a few flags and turn the flags back into command line strings without getting a lot of extra defaults. Partly this is because we have to work with older versions of the Cabal library command line which does not recognise the new options.
This patch breaks the nhc98 build of Cabal. Here is the error: $ /Users/malcolm/Haskell/nhc98/script/nhc98 -c Distribution/Simple/Command.hs nhc98comp: The class Prelude.Functor has no instance for the type Prelude.->. Possible sources for the problem are: 189:72-189:75 When type checking declarations at: 189:1-189:81 And the offending lines of the patch: hunk ./Distribution/Simple/Command.hs 188 -boolOpt' :: (b -> Bool) -> (Bool -> b) -> OptFlags -> OptFlags -> MkOptDescr (a -> b) (b -> a -> a) a -boolOpt' g s ffT ffF _sf _lf d get set = BoolOpt d ffT ffF (set.s) (g.get) +boolOpt' :: (b -> Maybe Bool) -> (Bool -> b) -> OptFlags -> OptFlags -> MkOptDescr (a -> b) (b -> a -> a) a +boolOpt' g s ffT ffF _sf _lf d get set = BoolOpt d ffT ffF (set.s) (g `fmap` get) Regards, Malcolm

On Thu, 2008-05-01 at 11:02 +0100, Malcolm Wallace wrote:
This patch breaks the nhc98 build of Cabal. Here is the error:
$ /Users/malcolm/Haskell/nhc98/script/nhc98 -c Distribution/Simple/Command.hs nhc98comp: The class Prelude.Functor has no instance for the type Prelude.->. Possible sources for the problem are: 189:72-189:75 When type checking declarations at: 189:1-189:81
And the offending lines of the patch:
hunk ./Distribution/Simple/Command.hs 188 -boolOpt' :: (b -> Bool) -> (Bool -> b) -> OptFlags -> OptFlags -> MkOptDescr (a -> b) (b -> a -> a) a -boolOpt' g s ffT ffF _sf _lf d get set = BoolOpt d ffT ffF (set.s) (g.get) +boolOpt' :: (b -> Maybe Bool) -> (Bool -> b) -> OptFlags -> OptFlags -> MkOptDescr (a -> b) (b -> a -> a) a +boolOpt' g s ffT ffF _sf _lf d get set = BoolOpt d ffT ffF (set.s) (g `fmap` get)
Thanks. Fixed.
Thu May 1 11:46:20 BST 2008 Duncan Coutts
participants (2)
-
Duncan Coutts
-
Malcolm Wallace