[Haskell-beginners] Reading JSON using Text.JSON
Brent Yorgey
byorgey at seas.upenn.edu
Tue May 17 15:58:31 CEST 2011
On Mon, May 16, 2011 at 10:40:23PM +0200, Adrien Haxaire wrote:
> Hello,
>
> The only thing that I do not understand yet, is why I can't use the
> 'Node' data which I defined in another module. If the Node data
> declaration is in the file in which I read the JSON, it is ok. If I
> import the module in which I want to place it, ghc tells me that the
> data constructor 'Node' is not in scope.
>
> in Input.hs:
> import Elements (Node)
This only imports the Node type and not its constructors. If you want
to import its constructors as well you have to write
import Elements (Node(..))
(just like in the export list of the Elements module).
-Brent
More information about the Beginners
mailing list