<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">That worked, though not sure why I had to delete the .o file.<br><br>On to ghci?<br><br>Michael<br><br>--- On <b>Sun, 1/30/11, Paul L <i>&lt;ninegua@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Paul L &lt;ninegua@gmail.com&gt;<br>Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging.<br>To: "michael rice" &lt;nowgate@yahoo.com&gt;<br>Cc: haskell-cafe@haskell.org, "Daniel Fischer" &lt;daniel.is.fischer@googlemail.com&gt;<br>Date: Sunday, January 30, 2011, 7:31 PM<br><br><div id="yiv1940552886">Maybe you want to remove Snowflake.o (or even *.o) and then try compiling it again.<div><br></div><div>Regards,</div><div>Paul Liu<br><br><div class="yiv1940552886gmail_quote">On Sun, Jan 30, 2011 at 4:11 PM, michael rice <span dir="ltr">&lt;<a rel="nofollow"
 ymailto="mailto:nowgate@yahoo.com" target="_blank" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="yiv1940552886gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">SimpleGraphics has a bunch of main programs: main0, main1, main2, main3, and main3book. I sequentially changed each to main and ran all five successfully.<br>
<br>Then I did the same for Snowflake.lhs (see code below) which already had a single main function.<br><br>Michael<br><br>==============<br><br>[michael@localhost src]$ ghc --make Snowflake -main-is Snowflake<br>Linking Snowflake ...<br>
/usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main':<br>(.text+0x10): undefined reference to `ZCMain_main_closure'<br>/usr/lib/ghc-6.12.3/libHSrtsmain.a(Main.o): In function `main':<br>(.text+0x18): undefined reference to `__stginit_ZCMain'<br>
collect2: ld returned 1 exit status<br>[michael@localhost src]$<br><br>==============<div><div></div><div class="yiv1940552886h5"><br><br>This code was automatically extracted from a .lhs file that
<br>uses the following convention:
<br>&nbsp;<br>-- lines beginning
 with "&gt;" are executable
<br>-- lines beginning with "&lt;" are in the text,
<br>&nbsp;&nbsp;&nbsp;&nbsp; but not necessarily executable
<br>-- lines beginning with "|" are also in the text,
<br>&nbsp;&nbsp;&nbsp;&nbsp; but are often just expressions or code fragments.
<br>&nbsp;<br>&gt; module Snowflake where
<br>&gt; import SOE
<br>&nbsp;<br>&gt; m = 81&nbsp; :: Int -- multiple of 3 for triangle size
<br>&gt; x = 250 :: Int -- x and y coordinates of
<br>&gt; y = 250 :: Int --&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; center of snowflake
<br>&gt; colors = [ Magenta, Blue, Green, Red, Yellow ]
<br>&nbsp;<br>&gt; snowflake :: Window -&gt; IO ()
<br>&gt; snowflake w = do
<br>&gt;&nbsp;&nbsp; drawTri w x y m 0 False -- draw first triangle w/flat top
<br>&gt;&nbsp;&nbsp; flake&nbsp;&nbsp; w x y m 0 True&nbsp; -- begin recursion to complete job
<br>&nbsp;<br>&gt; flake :: Window -&gt; Int -&gt; Int -&gt; Int -&gt; Int -&gt; Bool -&gt; IO ()
<br>&gt;
 flake w x y m c o = do
<br>&gt;&nbsp;&nbsp; drawTri w x y m c o&nbsp; -- draw second triangle
<br>&gt;&nbsp;&nbsp; let c1 = (c+1)`mod`5 -- get next color
<br>&gt;&nbsp;&nbsp; if (m&lt;=3) then return ()&nbsp; -- if too small, we're done
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else do
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flake w (x-2*m) (y-m) (m`div`3) c1 True&nbsp; -- NW
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flake w (x+2*m) (y-m) (m`div`3) c1 True&nbsp; -- NE
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flake w&nbsp; x&nbsp;&nbsp;&nbsp; (y+2*m) (m`div`3) c1 True&nbsp; -- S
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flake w (x-2*m) (y+m) (m`div`3) c1 False -- SW
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flake w (x+2*m) (y+m) (m`div`3) c1 False -- SE
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; flake w&nbsp; x&nbsp;&nbsp;&nbsp; (y-2*m) (m`div`3) c1 False -- N
<br>&nbsp;<br>&gt; drawTri :: Window -&gt;
 Int -&gt; Int -&gt; Int -&gt; Int -&gt; Bool -&gt; IO ()
