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: (Implicit) equality testing using multiple function definitions (Brandon Allbery) 2. Combining GHC library and Platform documentation (Mister Globules) 3. Re: Combining GHC library and Platform documentation (Magnus Therning) ---------------------------------------------------------------------- Message: 1 Date: Mon, 18 Jul 2011 21:47:26 -0400 From: Brandon Allbery <allber...@gmail.com> Subject: Re: [Haskell-beginners] (Implicit) equality testing using multiple function definitions To: Tom Murphy <amin...@gmail.com> Cc: beginners <beginners@haskell.org> Message-ID: <CAKFCL4XSU7HxB9kzSMHutJ-GYDrdqUe5baF=4v3=nbkuft4...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" On Mon, Jul 18, 2011 at 20:44, Tom Murphy <amin...@gmail.com> wrote: > Hi list! > When I define an algebraic datatype without an instance for Eq, > I'm obviously unable to use the (==) function on it. I can > pattern-match with a series of function definitions (f [] = False; f x > = True) on the expression, though. Why is that? > I understand that in the second case I'm not literally using the > (==) function, but it seems like there would be instances where you'd > intentionally not want to be able to test for equality, and > pattern-matching with multiple function definitions circumvents that. > (==) is about value comparison; pattern matching is about constructor comparison, which is on a higher semantic level as value equality is only meaningful within the same constructor. "Circumvents"? You make it sound like the point of typeclasses is to restrict things. In fact, the point is to *undo* the restrictions necessarily introduced by polymorphism: if you don't know the type of something, you don't know what you can do with it. Typeclasses let us say "this can be any type, but we need to be able to do <x> with it". They don't circumvent; they *add*. Are you approaching this from an OO perspective, where you can throw messages at anything and hope they stick? Haskell, ML, and similar languages are based on strong types: if you know the type, you know *everything* about its possible values. Dynamic message passing means you can send a message to an object that doesn't know what to do with it, producing a runtime error; the whole point of strong typing is to make using an operation not supported by a given type a *compile time* error. That is not to say there aren't hybrid systems (see O'Caml) or static strongly-typed OO systems (see research papers about OOHaskell; this hasn't been followed up directly, although it's the basis for a number of other research topics). But in general, the design of a Haskell or SML program is in designing types that reflect the problem space, such that (a) if you do something that isn't quite right, it is a compile-time error instead of a runtime error, and (b) the types of functions are themselves the solutions to the problems (that is, you would like the implementation for some function to be obvious from its type; when it isn't, this usually means some kind of dependent typing is going on, which Haskell can't express directly, or that you otherwise haven't actually captured the problem space with your types). -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20110718/1aa1e521/attachment-0001.htm> ------------------------------ Message: 2 Date: Tue, 19 Jul 2011 05:51:31 +0000 (UTC) From: Mister Globules <globu...@gmail.com> Subject: [Haskell-beginners] Combining GHC library and Platform documentation To: beginners@haskell.org Message-ID: <loom.20110719t070500-...@post.gmane.org> Content-Type: text/plain; charset=us-ascii Hi, I followed the instructions to install GHC from pre-compiled binaries and the Haskell Platform from source (http://www.vex.net/~trebla/haskell/haskell-platform.xhtml). It works fine (i.e. ghc, ghci, etc.), but the GHC and platform library documentation are in different directories, even when I give the same --prefix and --docdir argument to their respective configure scripts. Also, the GHC index.html file only refers to its own libraries; there's no mention of the other libraries included with the platform. Is there a simple way to create one index.html file with links to all the documentation? As a bonus, is it possible to do the same thing with libraries that I install with cabal? - Globules P.S. This is on Kubuntu. I'm installing it myself, rather than using apt-get, in order to get the most recent version of the platform. ------------------------------ Message: 3 Date: Tue, 19 Jul 2011 10:07:18 +0200 From: Magnus Therning <mag...@therning.org> Subject: Re: [Haskell-beginners] Combining GHC library and Platform documentation To: beginners@haskell.org Message-ID: <20110719080718.GB4584@ohann> Content-Type: text/plain; charset="us-ascii" On Tue, Jul 19, 2011 at 05:51:31AM +0000, Mister Globules wrote: > Hi, > > I followed the instructions to install GHC from pre-compiled binaries and the > Haskell Platform from source > (http://www.vex.net/~trebla/haskell/haskell-platform.xhtml). > > It works fine (i.e. ghc, ghci, etc.), but the GHC and platform library > documentation are in different directories, even when I give the same --prefix > and --docdir argument to their respective configure scripts. Also, the GHC > index.html file only refers to its own libraries; there's no mention of the > other libraries included with the platform. > > Is there a simple way to create one index.html file with links to all the > documentation? > > As a bonus, is it possible to do the same thing with libraries that I install > with cabal? > > - Globules > > > P.S. > > This is on Kubuntu. I'm installing it myself, rather than using apt-get, in > order to get the most recent version of the platform. Hopefully you have a script installed, as part of ghc itself, called gen_contents_index. It's what we in Arch use to update the index.html file when installing/removing Haskell packages. I'm not sure it already supports privately installed packages, but hopefully it won't be too difficult to modify. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://www.haskell.org/pipermail/beginners/attachments/20110719/e8dd429a/attachment-0001.pgp> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 37, Issue 36 *****************************************