[Haskell-beginners] Why does this work in a program, but cause a seg fault in ghci?

Kurt Häusler kurt.haeusler at gmail.com
Tue Aug 10 22:51:57 EDT 2010

I am going through the OpenGL tutorial 1 (http://www.haskell.org/haskellwiki/OpenGLTutorial1)

The first example program in chapter 2 works if I compile it and run it, but I don't understand all of it so I am playing with bits of it in ghci. Look what happens:

GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> let myPoints = map (\k -> (sin(2*pi*k/12),cos(2*pi*k/12),0.0)) [1..12]
Prelude> myPoints 
[(0.49999999999999994,0.8660254037844387,0.0),(0.8660254037844386,0.5000000000000001,0.0),(1.0,6.123233995736766e-17,0.0),(0.8660254037844388,-Segmentation fault

Any ideas?


More information about the Beginners mailing list