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 [EMAIL PROTECTED]
You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: Why is there no notion of a one-tuple (e.g., a '([])' as opposed to a '[]') in Haskell? (Jason Dusek) 2. Re: Why is there no notion of a one-tuple (e.g., a '([])' as opposed to a '[]') in Haskell? (Benjamin L.Russell) 3. Re: Why is there no notion of a one-tuple (e.g., a '([])' as opposed to a '[]') in Haskell? (Aaron Denney) 4. Module import problem (Casey Rodarmor) 5. Re: Module import problem (Chry Cheng) 6. Re: Module import problem (Casey Rodarmor) 7. Re: Module import problem (Christian Cheng) 8. Re: Module import problem ( Chadda? Fouch? ) ---------------------------------------------------------------------- Message: 1 Date: Thu, 25 Sep 2008 00:56:26 -0700 From: "Jason Dusek" <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] Why is there no notion of a one-tuple (e.g., a '([])' as opposed to a '[]') in Haskell? To: "Benjamin L. Russell" <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=UTF-8 How is a 1-tuple different from a value? If we think of tuple types as product types, then the 1-ary product is a simple type -- and 1-ary tuples of values are simple values. In Python, tuples really are like lists -- to the point of being mapable, iterable, &c. In Haskell, lists and tuples share very little. -- _jsn ------------------------------ Message: 2 Date: Thu, 25 Sep 2008 19:14:45 +0900 From: Benjamin L.Russell <[EMAIL PROTECTED]> Subject: [Haskell-beginners] Re: Why is there no notion of a one-tuple (e.g., a '([])' as opposed to a '[]') in Haskell? To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii On Wed, 24 Sep 2008 21:27:37 -0400, [EMAIL PROTECTED] wrote: >G'day all. > >Quoting "Benjamin L.Russell" <[EMAIL PROTECTED]>: > >>> Haskell doesn't have a notion of a one-element tuple. >> >> Why not? > >As noted by others, there's no syntactic space for them. > >Perhaps more crucially, it's hard to see where such a thing would >be useful. The 2-tuple (i.e. pair) is a categorical product, and can >be used to carry around two things where you would normally only >have space for one. The 0-tuple (i.e. void) is a categorical terminal >object, and can be used to fill in space in a parametric data structure >where no annotation is actually needed. > >One reason why they're provided in the Prelude is so that standard >functions can do operations on them. It's hard to see where a standard >function would use a generic 1-tuple. > >Generally speaking, if you need a type-checked 1-tuple, you almost >certainly don't want a generic one. So, basically generic one-element tuples don't exist because they're not needed, and there is no elegant way to represent them syntactically. That makes sense. Nevertheless, I can't help feeling that Haskell could perhaps been made even more elegant if some alternative tuple notation not conflicting with parentheses had been used; e.g., '{}' (braces) (please forgive me if braces are already used for some other purpose of which I am not aware). Then, for example, we could have the following: {} (a unit, or void), {{}} (a one-tuple), {{{}}} (a one-tuple consisting of a one-tuple), {{{{}}}} (a one-tuple consisting of a one-tuple consisting of a one-tuple), ... We could then come up with an n-depth-ordering on tuples, as opposed to an ordering on n-tuples. While perhaps not immediately useful, this ordering would have an interesting structure, and perhaps lead to some kind of mathematics of n-depth-orderings, which could be even more interesting, and which could be expressed in Haskell. -- Benjamin L. Russell ------------------------------ Message: 3 Date: Wed, 24 Sep 2008 23:26:33 +0000 (UTC) From: Aaron Denney <[EMAIL PROTECTED]> Subject: [Haskell-beginners] Re: Why is there no notion of a one-tuple (e.g., a '([])' as opposed to a '[]') in Haskell? To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii On 2008-09-24, Benjamin L.Russell <[EMAIL PROTECTED]> wrote: >>Haskell doesn't have a notion of a one-element tuple. > > Why not? In addition to the syntactic nightmare mentioned, or the possible loss of parenthesized expressions, it's just plain not necessary. Aside from strictness, a one-tuple is isomorphic to the element inside. We like category theory, so we ignore trivial isomorphisms. -- Aaron Denney -><- ------------------------------ Message: 4 Date: Sun, 28 Sep 2008 17:32:02 +0200 From: "Casey Rodarmor" <[EMAIL PROTECTED]> Subject: [Haskell-beginners] Module import problem To: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 Hi there! I have a problem with importing a module I'd like to use. My working directory, ~/proj, contains: ./Haskore -- a folder containing a version of haskore, this music thingy ./test.hs -- random stuff using haskore The main file in ~/proj/Haskore is ~/proj/Haskore/Haskore.hs, which contains the following module declaration: > module Haskore(module HaskoreLoader) where > import HaskoreLoader I've tried to put all the following in ~/proj/test.hs, with no luck: > import Haskore -- Could not find module `Haskore': > import Haskore.Haskore -- file name does not match module name `Haskore' Am I doing something wrong? Is there a way to place a module in an arbitrary directory, without having to modify it? Thanks so much for your help! Best, Casey Rodarmor ------------------------------ Message: 5 Date: Mon, 29 Sep 2008 00:08:23 +0800 From: Chry Cheng <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] Module import problem To: "Casey Rodarmor" <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii "Casey Rodarmor" <[EMAIL PROTECTED]> writes: > Hi there! > > I have a problem with importing a module I'd like to use. > > My working directory, ~/proj, contains: > ./Haskore -- a folder containing a version of haskore, this music thingy > ./test.hs -- random stuff using haskore > > The main file in ~/proj/Haskore is ~/proj/Haskore/Haskore.hs, which > contains the following module declaration: >> module Haskore(module HaskoreLoader) where >> import HaskoreLoader > > I've tried to put all the following in ~/proj/test.hs, with no luck: >> import Haskore -- Could not find module `Haskore': >> import Haskore.Haskore -- file name does not match module name `Haskore' > > Am I doing something wrong? Is there a way to place a module in an > arbitrary directory, without having to modify it? > > Thanks so much for your help! > > Best, > Casey Rodarmor > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners You have to tell GHC where to find Haskore. To do this, call ghc with the i option: ghc -iHaskore/ then, import using: import Haskore ------------------------------ Message: 6 Date: Sun, 28 Sep 2008 18:20:25 +0200 From: "Casey Rodarmor" <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] Module import problem Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 On Sun, Sep 28, 2008 at 6:08 PM, Chry Cheng <[EMAIL PROTECTED]> wrote: > "Casey Rodarmor" <[EMAIL PROTECTED]> writes: > >> Hi there! >> >> I have a problem with importing a module I'd like to use. >> >> My working directory, ~/proj, contains: >> ./Haskore -- a folder containing a version of haskore, this music thingy >> ./test.hs -- random stuff using haskore >> >> The main file in ~/proj/Haskore is ~/proj/Haskore/Haskore.hs, which >> contains the following module declaration: >>> module Haskore(module HaskoreLoader) where >>> import HaskoreLoader >> >> I've tried to put all the following in ~/proj/test.hs, with no luck: >>> import Haskore -- Could not find module `Haskore': >>> import Haskore.Haskore -- file name does not match module name `Haskore' >> >> Am I doing something wrong? Is there a way to place a module in an >> arbitrary directory, without having to modify it? >> >> Thanks so much for your help! >> >> Best, >> Casey Rodarmor >> _______________________________________________ >> Beginners mailing list >> Beginners@haskell.org >> http://www.haskell.org/mailman/listinfo/beginners > > You have to tell GHC where to find Haskore. To do this, call ghc with the i > option: > > ghc -iHaskore/ > > then, import using: > > import Haskore > Hi Chry, Thanks for the answer, everything works now :-) I must admit, I'm a little disappointed if that's the only way to get it to work. On the surface of things, I don't see why one can't just put a Module in some/arbitrary/directory, and then import it as some.arbitrary.directory.Module. The need to use a flag on the command line seems a little unnecessary. Can anyone give a little insight into why this decision was made? Best, Casey ------------------------------ Message: 7 Date: Mon, 29 Sep 2008 01:33:34 +0800 From: "Christian Cheng" <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] Module import problem To: "Casey Rodarmor" <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 On Mon, Sep 29, 2008 at 12:20 AM, Casey Rodarmor <[EMAIL PROTECTED]> wrote: > > On Sun, Sep 28, 2008 at 6:08 PM, Chry Cheng <[EMAIL PROTECTED]> wrote: > > "Casey Rodarmor" <[EMAIL PROTECTED]> writes: > > > >> Hi there! > >> > >> I have a problem with importing a module I'd like to use. > >> > >> My working directory, ~/proj, contains: > >> ./Haskore -- a folder containing a version of haskore, this music thingy > >> ./test.hs -- random stuff using haskore > >> > >> The main file in ~/proj/Haskore is ~/proj/Haskore/Haskore.hs, which > >> contains the following module declaration: > >>> module Haskore(module HaskoreLoader) where > >>> import HaskoreLoader > >> > >> I've tried to put all the following in ~/proj/test.hs, with no luck: > >>> import Haskore -- Could not find module `Haskore': > >>> import Haskore.Haskore -- file name does not match module name `Haskore' > >> > >> Am I doing something wrong? Is there a way to place a module in an > >> arbitrary directory, without having to modify it? > >> > >> Thanks so much for your help! > >> > >> Best, > >> Casey Rodarmor > >> _______________________________________________ > >> Beginners mailing list > >> Beginners@haskell.org > >> http://www.haskell.org/mailman/listinfo/beginners > > > > You have to tell GHC where to find Haskore. To do this, call ghc with the > > i option: > > > > ghc -iHaskore/ > > > > then, import using: > > > > import Haskore > > > > Hi Chry, > > Thanks for the answer, everything works now :-) > > I must admit, I'm a little disappointed if that's the only way to get > it to work. On the surface of things, I don't see why one can't just > put a Module in some/arbitrary/directory, and then import it as > some.arbitrary.directory.Module. The need to use a flag on the command > line seems a little unnecessary. > I beg to differ. I don't think it's reasonable to expect the compiler to figure out on its own where we have stashed additional classes. Other programming languages have a similar requirement. For Java, it's the class path (e.g., javac -classpath Haskore); C/C++, the include directories (IIRC, gcc -I Haskore), etc. > Can anyone give a little insight into why this decision was made? > > Best, > Casey > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 8 Date: Sun, 28 Sep 2008 19:35:19 +0200 From: " Chadda? Fouch? " <[EMAIL PROTECTED]> Subject: Re: [Haskell-beginners] Module import problem To: "Casey Rodarmor" <[EMAIL PROTECTED]> Cc: beginners@haskell.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 2008/9/28 Casey Rodarmor <[EMAIL PROTECTED]>: > I must admit, I'm a little disappointed if that's the only way to get > it to work. On the surface of things, I don't see why one can't just > put a Module in some/arbitrary/directory, and then import it as > some.arbitrary.directory.Module. The need to use a flag on the command > line seems a little unnecessary. > > Can anyone give a little insight into why this decision was made? Because that's how every language worked for decades for good reasons : a library usually stay in one place on the filesystem while several projects from several locations try to use it. So of course we would prefer for each of these projects source to refer to the library in the same fashion, especially given that it can be moved later on or split between different buildtree or ... Now, you may not be aware of that but you can register a library so that GHC always know where to find its module, as long as you use --make on the command line : ghc --make myScript.hs . -- Jedaï ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 3, Issue 12 ****************************************