Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://www.haskell.org/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: Functional analysis and design (Martin Drautzburg) 2. Confused by the qualified imports (Libor Wagner) 3. Re: Confused by the qualified imports (David McBride) 4. Re: Confused by the qualified imports (Brandon Allbery) 5. Natural functions versus existential types (Darren Grant) ---------------------------------------------------------------------- Message: 1 Date: Sun, 6 Jan 2013 12:17:44 +0100 From: Martin Drautzburg <martin.drautzb...@web.de> Subject: Re: [Haskell-beginners] Functional analysis and design To: beginners@haskell.org Message-ID: <201301061217.45041.martin.drautzb...@web.de> Content-Type: Text/Plain; charset="iso-8859-15" On Sunday, 6. January 2013 08:13:14 Rustom Mody wrote: > A favourite example of mine: > Today J S Bach is regarded as the pinnacle of western classical music. > When he was a young man he spent much of his time just copying out 'the > masters' Perfect analogy! You see, with music there is a set of rules which can be learned, because they are written down. But mastering these does not make you a good composer. When given the task "write a tooth-paste jingle" you would still not know where to start. But when you talk to a jingle writer, he could probably tell you his train of thoughts and you would be able to learn from him. Incidently I am interested in writing music too and I ran into the exact same problem as with haskell. Try to find information about how to write 3-4voice vocals, so it sounds like the Beach Boys, the BGs or Abba. Even though this wisdom is known to someone, it is impossible to find something which resembles a tutorial. Either this wisdom cannot be written down at all, or the masters prefer to keep their wisdom concealed. Copying the masters will certainly help, but it is a long and time-consuming process. I was hoping for ways to shorten it. -- Martin ------------------------------ Message: 2 Date: Sun, 6 Jan 2013 17:30:50 +0100 From: Libor Wagner <liborwag...@gmail.com> Subject: [Haskell-beginners] Confused by the qualified imports To: beginners@haskell.org Message-ID: <88f0283390c24324a53acf918d0e3...@gmail.com> Content-Type: text/plain; charset="utf-8" Hi, I was looking into Gloss examples for usage of Repa arrays. For example the Snow example (http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/raster/Snow/Main.hs). What I do not get is that there is qualified import of the Repa package, but the "Z" and ":." are used without the prefix. When I some times accidentally omit the prefix the ghc always yell at me. What em I missing? Thanks, Libor ------------------------------ Message: 3 Date: Sun, 6 Jan 2013 12:00:03 -0500 From: David McBride <toa...@gmail.com> Subject: Re: [Haskell-beginners] Confused by the qualified imports To: Libor Wagner <liborwag...@gmail.com> Cc: beginners@haskell.org Message-ID: <CAN+Tr43q_S0Fi_=d3ncroq-mlt+1ddfta7xbnypcwmgp3cy...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" If you use "import qualified Data.Array.Repa as R" then you have to specify R in front of every function, operator, or type. But if you use "import Data.Array.Repa as R" without the qualified keyword, then you only have to use it when it would be ambiguous which module your function or type comes from (ie. you had multiple modules imported without qualification). On Sun, Jan 6, 2013 at 11:30 AM, Libor Wagner <liborwag...@gmail.com> wrote: > Hi, > > I was looking into Gloss examples for usage of Repa arrays. For example > the Snow example ( > http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/raster/Snow/Main.hs). > What I do not get is that there is qualified import of the Repa package, > but the "Z" and ":." are used without the prefix. When I some times > accidentally omit the prefix the ghc always yell at me. What em I missing? > > Thanks, > Libor > > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20130106/401f2570/attachment-0001.htm> ------------------------------ Message: 4 Date: Sun, 6 Jan 2013 12:01:53 -0500 From: Brandon Allbery <allber...@gmail.com> Subject: Re: [Haskell-beginners] Confused by the qualified imports To: Libor Wagner <liborwag...@gmail.com> Cc: beginners@haskell.org Message-ID: <CAKFCL4X=c3vbo+etay-vhqm7nzaudm51gza2mrj7p9vfe5f...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" On Sun, Jan 6, 2013 at 11:30 AM, Libor Wagner <liborwag...@gmail.com> wrote: > I was looking into Gloss examples for usage of Repa arrays. For example > the Snow example ( > http://code.ouroborus.net/gloss/gloss-stable/gloss-examples/raster/Snow/Main.hs). > What I do not get is that there is qualified import of the Repa package, > but the "Z" and ":." are used without the prefix. When I some times > accidentally omit the prefix the ghc always yell at me. What em I missing? > It's not a fully qualified import (no "qualified" keyword), so names are available both with and without the prefix. This means that you can use names that don't collide with other local or imported bindings without the prefix, but you need to use the prefix if you do need to disambiguate names that colide. For one example, Data.Array.Repa exports a binding "zipWith" --- but so does the Prelude, so you can't use that name unqualified because the compiler doesn't know which one you mean. (:.), on the other hand, is specific to Repa (at least with the imports in your example) so does not need qualification. (You could also get around this by explicitly importing the Prelude with a "hiding (zipWith)" clause.) -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20130106/34de2926/attachment-0001.htm> ------------------------------ Message: 5 Date: Sun, 6 Jan 2013 23:22:51 -0800 From: Darren Grant <therealklu...@gmail.com> Subject: [Haskell-beginners] Natural functions versus existential types To: Haskell Beginners <beginners@haskell.org> Message-ID: <ca+jd6sjux1pdctmeakbqvgdqlh97ojpjtaxkazjrt1-1_yx...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" I've seen some cases where Haskell examples dive into existential types instead of using natural higher order functions. For instance, the "Existential type" wiki page [1] section 2.2 proposes existentials as the solution to a heterogeneous list problem where a ray-tracer must evaluate a trace function for different types of objects. Is there a good reason for this, or is it just a case of prior language assumptions leading to unnatural code? Why could I not just make the list homogeneous by supplying a list of partially evaluated trace functions instead? Sometimes I read an argument that existentials are required due to unknown constraints at compile time, but do not have an intuition for this situation yet. For instance, I read that IO requires existentials. Still working on that one. :) Cheers, Darren [1] http://www.haskell.org/haskellwiki/Existential_type -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20130106/44b0360e/attachment-0001.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 55, Issue 6 ****************************************