Hi everyone,

   As we all know, FiniteMap was deprecated, and with GHC-6.6 Data.Map
must be used instead. Some function names in Data.Map clash with names
in prelude, and Map is usually imported qualified.

Happy generates GLR parsers (-l), but the templates it uses keep calling
FiniteMap functions. When Data.Map is imported, it's not imported
qualified and some function names are ambiguous.

I've been using a modified template to generate a GLR parser with
GHC-6.6 and it seems to work just fine (there are few changes, not a big
deal anyway).

I just got the most recent version of Happy and the problem remains, so
I applied my changes to GLR_Lib.lhs and ran a diff. The result is
attached to this mail.

Hope it helps someone else.

Cheers,
Ivan.

PS. I seem to recall having sent this mail months ago. Couldn't find it,
though. In case it's been sent twice, I apologise.

diff -rN old-happy/templates/GLR_Lib.lhs new-happy/templates/GLR_Lib.lhs
46c46
< >import Data.Map
---
> >import qualified Data.Map as Map
116a117,119
> #if __GLASGOW_HASKELL__ >= 603
> >type Forest       = Map.Map ForestId [Branch]
> #else
117a121
> #endif
143a148,150
> #if __GLASGOW_HASKELL__ >= 603
> >       ns_map = Map.toList f 
> #else
144a152
> #endif
153a162,164
> #if __GLASGOW_HASKELL__ >= 603
> > = case runST Map.empty [0..] (tp toks) of
> #else
154a166
> #endif
292a305,307
> #if __GLASGOW_HASKELL__ >= 603
> > = chgS $ \f -> ((), Map.insert i [] f)
> #else
293a309
> #endif
303a320,325
> #if __GLASGOW_HASKELL__ >= 603
> >       case Map.lookup i f of 
> >         Nothing               -> chgS $ \f -> (False, Map.insert i [b] f)   
> >         Just bs | b `elem` bs -> return True
> >                 | otherwise   -> chgS $ \f -> (True,  Map.insert i (b:bs) f)
> #else
308c330
< 
---
> #endif
313a336,338
> #if __GLASGOW_HASKELL__ >= 603
> > = useS $ \s -> Map.findWithDefault no_such_node i s
> #else
314a340
> #endif

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to