[Haskell-beginners] How to compile stub?
Zhi-Qiang Lei
zhiqiang.lei at gmail.com
Wed Jun 22 10:54:12 CEST 2011
Hi,
My attempt which compiles some files with stub failed. Can you tell me how to compile them? Thanks.
PrettyJSON.hs:
renderJValue :: JValue -> Doc
renderJValue (JBool True) = text "true"
renderJValue (JBool False) = text "false"
renderJValue JNull = text "null"
renderJValue (JNumber num) = double num
renderJValue (JString str) = string str
PrettyStub.hs:
import SimpleJSON
data Doc = ToBeDefined
deriving (Show)
string :: String -> Doc
string str = undefined
text :: String -> Doc
text str = undefined
double :: Double -> Doc
double num = undefined
Result:
bogon% ghc -c PrettyJSON.hs PrettyStub.hs SimpleJSON.o
Warning: the following files would be used as linker inputs, but linking is not being done: SimpleJSON.o
PrettyJSON.hs:1:16:
Not in scope: type constructor or class `JValue'
PrettyJSON.hs:1:26: Not in scope: type constructor or class `Doc'
PrettyJSON.hs:2:14: Not in scope: data constructor `JBool'
PrettyJSON.hs:2:29: Not in scope: `text'
PrettyJSON.hs:3:14: Not in scope: data constructor `JBool'
PrettyJSON.hs:3:29: Not in scope: `text'
PrettyJSON.hs:4:13: Not in scope: data constructor `JNull'
PrettyJSON.hs:4:29: Not in scope: `text'
PrettyJSON.hs:5:14: Not in scope: data constructor `JNumber'
PrettyJSON.hs:5:29: Not in scope: `double'
PrettyJSON.hs:6:14: Not in scope: data constructor `JString'
PrettyJSON.hs:6:29: Not in scope: `string'
Best regards,
Zhi-Qiang Lei
zhiqiang.lei at gmail.com
More information about the Beginners
mailing list