Re: [Haskell-cafe] RE: Answers to Exercises in Craft of FP

2005-01-27 Thread Christian Hofer
Dear Hamilton, I think we just have a different framing of the problem. You are confronted with the laziness of students and want to teach them something anyway. By that you are forced to disrespect the autonomy of students who are intrinsically motivated (e.g. by giving bonus points on exercis

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Krasimir Angelov
I don't pretend to fully understand various unicode standard but it seems to me that these problems are deeper than file path library. The equation (decode . encode) /= id seems confusing for me. Can you give me an example when this happen? What can we do when the file name is passed as command lin

Re: [Haskell-cafe] wierd type errros with MPTCs

2005-01-27 Thread Daniel Fischer
Am Donnerstag, 27. Januar 2005 18:53 schrieb S. Alexander Jacobson: > This code gives me a Kind error because IVal isn't > applied to enough type arguments. > >import qualified Set > >class Table table indexVal | indexVal->table where >--insertIndex::item->indexVal item

Re: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Hamilton Richards
If he really wanted to use a case-expression, he could write it this way: f x = case x of False -> 0 True -> 1 --Ham At 1:02 PM +0100 2005/1/27, Henning Thielemann wrote: On Thu, 27 Jan 2005 [EMAIL PROTECTED] wrote: Can a kind soul please enlighten me on why f bit0 and f bit1 bo

Re: [Haskell-cafe] field record update syntax

2005-01-27 Thread Henning Thielemann
On Thu, 27 Jan 2005, S. Alexander Jacobson wrote: > I have a lot of code of the form > >foo {bar = fn $ bar foo} > > Is there a more concise syntax? I am thinking > the record equivalent of C's foo+=5... > > I imagine there is some operator that does this e.g. > > foo {bar =* fn} > > But

Re: [Haskell-cafe] Converting from Int to Double

2005-01-27 Thread Dmitri Pissarenko
Thanks! -- Dmitri Pissarenko Software Engineer http://dapissarenko.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] File path programme

2005-01-27 Thread robert dockins
Even simple manipulations break in the presence of encoding issues, or even just of unusual paths. What is the extension of "\\.\TAPE0" ? Its not "\TAPE0". BTW this is a valid path on Windows 2000 upwards. If you don't care about corner cases, then you have no worries. It would be nice to

Re: [Haskell-cafe] File path programme

2005-01-27 Thread robert dockins
- Keep the existing System.IO API the same. openFile, createDirectory ... will take the file path as string. The problem is that "string" means different things in haskell and in C. A C "string" is really just a contiguous sequence of octets in memory. A haskell string has a particular interpreta

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Marcin 'Qrczak' Kowalczyk
John Meacham <[EMAIL PROTECTED]> writes: > too bad we can't do things like > > #if exists(module System.Path) > import System.Path > #else > ... > #endif > > I still find it perplexing that there isn't a decent standard haskell > preprocessor For my language Kogut I designed a syntax if

Re: [Haskell-cafe] wierd type errros with MPTCs

2005-01-27 Thread Tomasz Zielonka
On Thu, Jan 27, 2005 at 12:53:24PM -0500, S. Alexander Jacobson wrote: > This code gives me a Kind error because IVal isn't > applied to enough type arguments. > > import qualified Set > > class Table table indexVal | indexVal->table where > --insertIndex::item->indexVal it

Re: [Haskell-cafe] File path programme

2005-01-27 Thread robert dockins
While true, I don't see what this has to do with the choice between PathStart and Maybe PathRoot. The types are isomorphic; we can detect and simplify the /.. case either way. True Because of the above problem, I'm willing to treat path fragments (Relative in both lattices) as a special case. Bu

[Haskell-cafe] field record update syntax

2005-01-27 Thread S. Alexander Jacobson
I have a lot of code of the form foo {bar = fn $ bar foo} Is there a more concise syntax? I am thinking the record equivalent of C's foo+=5... I imagine there is some operator that does this e.g. foo {bar =* fn} But I don't know what it is... -Alex- _

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Marcin 'Qrczak' Kowalczyk
Gregory Wright <[EMAIL PROTECTED]> writes: > Actually, Common Lisp specifies a special data type to handle > logical filepaths, which are distinct from file path strings. Having > had to debug common lisp code that uses this (written by other > people) I've observed that this attempt to do the "Ri

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Marcin 'Qrczak' Kowalczyk
Robert Dockins <[EMAIL PROTECTED]> writes: > More than you would think, if you follow the conventions of modern > unix shells. eg, "foo/.." is always equal to ".", For the OS it's not the same if foo is a non-local symlink. Shells tend to resolve symlinks themselves on cd, and "cd .." means to r

[Haskell-cafe] wierd type errros with MPTCs

2005-01-27 Thread S. Alexander Jacobson
This code gives me a Kind error because IVal isn't applied to enough type arguments. import qualified Set class Table table indexVal | indexVal->table where --insertIndex::item->indexVal item -> table item ->table item union::table item -> table item -> table item

RE: [Haskell-cafe] Problem with Hyperlinking Haddock-documentation

2005-01-27 Thread Simon Marlow
On 27 January 2005 16:54, [EMAIL PROTECTED] wrote: > BTW, would it be worthwhile to let haddock use a list of default > interfaces, say on installation it would create a file with > -i /usr/./base.haddock > -i /usr/./parsec.haddock &cetera > in it, later a user might add other often used i

Re: [Haskell-cafe] Problem with Hyperlinking Haddock-documentation

2005-01-27 Thread Daniel Fischer
Am Donnerstag, 27. Januar 2005 13:38 schrieben Sie: > > You probably want to invoke Haddock like this: > > haddock > -i/usr/share/ghc-6.2.2/html/libraries/base,/usr/share/ghc-6.2.2/librarie > s/base/base.haddock > > (all on one line). The first path specifies the directory of the HTML > for the b

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Gregory Wright
Hello, On Jan 27, 2005, at 10:46 AM, Krasimir Angelov wrote: Hello Guys, Let me propose another solution which is simpler (at least from my point of view)and will not break the existing. When I designed the API of the original System.FilePath library I looked at OS.Path modules from Python and ML.

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Krasimir Angelov
Hello Guys, Let me propose another solution which is simpler (at least from my point of view)and will not break the existing. When I designed the API of the original System.FilePath library I looked at OS.Path modules from Python and ML. They both uses plain string to keep the file path but does p

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Ben Rudiak-Gould
Robert Dockins wrote: >This is true in a sense, but I think making the distinction explicit is >helpful for a number of the operations we want to do. For example, what >is the parent of the relative path "."? Answer is "..". What is the >parent of "/." on unix? Answer is "/.". While true, I don

RE: [Haskell-cafe] Re: library documentation

2005-01-27 Thread Simon Marlow
On 27 January 2005 13:31, Arthur van Leeuwen wrote: > However, having a darcs repository just for the docs would be better > than having a wiki, right? That way you have a central repository > with documentation all ready to go in the format you'd need to enter > into CVS, and then once in a while

Re: [Haskell-cafe] fastest Fibonacci numbers in the West

2005-01-27 Thread Daniel Fischer
Am Donnerstag, 27. Januar 2005 06:08 schrieb William Lee Irwin III: > Inspired by a discussion on freenode #haskell, I tried to write the > fastest Fibonacci number function possible, i.e. given a natural > number input n to compute F_n. > > > For the moment, mlton-generated binaries crash computin

Re: [Haskell-cafe] File path programme

2005-01-27 Thread robert dockins
Warning: I'm not interested in a path parsing/combining library, so my criticisms are perhaps unrelated to your goals. One thing that I'd be interested in seeing for any Path class would be a simple instance for FilePath (or String, if you want to imagine FilePath will be changed). Not everyone w

RE: [Haskell-cafe] Convert to unboxed value? How?

2005-01-27 Thread Simon Marlow
On 27 January 2005 12:36, Dimitry Golubovsky wrote: > What function should be used to convert an integer value to Int#? This function: f :: Int -> Int# f (I# x) = x > A character to Char#? Similarly: f :: Char -> Char# f (C# c) = c there aren't any library functions that do this for yo

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Keean Schupke
Jules Bean wrote: only it isn't. That's a property of a shell, the underlying OS allows spaces in file names with no need for an escaping mechanism. Okay, that was a mistake... but it does not change the point, that pathToString needs to work out what platform it is on, and doing it without typec

Re: [Haskell-cafe] Looking for these libraries...

2005-01-27 Thread Marcin 'Qrczak' Kowalczyk
John Goerzen <[EMAIL PROTECTED]> writes: > I'm looking for libraries / interfaces to these systems from Haskell: > > LDAP > ncurses > zlib (the one in darcs doesn't suit my needs) > bz2lib I once wrapped ncurses (incomplete), zlib and bz2lib. http://sourceforge.net/projects/qforeign/ It's quite

