ext-core Questions

Dear GH Users, I have been using the -fext-core option to generate *.hcr Files. I've also read the document "An External Representationfor the Core Language." There are still some things that confuse me. Firstly, it seems, that Tuples are sometimes represented for example for (a,b) as DataziTuple.Z2T (a) (b) and in other cases as GHCziPrim.Z2H (a) (b). Why is this? Secondly, in GHC produced Core programs, one sees frequently references to intermediate values from other Modules such as SystemziIO.lvl (print newline?) or GHCziNum.lvl1 (which seems to be an Integer constant) or even GHCziNum.a4 (which seems to be (>) :: Integer -> Integer -> Bool). The type of those names as well as any other names from imported Modules is not given, however. How then is it possible to type check a Core program? (For those who are interested in the background of my question: I wondered if it would be possible to translate Core to Perl. Let's say we'd translate all top level values to perl subs. Then I need to know the arity of each top level value to distinguish non-saturated function applications. For example, if we have sub M::foo($$$) { my ($a1, $a2, $a3) = @_; ... } then, if the core code is like "foo a b" the corresponding perl code could be something like sub { my $arg3 = shift; M::foo($a, $b, $arg3); } yielding a reference to an anonymous function that, when applied to another argument, calls foo. However, this can only be done, when the signature of foo is known, which is not the case if foo is imported.) Merry Chrismas Ingo

(For those who are interested in the background of my question: I wondered if it would be possible to translate Core [Haskell] to Perl.
If I hunt around a bit, I can maybe find my notes on translating to Forth - my goal was to be able to run Haskell on all the printers at work. -- Alastair Reid
participants (2)
-
Alastair Reid
-
Ingo Wechsung