Skip to content

ghc won't #include from .lhs

I just found out the hard way that the following does not work:

1) 
Write a .hsc using \begin{code}-\end{code} which contains 
"#include <foo.h>" and calls a function which is prototyped in 
foo.h
2) Run this through "hsc2hc -o foo.lhs foo.hsc"
3) Compile 
with ghc: You're prototypes are missing, somehow the include has 
been lost :-/

Using "plain" .hs works.

Solution: Don't use 
literate Haskell for .hsc, I haven't checked with bird-tracks, 
though, but I suspect the same will happen. I guess that's why it is 
called "hsc2hs" and not "hsc2lhs"...
Trac metadata
Trac field Value
Version 5.02
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedNoReason
Component Compiler (FFI)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information