Re: [Haskell-cafe] Re: library documentation

2005-01-27 Thread Arthur van Leeuwen
On Thu, Jan 27, 2005 at 12:41:27PM -, Simon Marlow wrote: > On 27 January 2005 10:46, Peter Simons wrote: > > > Isaac Jones writes: > > > > > http://www.haskell.org/hawiki/LibraryDocsNeedingHelp > > > > This is a great idea. > > I have been thinking you know what would make > > contri

RE: [Haskell-cafe] Re: library documentation

2005-01-27 Thread Simon Marlow
On 27 January 2005 10:46, Peter Simons wrote: > Isaac Jones writes: > > > http://www.haskell.org/hawiki/LibraryDocsNeedingHelp > > This is a great idea. > > I have been thinking you know what would make > contribution to the library efforts even simpler? If they > were available in a Darc

RE: [Haskell-cafe] Problem with Hyperlinking Haddock-documentation

2005-01-27 Thread Simon Marlow
On 27 January 2005 09:03, Daniel Fischer wrote: > Am Mittwoch, 26. Januar 2005 21:49 schrieben Sie: >> On Wed, 26 Jan 2005, Daniel Fischer wrote: >>> Maybe somebody can enlighten me. >>> >>> When I run haddock and put the html files e.g. in directory >>> ~/bar/foo, any references to things define

