[Haskell-beginners] type vs data, again...

Andres Löh andres at well-typed.com
Sun Mar 17 13:23:37 CET 2013

Hi there.

> -- | A JSON \"object\" (key\/value map).
> type Object = Map Text Value

See https://github.com/bos/aeson/blob/master/release-notes.markdown


0.3 to 0.4


We switched the intermediate representation of JSON objects from
Data.Map to Data.HashMap, which has improved type conversion

> 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

This has nothing to do with "type" vs. "data". The type synonym
expansion of Object doesn't match your type, because it uses a HashMap
rather than a Map.


Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com

More information about the Beginners mailing list