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. What is this? (Dimitri DeFigueiredo) 2. Re: What is this? (David McBride) 3. Re: What is this? (Akhra Lief Gannon) ---------------------------------------------------------------------- Message: 1 Date: Wed, 13 Nov 2019 11:04:22 -0800 From: Dimitri DeFigueiredo <defigueir...@ucdavis.edu> To: beginners@haskell.org Subject: [Haskell-beginners] What is this? Message-ID: <f7fc8f17-369f-57fd-7d25-4f7ead213...@ucdavis.edu> Content-Type: text/plain; charset=utf-8 Hello, Can anyone shed a light on the proper way to write the function below. It looks pretty standard, but it's not clear to me what it is? data Abortable res = Aborted | Executed res deriving Functor -- i.e. Maybe abortableThroughEither :: Abortable (Either a b) -> Either a (Abortable b) abortableThroughEither Aborted = Right Aborted abortableThroughEither (Executed (Left a)) = Left a abortableThroughEither (Executed (Right b)) = Right (Executed b) Thanks! Dimitri -- 2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F ------------------------------ Message: 2 Date: Wed, 13 Nov 2019 14:20:12 -0500 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] What is this? Message-ID: <CAN+Tr40DyA1MrvMhmwCMg4QMqq-E=w=o9kpjsho6ha1zp8p...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" It converts from Abortable (Either a b) to Either a (Abortable b). My guess at their probable intent was that this operation tends to error without aborting more often than it errors from an abort, so they put the error on the outside so they can check the common case more easily. On Wed, Nov 13, 2019 at 2:04 PM Dimitri DeFigueiredo < defigueir...@ucdavis.edu> wrote: > Hello, > > Can anyone shed a light on the proper way to write the function below. > It looks pretty standard, but it's not clear to me what it is? > > data Abortable res = Aborted | Executed res deriving Functor -- i.e. Maybe > > abortableThroughEither :: Abortable (Either a b) -> Either a (Abortable b) > abortableThroughEither Aborted = Right Aborted > abortableThroughEither (Executed (Left a)) = Left a > abortableThroughEither (Executed (Right b)) = Right (Executed b) > > Thanks! > > Dimitri > > -- > 2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F > > > _______________________________________________ > 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/20191113/67348072/attachment-0001.html> ------------------------------ Message: 3 Date: Wed, 13 Nov 2019 12:46:44 -0800 From: Akhra Lief Gannon <tan...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] What is this? Message-ID: <cajopsuaejvuwdt7mq0mmokmmbr2qs2qrs0xncbzcqz2zqfr...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Incidentally, if you also derive Foldable and Traversable for Aborted, abortableThroughEither is simply sequence. On Wed, Nov 13, 2019 at 11:20 AM David McBride <toa...@gmail.com> wrote: > It converts from Abortable (Either a b) to Either a (Abortable b). > > My guess at their probable intent was that this operation tends to error > without aborting more often than it errors from an abort, so they put the > error on the outside so they can check the common case more easily. > > On Wed, Nov 13, 2019 at 2:04 PM Dimitri DeFigueiredo < > defigueir...@ucdavis.edu> wrote: > >> Hello, >> >> Can anyone shed a light on the proper way to write the function below. >> It looks pretty standard, but it's not clear to me what it is? >> >> data Abortable res = Aborted | Executed res deriving Functor -- i.e. Maybe >> >> abortableThroughEither :: Abortable (Either a b) -> Either a (Abortable >> b) >> abortableThroughEither Aborted = Right Aborted >> abortableThroughEither (Executed (Left a)) = Left a >> abortableThroughEither (Executed (Right b)) = Right (Executed b) >> >> Thanks! >> >> Dimitri >> >> -- >> 2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F >> >> >> _______________________________________________ >> 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/20191113/591834b6/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 137, Issue 1 *****************************************