
Hello, I'm again a bit stuck on a simple problem, and I think it's the same problem that I faced some time ago: http://comments.gmane.org/gmane.comp.lang.haskell.beginners/10843 There is obviously something that I didn't get yet about "data" versus "type". In the program in attachment, I want to parse a JSON file to a Value, then if that value is in fact a JSON object, I want to explore its hash member name -> member value. Now we have: data Value = Object Object <--- the case I hope for | Array Array | String Text | Number Number | Bool !Bool | Null deriving (Eq, Show, Typeable, Data) And then: -- | A JSON \"object\" (key\/value map).type Object = Map Text Value So my clearly flawed plan is to get the value, pattern mach it against (Object hash) and then work on the hash. However for the program in attachment, which I would expect to compile, I get this compile error: question.hs:12:62: Couldn't match expected type `Map.Map T.Text Value' with actual type `Object' In the first argument of `parseConfigMap', namely `map' In the second argument of `($)', namely `parseConfigMap map' In the expression: return $ parseConfigMap map That confuses me, because if the error means by Object the data, then I understood nothing. However if the error means by Object the type, then I would expect it to work, since the type exactly means "Map Text Value"... Any hint? And that really doesn't look like a good idea to me to define a type and a data by the same name, but it's apparently the right way to do it... Thank you! Emmanuel