
Hi, I want to do some Haskell manipulation and for that I intend to use the YHC.Core.Type. Lets say I have a function trans :: Core -> MyAST I see that I can read a .hs file and output a .ycr by calling in a shell yhc File.hs core As said in http://yhc06.blogspot.com/2006/09/yhccore-api-available.html And supposidly I can write a tool whose main in Haskell is 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 ? Second, is there a way of substituting the call to system by some Haskell code? Third. Im having troubles with the binary version for windows given in http://www.haskell.org/haskellwiki/Yhc/Snapshots . For a Main.hs file containing import Yhc.Core main = print 42 called like D:\tmp>yhc Main Error: File not found, Yhc.Core Reason: imported from Main Looked in: D:\tmp\ . C:\Tools\yhc\lib\yhc\packages\haskell98\1.0 C:\Tools\yhc\lib\yhc\packages\yhc-base\1.0 Where C:\tools\yhc is where I unpack the .zip file downloaded. I would really appreciate some help on this. Best Miguel Vilaça

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%3Alo...
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

Hi Neil, First, thanks for all your advices; I just need to get the darcs repository of Play and did what you said. It's now working. Thanks My intension about core is that it is a Haskell subset and since I'm writing a tool to translate Haskell to another language, core reduces significantly the cases I have to deal with. I'm then converting Core AST to another AST (of other language). Some of the translation steps only need to pattern-matching over Core AST but others require some analysis of Core. For example, things like how many times a variable or a function are used inside a function definition. Best Miguel Vilaça -----Mensagem original----- De: Neil Mitchell [mailto:ndmitchell@gmail.com] Enviada: quarta-feira, 13 de Junho de 2007 16:01 Para: José Miguel Vilaça Cc: yhc@haskell.org Assunto: Re: [Yhc] Haskell file to YHC.Core AST 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%3Alo adCore
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
participants (2)
-
José Miguel Vilaça
-
Neil Mitchell