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. Question on terminology (Joel Neely) 2. Re: Question on terminology (Rein Henrichs) 3. Re: general observation about programming (Jeffrey Brown) ---------------------------------------------------------------------- Message: 1 Date: Wed, 2 Mar 2016 16:50:13 -0600 From: Joel Neely <joel.ne...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: [Haskell-beginners] Question on terminology Message-ID: <CAEEzXAgs=a5DcuNWM+E-9e9HtBzzDN1s=nbsqr0xmzgqppw...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" IIUC, one would describe fmap as "lifting" a function g into a functor f, in the sense of Functor f => (g a b) -> g a -> g b Is there an inverse concept (? co-lift ?) that describes Functor f => (g a -> g b) -> a -> b Similarly is there standard terminology for "distributing" and "gathering" in the sense of Functor f => f [a] -> [f a] and Functor f => [f a] -> f [a] respectively? References much appreciated! -jn- -- Beauty of style and harmony and grace and good rhythm depend on simplicity. - Plato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160302/73d663af/attachment-0001.html> ------------------------------ Message: 2 Date: Wed, 02 Mar 2016 23:27:58 +0000 From: Rein Henrichs <rein.henri...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Question on terminology Message-ID: <CAJp6G8zqdupn9srEmg=4+jyl4aj3cmtoxms1stecq1npmj_...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" "Co-lift" is not possible for functors generally. Comonads have a method extract :: Comonad w => w a -> a, which is somewhat related. Distributing and gathering are both really distributing. The first example distributes [] over f while the second example distributes f over []. Neither are possible for functors generally, but Applicative and Data.Traversable are strong enough to provide sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a). The problem is that the Applicative and Traversable laws alone are not enough to guarantee that this is well behaved. What you actually need is a stronger notion that f (g a) is an "f-structure" containing "g-structures" *all of the same shape*. If they aren't, the inner structures won't be distributed properly and some of the odd shaped bits might get cut off. For example, try to transpose a list of lists (iow, distribute [] over []) and you'll see that all of the inner lists must be the same length for your transposition to be well behaved. Conor McBride covers this in a very interesting way in this StackOverflow answer: http://stackoverflow.com/a/13100857/2225384 On Wed, Mar 2, 2016 at 2:50 PM Joel Neely <joel.ne...@gmail.com> wrote: > IIUC, one would describe fmap as "lifting" a function g into a functor f, > in the sense of > > Functor f => (g a b) -> g a -> g b > > > Is there an inverse concept (? co-lift ?) that describes > > Functor f => (g a -> g b) -> a -> b > > > Similarly is there standard terminology for "distributing" and "gathering" > in the sense of > > Functor f => f [a] -> [f a] > > > and > > Functor f => [f a] -> f [a] > > > respectively? > > References much appreciated! > -jn- > > -- > Beauty of style and harmony and grace and good rhythm depend on > simplicity. - Plato > _______________________________________________ > 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/20160302/c79f453a/attachment-0001.html> ------------------------------ Message: 3 Date: Wed, 2 Mar 2016 18:01:22 -0800 From: Jeffrey Brown <jeffbrown....@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] general observation about programming Message-ID: <CAEc4Ma2rXWrntQ153=jjebmzuhhf5vcegeewhzaahxu0ycz...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" An even more convenient (when applicable) guide to pronunciation: https://wiki.haskell.org/Pronunciation On Sun, Feb 28, 2016 at 4:51 PM, Jeffrey Brown <jeffbrown....@gmail.com> wrote: > That will work in the special case of lists, but there are all sorts of > other things you might want to map across. > > On Sat, Feb 27, 2016 at 7:24 PM, Rustom Mody <rustompm...@gmail.com> > wrote: > >> >> >> On Sun, Feb 28, 2016 at 2:26 AM, Jeffrey Brown <jeffbrown....@gmail.com> >> wrote: >> >>> It is, I agree, not appropriate everywhere, but point-free code can in >>> the right place be much more readable. Maps are a good example. Compare: >>> >>> map (f . g . h) xs >>> >>> to >>> >>> map (\x -> f $ g $ h x) xs >>> >> >> Not quite a fair comparison >> How about? >> [ f (g (h x)) | x <- xs ] >> >> >> >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners >> >> > > > -- > Jeffrey Benjamin Brown > -- Jeffrey Benjamin Brown -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160302/1cb9085a/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 93, Issue 2 ****************************************