[Haskell-beginners] Error compiling OpenGL tutorial part 2

Darren Grant therealkludgy at gmail.com
Thu Aug 16 09:16:20 CEST 2012


I am currently following the OpenGL tutorial here:

http://www.haskell.org/haskellwiki/OpenGLTutorial2

But in the current incarnation of Display.hs
(http://pastebin.com/g4NekDVh) I am getting the following error:


$ cabal install
Resolving dependencies...
Configuring mygl-0.1...
Preprocessing executables for mygl-0.1...
Building mygl-0.1...
[3 of 5] Compiling Display          ( Display.hs,
dist\build\mygl\mygl-tmp\Display.o )

Display.hs:13:9:
    Couldn't match expected type `IO a0' with actual type `()'
    In the return type of a call of `mapM_'
    In a stmt of a 'do' expression:
        mapM_
          (\ (x, y, z)
             -> preservingMatrix
              $ do { color
                   $ Color3 ((x + 1.0) / 2.0) ((y + 1.0) / 2.0) ((z +
1.0) / 2.0);
                     translate $ Vector3 x y z;
                   cube (0.1 :: GLfloat) })
          points
          7
    In the expression:
      do { clear [ColorBuffer];
           scale 0.7 0.7 (0.7 :: GLfloat);
           mapM_
             (\ (x, y, z)
                -> preservingMatrix
                 $ do { color
                      $ Color3 ((x + 1.0) / 2.0) ((y + 1.0) / 2.0) ((z
+ 1.0) / 2.0);
                      .... })
             points
             7;
           flush }
cabal.exe: Error: some packages failed to install:
mygl-0.1 failed during the building phase. The exception was:
ExitFailure 1



Not being too familiar with the Haskell syntax I'm not sure how to go
about decomposing the code to find the source of the problem.

Is there any general advice that might help me with this sort of situation?


Thank you!



More information about the Beginners mailing list