<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi, John.<br>I am trying JHC in a small embedded system (Medical instruments). The software is written in Clean, and I am translating to Haskell. You may want to take a look at my page:<br><br>http://www.discenda.org/med/<br><br>I am writing because I found something in JHC that smells like a bug. The program compiles without a single complaint both in GHC and JHC, but the resulting binary file does not work in JHC. I wrote a simplified example so you can spot the problem easily. The original program is used to design and simplify digital circuits for sensors (capnograms, electrocardiograms, electroencephalograms, electromyograms, and temperature). It seems that JHC is not able to deal with the trees representing the circuits. Here is a very small program. All it does is to read a tree and show it:<br><br>{- file: tree.hs -}<br>{- compile: jhc tree.hs -dc -o
 jtree }<br>import System (getArgs) <br>import System.IO <br>import IO <br>&nbsp;<br>data Op = AND | OR | NOT deriving (Show, Read) <br>&nbsp;&nbsp;&nbsp; <br>data Tree= L Int | T Op [Tree] deriving (Show, Read)&nbsp; <br>&nbsp;<br>main= do <br>&nbsp; putStrLn "Give me a tree:" <br>&nbsp; s &lt;- getLine<br>&nbsp; let xx= read s<br>&nbsp; putStrLn (show (xx::Tree))<br>&nbsp;&nbsp;&nbsp; <br><br>Here is what happens when I try to run it:<br><br>philip@desktop:~/jhctut$ ./jtree<br>Give me a tree:<br>T AND (L 1, L 2)<br><br>jtree_code.c:2670: case fell off<br>Aborted<br><br>It seems that the problem is in the Read class, since it works if I use the Show class only:<br><br>import System (getArgs) <br>import System.IO <br>import IO <br>&nbsp;<br>data Op = AND | OR | NOT deriving (Show, Read) <br>&nbsp;&nbsp;&nbsp; <br>data Tree= L Int | T Op [Tree] deriving (Show, Read)&nbsp; <br>&nbsp;<br>main= do <br>&nbsp; putStrLn "Give me a tree:" <br>&nbsp; s &lt;-
 getLine<br>&nbsp; let xx= T AND [L 1, L 2]<br>&nbsp; putStrLn (show (xx::Tree))<br><br>I hope you can fix it.<br><br><br><br><br><br><br><br><br>--- On <b>Wed, 11/11/09, John Meacham <i>&lt;john@repetae.net&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: John Meacham &lt;john@repetae.net&gt;<br>Subject: Re: [Haskell-cafe] Opinion about JHC<br>To: haskell-cafe@haskell.org<br>Received: Wednesday, November 11, 2009, 1:37 AM<br><br><div class="plainMail">On Tue, Nov 10, 2009 at 07:41:54PM -0800, Philippos Apolinarius wrote:<br>&gt; I discovered a Haskell compiler that generates very small and fast<br>&gt; code. In fact, it beats Clean. It has the following properties:<br><br>Excellent. that was my goal ;)<br><br>&gt; 1 --- One can cross-compile programs easily. For instance, here is how I generated code for Windows:<br>&gt; <br>&gt; jhc --cross -mwin32 genetic.hs -o
 genetic<br><br>Yup. This was a major goal. compiling for iPhones and embedded arches is<br>just as easy assuming you have a gcc toolchain set up. (at least with<br>the hacked iPhone SDK.. I have never tried it with the official one)<br><br>&gt; <br>&gt; 2 -- It seems to be quite complete.<br>&gt; <br>&gt; 3 -- However, it often compiles a file, but the program fails to run.<br>&gt; <br>&gt; I have the following questions about it:<br>&gt; <br>&gt; 1 -- How active is the team who is writing the JHC compiler?<br><br>Hi, I am the main contributor, but others are welcome and several have<br>made signifigant contributions. Development tends to be spurty. A lot of<br>work will get done in a short amount of time, this generally corresponds<br>to when an external contributor gets involved and the back and forth<br>helps stimulate patches on my part to complement theirs.<br><br>Although I have not been able to devote a lot of my time to jhc in the<br>past,
 hopefully this will change in the not to distant future and I will<br>be able to work on it full time. <br><br><br>&gt; 2 -- Is it complete Haskell? The author claims that it is; it compiled<br>&gt; all programs that I wrote, but that does not mean much, because my<br>&gt; programs are quite simple.<br><br>It does Haskell 98 and several extensions, which is pretty much what GHC<br>does. However, it does not implement the same set of extensions as GHC<br>so this causes issues as a lot of people use GHC extensions extensively. <br><br>I plan on supporting all of Haskell' of course, and the popular GHC<br>extensions to help compatibility. Not all are implemented. <br><br>&gt; 3 -- Why the Haskell community almost never talks about JHC?<br><br>Part of it is that I am not very good at advocacy. I don't always<br>post announcements on the main haskell lists figuring the interested<br>parties are on the jhc list already. I do try to make jhc good, fast,<br>and
 usable, I always hoped someone better at advocacy than me would join<br>the project :) In truth, I think the spurty nature of development also<br>affects this, the list will be quite for a long time with a flurry of<br>development lasting a few weeks occasionally inspiring some discussion<br>in the other groups.<br><br>In any case, I am glad you liked what you found! please join the mailing<br>list for jhc if you are interested in its development or using it.<br><br>&nbsp; &nbsp; &nbsp; &nbsp; John<br><br><br><br>-- <br>John Meacham - ⑆repetae.net⑆john⑈ - <a href="http://notanumber.net/" target="_blank">http://notanumber.net/</a><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe"
 target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></blockquote></td></tr></table><br>
      <hr size=1>
Looking for the perfect gift?<a href="http://www.flickr.com/gift/"><b> Give the gift of Flickr!</b></a>