[Haskell-cafe] Problem on using class as type.

Jesse Schalken jesseschalken at gmail.com
Mon Oct 3 16:02:37 CEST 2011


What about "users :: ToJson a => a"?

On Tue, Oct 4, 2011 at 12:42 AM, Magicloud Magiclouds <
magicloud.magiclouds at gmail.com> wrote:

> Hi,
>  I have a function:
> post :: (ToJson p, FromJson q) => String -> String -> String ->
> Map.Map String p -> IO q
>  Now I'd like to call it like:
> r <- post site token "user.addMedia" (Map.fromList [ ("users", users ::
> ToJson)
>                                                   , ("medias", medias
> :: ToJson) ])
>  So I got the problem. If I used things like "users :: ToJson", then
> class used as a type error occurred. But if I did not use them, since
> users and medias were actually different types, then fromList failed,
> required the type of medias the same with users.
>
>  How to resolve the conflict?
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111004/0745c16b/attachment.htm>


More information about the Haskell-Cafe mailing list