[Yhc] Haskell file to YHC.Core AST

Neil Mitchell ndmitchell at gmail.com
Wed Jun 13 11:00:47 EDT 2007


Hi

> I see that I can read a .hs file and output a .ycr by calling in a shell
>  yhc File.hs –core

You might also want to pass -linkcore instead, depending on your use -
some people choose -core, some -linkcore.


> main = system "yhc File.hs -core" >> loadcore "File.ycr" >>= writeFile
> "File.txt" . show . trans
>

> First, the YHC documentation at
> http://www.cs.york.ac.uk/fp/yhc/snapshot/docs/doc-index.html
> do not know about a loadcore function. Is it available ?

It is, and its in the index, but isn't being searched for. Whats
particularly worrying is that I wrote the code that does the
searching, so its most likely my fault... See
http://www.cs.york.ac.uk/fp/yhc/snapshot/docs/Yhc-Core-Serialise.html#v%3AloadCore

> Second, is there a way of substituting the call to system by some Haskell
> code?

No, not currently. I have found the system call to be perfectly sufficient.

> Third. I'm having troubles with the binary version for windows given in
> http://www.haskell.org/haskellwiki/Yhc/Snapshots .  For a
> Main.hs file containing
> Where C:\tools\yhc is where I unpack the .zip file downloaded.

If you are developing Yhc programs you will also need to check out the
darcs repository (but not compile it). Then when doing linking you'll
need to include something like:

ghc --make Main.hs -id:\sources\yhc\current\src\libraries\core
-id:\sources\yhc\current\depends\play

Where d:\sources\yhc\current is the Yhc darcs directory. We'll be
releasing a .cabal package shortly which means this step will no
longer be necessary, but shouldn't be too hard for now.

Any hints on what you are hoping to do with Yhc.Core? We might be able
to provide further information, and will certainly be interested to
see the results :)

Thanks

Neil


More information about the Yhc mailing list