[Haskell-beginners] Why does this work in a program, but cause
a seg fault in ghci?
Maciej Podgurski
maciej.podgurski at googlemail.com
Tue Aug 10 23:56:21 EDT 2010
Am 11.08.2010 04:51 schrieb Kurt Häusler:
> Hi,
> 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?
>
> Thanks_______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
Hi Kurt,
I tested it with GHCi 6.10.4 on a Windows XP system and it works fine:
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.123031769111886e-17,0.0),(0.8660254037844387,-0.4999999999999998,0.0),
(0.49999999999999994,-0.8660254037844387,0.0),(1.2246063538223773e-16,-1.0,0.0),
(-0.4999999999999997,-0.8660254037844388,0.0),(-0.8660254037844384,-0.5000000000000004,0.0),
(-1.0,-1.836909530733566e-16,0.0),(-0.8660254037844386,0.5000000000000001,0.0),
(-0.5000000000000004,0.8660254037844384,0.0),(-2.4492127076447545e-16,1.0,0.0)]
What system are you on?
Best wishes,
Maciej
More information about the Beginners
mailing list