[Haskell-cafe] [FGL] Works on ghc, not on Hugs?

Stephane Bortzmeyer bortzmeyer at nic.fr
Thu Jul 27 10:19:28 EDT 2006


[Warning: beginner with FGL, the Functional Graph Library.]

My first program with Data.Graph.Inductive works fine on ghc but
raises a type error with hugs, which strikes me as odd.

% hugs -98 smalltest.hs 
__   __ __  __  ____   ___      _________________________________________
||   || ||  || ||  || ||__      Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__||  __||     Copyright (c) 1994-2005
||---||         ___||           World Wide Web: http://haskell.org/hugs
||   ||                         Report bugs to: hugs-bugs at haskell.org
||   || Version: 20050308       _________________________________________

Hugs mode: Restart with command line option +98 for Haskell 98 mode

ERROR "smalltest.hs":7 - Type error in application
*** Expression     : mkGraph mynodes myedges
*** Term           : myedges
*** Type           : [(Integer,Integer,[Char])]
*** Does not match : [LEdge [Char]]

ghc works:

% ghc --make smalltest.hs
Chasing modules from: smalltest.hs
Compiling Main             ( smalltest.hs, smalltest.o )
Linking ...
% ./a.out

0:"Toto"->[("Couic",1),("Crac",2)]
1:"Tata"->[]
2:"Shadok"->[]
3:"Machin"->[]

Here is the code:

import Data.Graph.Inductive

mynodes = [(0, "Toto"), (1, "Tata"), (2, "Shadok"), (3, "Machin")]
myedges = [(0, 1, "Couic"), (0, 2, "Crac")]

graph :: Gr String String
graph = mkGraph mynodes myedges

main = do
    print graph


More information about the Haskell-Cafe mailing list