I just bought 'The Haskell School of Expression', so I downloaded the latest version of Hugs98, February 2001, and the latest version of the Hugs Graphics Library, 2.0.3. Since the documentation mentioned building on Linux, I built and installed hugs98, ran some tests and felt it was okay. This is on a Redhat Linux 6.0 installation. Then I built the Hugs Graphics Library, and tried to run the first test suggested: ======================================================================= <1122:~/tmp/haskell> runhugs -Pgraphics-2.0.3/lib/x11: graphics-2.0.3/demos/HelloWorld.hs runhugs: Error occurred Reading file "graphics-2.0.3/demos/HelloWorld.hs": Reading file "graphics-2.0.3/lib/x11/GraphicsUtils.hs": Reading file "graphics-2.0.3/lib/x11/GraphicsCore.hs": Reading file "graphics-2.0.3/lib/x11/GraphicsEvent.hs": Reading file "graphics-2.0.3/lib/x11/GraphicsWindow.hs": Reading file "graphics-2.0.3/lib/x11/Xlib.hs": Reading file "graphics-2.0.3/lib/x11/StdDIS.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Int.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Bits.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Int.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Word.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Addr.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/Monad.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Foreign.hs": Reading file "graphics-2.0.3/lib/x11/StdDIS.hs": Reading file "graphics-2.0.3/lib/x11/X.hs": Reading file "graphics-2.0.3/lib/x11/Xlib.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Concurrent.lhs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/ChannelVar.lhs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/ConcBase.hs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/ChannelVar.lhs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Channel.lhs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Semaphore.lhs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/SampleVar.lhs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/exts/Concurrent.lhs": Reading file "/user/donw/tmp/haskell/Hugs.ixl/share/hugs/lib/System.hs": Reading file "graphics-2.0.3/lib/x11/Graphics_Utilities.hs": Dependency analysis ERROR graphics-2.0.3/lib/x11/Graphics_Utilities.hs:73 - Illegal type "IOResult a" in constructor application <1123:~/tmp/haskell> pushd graphics-2.0.3 ~/tmp/haskell/graphics-2.0.3 ~/tmp/haskell <1125:~/tmp/haskell/graphics-2.0.3> find . -name '*hs' -print | xargs grep IOResult ./lib/x11/Graphics_Utilities.hs: mkErr :: Maybe (IOResult a) -> IOError ./lib/win32/GraphicsUtilities.hs: mkErr :: Maybe (IOResult a) -> IOError ======================================================================= I couldn't find a discussion of IOResult in the html versions of the Haskell 98 report or library report, but it is in the prelude: ======================================================================= ./lib/Prelude.hs:data IOResult ======================================================================= I'm still learning all the ins and outs of Haskell, so I don't really know what the problem is. Any helpful hints? -- Don Wakefield Mentor Graphics Corporation (503) 685-1262 8005 S.W. Boeckman Road don_wakefield@mentorg.com Wilsonville, OR 97070-7777
Hi Don,
I just bought 'The Haskell School of Expression', so I downloaded the latest version of Hugs98, February 2001, and the latest version of the Hugs Graphics Library, 2.0.3.
Since the documentation mentioned building on Linux, I built and installed hugs98, ran some tests and felt it was okay. This is on a Redhat Linux 6.0 installation.
Then I built the Hugs Graphics Library, and tried to run the first test suggested: ... ERROR graphics-2.0.3/lib/x11/Graphics_Utilities.hs:73 - Illegal type "IOResult a" in constructor application
The whole module Graphics_Utilities is rather Hugs-specific, and so is the type IOResult. The definition of IOResult (it used to be "data IOResult a = ...") has changed in the latest Hugs release, and, as you could see, it is no longer polymorphic. Thus "IOResult a" is no longer a well-formed type. You can try to fix this in two ways. Either get hold of a somewhat older version of Hugs, or you can try to patch the library. The module Graphics_Utilities exports three functions: bracket, bracket_, and safeTry. But only the two first are actually used outside of the module. Fortunately, it seems as if the Hugs module IO now provides compatible versions of bracket and bracket_ (judging from the type signatures: I have not tried). Thus you could try to either replace the old Graphics_Utilities.hs with the following trivial version: module Graphics_Utilities(module IO) where import IO (bracket, bracket_) or, even better, replace any "import Graphics_Utilities" in the rest of the library with "import IO (bracket, bracket_)". As far as I can tell, you only have to do the latter for GraphicsWindow and GraphicsDC. In both cases, Graphics_Utilities are imported qualified (the graphics library uses the names bracket and bracket_ itself for other purposes), so you actually would have to import IO like this: import qualified IO (bracket, bracket_) as Utils I hope this helps. /Henrik -- Henrik Nilsson Yale University Department of Computer Science nilsson@cs.yale.edu
participants (2)
-
Don Wakefield -
Henrik Nilsson