[Haskell-beginners] How to compile stub?

Haisheng Wu freizl at gmail.com
Wed Jun 22 16:30:35 CEST 2011


Not quite understand...
You might like to parse full code to somewhere like http://hpaste.org/ and
provide url..
-Haisheng


On Wed, Jun 22, 2011 at 4:54 PM, Zhi-Qiang Lei <zhiqiang.lei at gmail.com>wrote:

> 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
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110622/80fcb7f0/attachment.htm>


More information about the Beginners mailing list