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"...