Monday, July 24, 2006

Yhc Core (v2)

I have tweaked the Yhc -core output so its much more like normal Haskell, still not 100% there, but getting closer all the time :)

I want it to be possible to do:
yhc -core Sample.hs 2> Sample2.hs
hugs Sample2.hs

At the moment, that sometimes works. The only problem I know about is dictionaries for typeclasses - and thats all to do with their names. I'm still figuring out what the answer to that should be.

Anyway, taking the pam daeh example thats been used before:


daeh v220 =
case v220 of
(:) v221 v222 ->
v221
_ ->
Prelude.error Sample._LAMBDA228

_LAMBDA228 =
"Sample: Pattern match failure in function at 9:1-9:15."

pam v223 v224 =
case v224 of
[] ->
[]
(:) v225 v226 ->
(:) (v223 v225) (Sample.pam v223 v226)

test v227 =
Sample.pam Sample.daeh v227



And now the cool bit:

hugs Sample2.hs

And it works!

Hopefully this will be of use to people who want to work with reduced Haskell, since they can use existing Haskell parsers and type checkers to do their work. If you are interested in this, drop an email to the yhc mailing list (yhc -AT- haskell.org).