<br>&gt; drawTri w x y m c o =
<br>&gt;&nbsp;&nbsp; let d =&nbsp; (3*m) `div` 2
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps = if o
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then [(x,y-3*m),&nbsp; (x-3*m,y+d), (x+3*m,y+d)] -- side at bottom
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else [ (x,y+3*m), (x-3*m,y-d), (x+3*m,y-d)] -- side at top
<br>&gt;&nbsp;&nbsp; in drawInWindow w
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (withColor (colors !! c)
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (polygon ps))
<br>&nbsp;<br>&gt; main
<br>&gt;&nbsp;&nbsp; = runGraphics (
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; do w &lt;- openWindow "Snowflake Fractal" (500,500)
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; drawInWindow w (withColor White
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (polygon
 [(0,0),(499,0),(499,499),(0,499)]))
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; snowflake w
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spaceClose w
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; )
<br>&nbsp;<br>&gt; spaceClose :: Window -&gt; IO ()
<br>&gt; spaceClose w
<br>&gt;&nbsp;&nbsp; = do k &lt;- getKey w
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if k==' ' || k == '\x0'
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then closeWindow w
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else spaceClose w
<br>&nbsp;<br>&nbsp;<br></div></div><div class="yiv1940552886im">--- On <b>Sun, 1/30/11, Daniel Fischer <i>&lt;<a rel="nofollow" ymailto="mailto:daniel.is.fischer@googlemail.com" target="_blank" href="/mc/compose?to=daniel.is.fischer@googlemail.com">daniel.is.fischer@googlemail.com</a>&gt;</i></b> wrote:<br></div><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">
<div class="yiv1940552886im"><br>From: Daniel Fischer &lt;<a rel="nofollow" ymailto="mailto:daniel.is.fischer@googlemail.com" target="_blank" href="/mc/compose?to=daniel.is.fischer@googlemail.com">daniel.is.fischer@googlemail.com</a>&gt;<br>Subject: Re: [Haskell-cafe] Code from Haskell School of Expression hanging.<br>
</div>To: <a rel="nofollow" ymailto="mailto:haskell-cafe@haskell.org" target="_blank" href="/mc/compose?to=haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>,
 "michael rice" &lt;<a rel="nofollow" ymailto="mailto:nowgate@yahoo.com" target="_blank" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;<br>Date: Sunday, January 30, 2011, 6:48 PM<div class="yiv1940552886im"><br><br><div>On Monday 31 January 2011 00:27:41, michael rice wrote:<br>
&gt; And here's the same with GHC. It never gets to linking and creating an<br>&gt; executable the way the GLFW sample program does.<br>&gt;<br>&gt; Michael<br>&gt;<br>&gt; ===============<br>&gt;<br>&gt; [michael@localhost ~]$ cd ./SOE/SOE/src<br>
&gt; [michael@localhost src]$ ghc --make SimpleGraphics.lhs<br>&gt; [2 of 2] Compiling SimpleGraphics&nbsp;&nbsp; ( SimpleGraphics.lhs,<br>&gt; SimpleGraphics.o ) [michael@localhost src]$<br><br>The module name is not Main, so to get an executable, you have to tell ghc <br>
what the Main module is.<br>Assuming SimpleGraphics.lhs contains a main function,<br><br>$ ghc --make SimpleGraphics -main-is SimpleGraphics<br><br>should do it.<br><br>Cheers,<br>Daniel<br><br><br></div></div></blockquote>
</td></tr></tbody></table><br>







      <br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a rel="nofollow" ymailto="mailto:Haskell-Cafe@haskell.org" target="_blank" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a rel="nofollow" target="_blank" href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Paul Liu<br><br>
</div>
</div></blockquote></td></tr></table><br>