[Yhc] Prelude.hs is there anything I can remove to make it
smaller?
Tom Shackell
shackell at cs.york.ac.uk
Tue Aug 14 17:17:23 EDT 2007
Hi Alexis,
Are you still using the approach we discussed earlier of separating yhi
into a bytecode loader and a separate interpreter? For example where the
bytecode is first converted into C source code and then compiled and
linked directly against the interpreter?
The advantage of doing it that way is that yhi only loads functions that
are referenced by the main program. If something is in the Prelude but
your main function could never reach it then it isn't loaded. If you
were using yhi to generate C source code then this means it would only
generate the minimum code needed to run the program.
That said, I would imagine there might still be a *lot* of opportunities
for trimming down the prelude. Error message functions pull in functions
to write strings to stdout, for example. Since you can't print anything
there's no point in having them. Similarly it's easy to end up pulling
in the Show instances, but again they're not likely to be of much to you.
Probably your best bet is to use the "yhi generating C code" approach,
take a small example and see what it generates. From that you can work
out what things it's including that are not useful for your purposes and
replace them in the Prelude with empty declarations.
Hope that helps :-)
Tom
Alexis Morris wrote:
> Hi all,
>
> I am attempting to load up yhi on the Lego NXT, but I have several
> questions about the main startup files that need to be there. In
> particular I am referring to Prelude.hbc, _Driver.hbc, Primitive.hbc,
> and the user created mainMod.hbc. Based on reading the sequence in the
> main.c file these are all that are needed to start a simple program (say
> Hello World). I plan to put several of these into a hash table and send
> them over to the waiting NXT where I will then load from memory.
>
> The problem is that I have a limited amount of memory (100KB left in ROM
> and 64KB in RAM) for loading in files and I note that Primitive.hbc is
> actually 139KB. I am curious about whether there's anything in
> Prelude.hs that can be safely removed...some really obscure functions,
> if any...
>
> Any ideas?
>
> Cheers and thanks,
> --
> </Alexis>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Yhc mailing list
> Yhc at haskell.org
> http://www.haskell.org/mailman/listinfo/yhc
More information about the Yhc
mailing list