<div dir="ltr"><div><div><div>Hi,<br><br> thank you for the tip! It helps but it's not quite there yet. If you see the program in attachment, I can make it compile only by commenting the type declaration for the second function, otherwise it's the exact same error message as before.<br>
<br></div>In -Wall the compiler does suggest me the signature, but it's not enlightening for me at this point, I've yet to dig that deep in haskell's type system:<br>parseConfigMap :: forall t (m :: * -> *). Monad m => t -> m ()<br>
<br></div> Can you explain me why my type signature is not correct?<br><br></div> Thank you again!<br><div><br>Emmanuel<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Mar 17, 2013 at 1:23 PM, Andres Löh <span dir="ltr"><<a href="mailto:andres@well-typed.com" target="_blank">andres@well-typed.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there.<br>
<div class="im"><br>
> -- | A JSON \"object\" (key\/value map).<br>
> type Object = Map Text Value<br>
<br>
</div>See <a href="https://github.com/bos/aeson/blob/master/release-notes.markdown" target="_blank">https://github.com/bos/aeson/blob/master/release-notes.markdown</a><br>
<br>
Quoting:<br>
<br>
"<br>
0.3 to 0.4<br>
<br>
[...]<br>
<br>
We switched the intermediate representation of JSON objects from<br>
Data.Map to Data.HashMap, which has improved type conversion<br>
performance.<br>
<div class="im">"<br>
<br>
> So my clearly flawed plan is to get the value, pattern mach it against<br>
> (Object hash) and then work on the hash. However for the program in<br>
> attachment, which I would expect to compile, I get this compile error:<br>
><br>
> question.hs:12:62:<br>
> Couldn't match expected type `Map.Map T.Text Value'<br>
> with actual type `Object'<br>
> In the first argument of `parseConfigMap', namely `map'<br>
> In the second argument of `($)', namely `parseConfigMap map'<br>
> In the expression: return $ parseConfigMap map<br>
<br>
</div>This has nothing to do with "type" vs. "data". The type synonym<br>
expansion of Object doesn't match your type, because it uses a HashMap<br>
rather than a Map.<br>
<br>
Cheers,<br>
Andres<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Andres Löh, Haskell Consultant<br>
Well-Typed LLP, <a href="http://www.well-typed.com" target="_blank">http://www.well-typed.com</a><br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</font></span></blockquote></div><br></div>