Thanks, Daniel. I'm still stumped. When I say <br><br>#include "B.hs"<br><br>in a .hs file, all works fine, but when in a .lhs file I get "error: B.hs: No such file or directory". The file B.hs is in the same directory as the including file, which is the current directory for ghci. Same situation with ghc.<br>
<br>If I change "B.hs" to "./B.hs", I get the same behavior. Only if I use a fully qualified path name for B.hs does it get found from the .lhs file.<br><br>I'm using GHC 6.12.3 on Mac OS 10.6.6.<br>
<br>Any ideas? (Anyone, not just Daniel.)<br><br>Thanks, - Conal<br><br><br><div class="gmail_quote">On Thu, Feb 3, 2011 at 2:51 AM, Daniel Fischer <span dir="ltr"><<a href="mailto:daniel.is.fischer@googlemail.com">daniel.is.fischer@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">On Thursday 03 February 2011 10:33:23, Conal Elliott wrote:<br>
> Does anyone have a working example of #include'ing Haskell code into a<br>
> bird-tracks-style .lhs file with GHC? Every way I try leads to parsing<br>
> errors. Is there documentation about how it's supposed to work?<br>
><br>
> Help much appreciated. - Conal<br>
<br>
</div></div>Stupid example:<br>
<br>
-- Main:<br>
<br>
> {-# LANGUAGE CPP #-}<br>
> module Main (main) where<br>
<br>
#include "MachDeps.h"<br>
<br>
> main :: IO ()<br>
> main = do<br>
<br>
#if WORD_SIZE_IN_BITS == 32<br>
<br>
> putStrLn "32 bits"<br>
<br>
#include "Stuff32"<br>
<br>
# else<br>
<br>
> putStrLn "64 bits"<br>
<br>
#include "Stuff64"<br>
#endif<br>
<br>
-- Stuff32:<br>
<br>
putStrLn "Included from Stuff32"<br>
<br>
-- Stuff64:<br>
<br>
putStrLn "Included from Stuff64"<br>
<br>
<br>
It's a bit tricky. Since the C preprocessor is run after the unlit, the<br>
included code should not have bird-tracks, also you have to get the<br>
indentation right. There's probably a way to run cpp before unlit, which<br>
would allow you to have bird-tracks in the #include'd code.<br>
<br>
Much easier with LaTeX-style literate code.<br>
<br>
Cheers,<br>
<font color="#888888">Daniel<br>
</font></blockquote></div><br>