[Yhc] Yhc: A first impression

Thorkil Naur naur at post11.tele.dk
Sat Jan 6 06:14:39 EST 2007


Hello merry Yhc'ers,

Doing my homework for the upcoming Hac07 event, I installed and ran Yhc for 
the first time over some code that has so far survived both Hugs and GHC. In 
the spirit of Hac07, I downloaded Yhc and built it from the darcs repository, 
as described on http://haskell.org/haskellwiki/Yhc/Building. All this 
happened on a PPC Mac OS X 10.4 using a ghc-6.4.1 that I had installed 
earlier. I also had darcs installed already. Other tools scons, subversion, 
python24 (and perhaps more? I cannot recall) I took from darwinports. All 
this with surprisingly few stumbles.

But I do have some comments and questions. And understand, please, that the 
answers may be perfectly obvious. And that none of these items are preventing 
anything important from happening. Nevertheless, it would help me a lot if 
some expert would take just a quick look through the list and say something 
about each. Feel free to simply say "Supply additional information", "Fix the 
documentation yourself", or "Report a bug" as appropriate.

Here is the list:

1. I compile HelloWorld.hs by "yhc HelloWorld" and it works fine. However, in 
contrast to the description on http://haskell.org/haskellwiki/Yhc/Tutorial, 
the result is deposited in Main.hbc and Main.hi, so to run it, I must use 
"yhi Main". "yhi HelloWorld" produces a complaint (ERROR: couldn't find 
module named 'HelloWorld').

2. When invoking yhc and also yhi, it seems that I can add a lot of different 
suffixes to the module name and they are simply ignored. Thus, "yhi Main.xxx" 
works just as well as "yhi Main". Throwing my input silently away like this 
seems unfriendly, I would much prefer to get an error message.

3. On http://haskell.org/haskellwiki/Yhc/Options and also in the output from 
"yhc -?", I find "-d -dst str        destination path for generated bytecode 
files (default=.)". This dosen't seem right: I the cases I have tried, the 
bytecode was placed in the same directory as the source. And adding "-d 
something" did not seem to have any effect.

4. I also tried the command line yhe. However, I had to go into 
yhc/src/interactive and figure out myself how to build it. It hadn't been 
built as part of the "normal" build process. (I should mention that I am not 
particularly interested in the GUI yhe and probably don't even have the 
installments needed to build it.)

5. Getting to some more meaty things, actually compiling some code, I get the 
message "Error: Context for Prelude.Num needed in left hand pattern at 
98:19-98:23." referring to this line in the code:

  (x,c) = prpExponent (n-1) p

In ghci, I find that

  prpExponent :: (Num b, Integral a) => a -> a -> (a, b)

If I add

    prpExponent :: Integer -> Integer -> (Integer,Int)

(I sinfully avoid these type specifications in many cases), the module 
compiles fine. In another case of this:

  (p2p1f2,0) = divMod (p2+1) p2p1f1

yhc reports "Error: Context for Prelude.Integral needed in left hand pattern 
at 88:3-88:12.". For this, ghci reports

  p2p1f2 :: Integer
  p2 :: Integer
  p2p1f1 :: Integer

and I can add

  p2 :: Integer

to fix the problem. I have additional examples of this, all of them involving 
a pair as left hand side, some of them requiring more elaborate (but less 
obvious) repairs. Any comments?

6. I get the message "Nothing derived for Id 424 at nopos" and similar 
messages with 424 replaced by other numbers when a number of modules are 
compiled. The modules seem to compile OK, however. What does this mean?

7. I have only really managed to execute toy programs. For one of my "real" 
programs (also a toy, but you know what I mean), I get

  Thorkil-Naurs-Computer:~/tn/test/Yhc/HASKELL1/tn/Haskell/Hugs thorkilnaur$ 
yhi Primtal
  ERROR: couldn't find module named '_Builtin'
  tried:
          _Builtin.hbc
          /Users/thorkilnaur/tn/YhcDarcsRepository/yhc/inst/lib/yhc/packages/yhc-base/1.0/_Builtin.hbc
  Thorkil-Naurs-Computer:~/tn/test/Yhc/HASKELL1/tn/Haskell/Hugs thorkilnaur$

and I cannot figure out how to solve this problem. Other of my programs also 
complain that '_Builtin' is missing.

8. Compiling another program, I get

  Thorkil-Naurs-Computer:~/tn/test/Yhc/HASKELL1/tn/Haskell/Hugs thorkilnaur$ 
yhc -I EuclidNormal FcbMStep
  yhc: Error: File not found, Time
  Reason: imported from Main
  Looked in:
    /Users/thorkilnaur/tn/test/Yhc/HASKELL1/tn/Haskell/Hugs/
    .
    EuclidNormal
    /Users/thorkilnaur/tn/YhcDarcsRepository/yhc/inst/lib/yhc/packages/haskell98/1.0
    /Users/thorkilnaur/tn/YhcDarcsRepository/yhc/inst/lib/yhc/packages/yhc-base/1.0

  Thorkil-Naurs-Computer:~/tn/test/Yhc/HASKELL1/tn/Haskell/Hugs thorkilnaur$

I have done a very superficial investigation and it appears that it is 
certainly intended that Time should be included in the Yhc install. On the 
other hand, I cannot off hand find traces in the scons output that something 
related to Time has been built. I have similar problems with CPUTime. Please 
direct me.

9. Finally, I get a message "Error: Identifier getArgs used at 67:15-67:21 is 
not defined." when using that function in a Main module:

  args<-getArgs

Please comment.

Please complain if you think that I am wasting your time with trivia. I have 
been through most of the Wiki pages that I could find that were related to 
Yhc. I have also looked briefly over the bug list.

Many thanks and best regards
Thorkil


More information about the Yhc mailing list