Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: How to write the FromJSON instance for CUid (David McBride) 2. Re: How to write the FromJSON instance for CUid (PICCA Frederic-Emmanuel) 3. Re: understanding function signature alignement (simkest...@gmail.com) ---------------------------------------------------------------------- Message: 1 Date: Fri, 10 Aug 2018 07:40:18 -0400 From: David McBride <toa...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] How to write the FromJSON instance for CUid Message-ID: <can+tr4247osgirusackku3kms5m6id9bja-glk+ektaimcc...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" 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.pi...@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@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-0001.html> ------------------------------ Message: 2 Date: Fri, 10 Aug 2018 11:43:23 +0000 From: PICCA Frederic-Emmanuel <frederic-emmanuel.pi...@synchrotron-soleil.fr> To: "The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell" <beginners@haskell.org> Subject: Re: [Haskell-beginners] How to write the FromJSON instance for CUid Message-ID: <a2a20ec3b8560d408356cac2fc148e53015b311...@sun-dag3.synchrotron-soleil.fr> Content-Type: text/plain; charset="us-ascii" > 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. Great, now the real question ;) I use Generic with aeson and I endup like plenty of other with these orphan instances definietion. what is the right way to deal with this. fill a bug against all these types and request instances for these typeclass. or ? Cheers Fred ------------------------------ Message: 3 Date: Fri, 10 Aug 2018 14:25:56 +0200 From: "simkest...@gmail.com" <simkest...@gmail.com> To: Hask begginers <beginners@haskell.org> Subject: Re: [Haskell-beginners] understanding function signature alignement Message-ID: <CAJqT=ykke-sn5afpo_u5+8dw4hokmdahdgzqxg80ykbxpsv...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Yes, thinking it the terms that something which is absolutely free to be whatever, can be restricted and reduced into something else while other way around is not possible is usefull; thanks On Fri, Aug 10, 2018 at 12:06 PM Theodore Lief Gannon <tan...@gmail.com> wrote: > You're right that the return type is more restricted than the argument, > but it's in an *absolute* sense, not a relative one. It's not possible to > relax `m d` to make it the same type as `c`, but it IS possible to > constrain `c` to be the same as `m d`! And that's how `id` works here: the > input in this case is known to be the same type as the output. You need > something wrapped in a monad, and you already have that, so you just use it > as-is. > > On Thu, Aug 9, 2018, 7:22 AM simkest...@gmail.com <simkest...@gmail.com> > wrote: > >> Thanks, it is still a bit fuzzy to me ... >> >> >> I understand what you did but what confuses me is that when i look at >> function with signature like >> >> f :: Monad m => c -> m d >> >> I always think that return type is somehow restricted in comparison to >> input because it demands that output type is wraped inside something (monad >> in this case). >> >> For such signature to fit id signature (a -> a) , c type shoud be also >> wraped inside monad but it is not case here... >> >> Anyhow, I still have to figure it out >> >> thanks >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> > _______________________________________________ > Beginners mailing list > Beginners@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/f5ed4f6c/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 122, Issue 3 *****************************************