[Haskell-beginners] How to "cast" FromJSON instance value

Baa aquagnu at gmail.com
Tue Aug 1 08:31:40 UTC 2017

Hello, List!

I have, for example, function with signature like

  fn :: FromJSON a => Map Text a -> BlahBlah

and I want to treat this `a` as String (or `Text`), to read it with
`readMaybe`. Am I right that it's impossible? I get error about "...a
is rigid type and could not be matched with Text...". But `Text` is
`FromJSON` instance. Is it possible to do it (cast, convert, unwrap, etc)?

The problem's source is that early I worked with `Text` values only
(getting from HTML form) but now they become any type: int's, bool's,

Best regards,

More information about the Beginners mailing list