[Haskell-cafe] Convert to unboxed value? How?

2005-01-27 Thread Dimitry Golubovsky
Hi, What function should be used to convert an integer value to Int#? A character to Char#? Dimitry Golubovsky Middletown, CT ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

RE: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Bayley, Alistair
Another way of looking at it: case peforms pattern matching; it is _not_ an equality test. If you want equality tests, use if-then-else, or something like this (using guards): f x = case () of _ | x == bit0 -> 0 | x == bit1 -> 1 The behaviour that initially threw me was that case works for

Re: [Haskell-cafe] File path programme

2005-01-27 Thread David Roundy
On Thu, Jan 27, 2005 at 11:33:21AM +, Keean Schupke wrote: > > >I guess it's just that I'm more concerned with making possible what is > >currently impossible (according to the library standards)--that is, using > >FFI and IO on the same file--rather than just adding utility features that > >a

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Jules Bean
On 27 Jan 2005, at 11:33, Keean Schupke wrote: Except paths are different on different platforms... for example: /a/b/../c/hello\ there/test and: A:\a\b\ notice how the backslash is used to 'escape' a space or meta-character on only it isn't. That's a property of a shell, the underlying OS allows

Re: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Henning Thielemann
On Thu, 27 Jan 2005 [EMAIL PROTECTED] wrote: > Can a kind soul please enlighten me on why f bit0 and f bit1 > both return 0? > > > bit0 = False > > bit1 = True > > f x = case x of > > bit0 -> 0 > > bit1 -> 1 If you compile with 'ghc -Wall' GHC should report that the ident

[Haskell-cafe] Re: Answers to Exercises in Craft of FP

2005-01-27 Thread Henning Thielemann
On Wed, 26 Jan 2005, Christian Hofer wrote: > who have to learn the interesting stuff completely on our own, because > bad luck supplies us only with Java teachers (although other professors > use Scheme, Lisp, Prolog) That's my experience, too! ___ H

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Keean Schupke
I guess it's just that I'm more concerned with making possible what is currently impossible (according to the library standards)--that is, using FFI and IO on the same file--rather than just adding utility features that application developers could have written themselves. I suppose we don't need

Re: [Haskell-cafe] File path programme

2005-01-27 Thread David Roundy
On Wed, Jan 26, 2005 at 10:20:12PM -0500, Robert Dockins wrote: > class (Show p) => Path p where > isAbsolute :: p -> Bool > isRelative :: p -> Bool > isRelative = not . isAbsolute > basename :: p -> String > parent :: p -> p > pathAppend :: p -> p -> p > pathExtend :: p -> String ->

[Haskell-cafe] Re: library documentation

2005-01-27 Thread Peter Simons
Isaac Jones writes: > http://www.haskell.org/hawiki/LibraryDocsNeedingHelp This is a great idea. I have been thinking you know what would make contribution to the library efforts even simpler? If they were available in a Darcs repository. Saying "darcs push" after you've spontaneously add

Re: [Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread Salvador Lucas
Because both bit0 and bit1 are free *local* variables within the case expression. So, they have nothing to do with your defined functions bit0 and bit1. Best regards, Salvador. [EMAIL PROTECTED] wrote: Can a kind soul please enlighten me on why f bit0 and f bit1 both return 0? bit0 = False

[Haskell-cafe] Question on "case x of g" when g is a function

2005-01-27 Thread yeoh
Can a kind soul please enlighten me on why f bit0 and f bit1 both return 0? > bit0 = False > bit1 = True > f x = case x of > bit0 -> 0 > bit1 -> 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mai

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Keean Schupke
Ben Rudiak-Gould wrote: I'm tentatively opposed to (B), since I think that the only interesting difference between Win32 and Posix paths is in the set of starting points you can name. (The path separator isn't very interesting.) But maybe it does make sense to have separate starting-point ADTs

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Keean Schupke
Georg Martius wrote: Hi, I think Isaac's idea is pretty nice, to have an easy way to add documentation in a collaborative manner. I have the following in mind: A separate wiki which supports generating haddock documentation. Ideally one would see the haddock documentation as it is and would clic

Re: [Haskell-cafe] Problem with Hyperlinking Haddock-documentation

2005-01-27 Thread Daniel Fischer
Am Mittwoch, 26. Januar 2005 21:49 schrieben Sie: > On Wed, 26 Jan 2005, Daniel Fischer wrote: > > Maybe somebody can enlighten me. > > > > When I run haddock and put the html files e.g. in directory ~/bar/foo, > > any references to things defined in the Prelude or the libraries are > > linked to,

Re: [Haskell-cafe] List manipulation

2005-01-27 Thread Jules Bean
On 27 Jan 2005, at 07:32, Sven Panne wrote: Jules Bean wrote: [...] You rather want 'zipWith'. Documentation at: http://www.haskell.org/ghc/docs/latest/html/libraries/base/ GHC.List.html ...along with lots of other funky list processing stuff. Just a small hint: Everything below "GHC" in the hier