[Yhc] Compiling Prelude.hs

Krasimir Angelov kr.angelov at gmail.com
Thu Jan 19 06:48:14 EST 2006


2006/1/19, Thomas Shackell <shackell at cs.york.ac.uk>:
> Yes this is a problem, I had to add size 1 tuple directly into the
> runtime. Thus no Haskell programmer can write something with a size one
> tuple but the compiler can still generate code that uses it.
>
> This is done in src/runtime/BCKernel/builtin/Prelude.c
>
>   prim_addCon("1", 1, 0, CI_NONE);
>
> which adds a data type called "1" directly into the prelude dictionary
> (which makes sense since (,) is called "2" and (,,) is called "3").

I can write a manually implementation for tuple of size 1 but I wonder
wheter the generation of such tuples can be avoided. If you have to
pass the (x) tuple to somewhere then you can simply pass the value of
x instead. In addition all pattern matchings for (x) should be
removed.

Cheers,
  Krasimir


More information about the Yhc mailing list