[Haskell-beginners] Error compiling OpenGL tutorial part 2
Darren Grant
therealkludgy at gmail.com
Fri Aug 17 20:55:06 CEST 2012
Hi,
You're right it was order of operations with points leading to the
error. Without the application or parenthesizing '(points 7)' the
evaluation becomes '((mapM_ a points) 7)'.
I still don't fully understand the error though.
Thanks!
On Fri, Aug 17, 2012 at 7:06 AM, Andrey Yankin <yankin013 at gmail.com> wrote:
> Hi!
>
> Try to group points and 7 with parentheses or put $ before points,
> since points became a function at this step in tutorial.
>
> But error message is a real mystery.
> How could the actual type of mapM_ be unit?
> Can somebody here explain this, please?
> Is unit a monad?
>
>
> 2012/8/16 Darren Grant <therealkludgy at gmail.com>:
>> 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!
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list