[Haskell-beginners] How to write the FromJSON instance for CUid

David McBride toad3k at gmail.com
Fri Aug 10 11:40:18 UTC 2018


Didn't even occur to me that there would already be a Word32 instance.
Looking at the source, it absolutely deals with every case automatically.

On Fri, Aug 10, 2018 at 4:05 AM, PICCA Frederic-Emmanuel <
frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:

> Hello, and thanks for the reply
>
> What about this
>
> instance FromJSON CGid where
>     parseJSON x = CGid <$> (parseJSON x :: Parser Word32)
>     {-# INLINE parseJSON #-}
>
>
> Do you think that it deal with all the problem you are trying to prevent ?
>
>
> Cheers
>
> Fred
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180810/95572bb8/attachment.html>


More information about the Beginners mailing list