[Haskell-cafe] Universal machines in Haskell

2006-07-26 Thread Donald Bruce Stewart
Now the ICFP contest is now over, several of the entrants have been interested in seeing if we can't write a decent universal machine (the 'hardware' of this year's contest), in Haskell. This is an interesting problem for Haskell, since the spec encourages the use of mutable variables and mutable

Re: [Haskell-cafe] scripting in haskell

2006-07-26 Thread mvanier
Lemmih wrote: On 7/25/06, mvanier [EMAIL PROTECTED] wrote: Hi, I was playing around with runhaskell (runghc to be precise), and I discovered the limitation wherein you have to use the file suffix .hs. Don't get me wrong, runhaskell is great, but if you didn't have that restriction it would

Re: [Haskell-cafe] Re[2]: Why Haskell?

2006-07-26 Thread SevenThunders
Bulat Ziganshin-2 wrote: Hello Matthew, Sunday, July 23, 2006, 10:35:41 AM, you wrote: sequence $ [ reffill b s | s - [0..(fi temits)-1], b - [0..(fi nc)-1]] Now thats interesting. I can see that this function is more appropriate since I do not need to retrieve data from the

Re: [Haskell-cafe] Re: ANN: System.FilePath 0.9

2006-07-26 Thread Krasimir Angelov
On 7/26/06, Neil Mitchell [EMAIL PROTECTED] wrote: The main purpose of canoncialPath is to fix the case on Windows, so c:\my documents\file.doc becomes C:\My Documents\file.doc if that is the case correct version of the file. I think this function will not actually change the file with relation

[Haskell-cafe] Re: ANN: System.FilePath 0.9

2006-07-26 Thread Simon Marlow
Neil Mitchell wrote: I'm not sure about canonicalPath. This interface seems to suffer from the same race conditions as the temporary file interface: the answer is immediately invalid, so you can't rely on it. The main purpose of canoncialPath is to fix the case on Windows, so c:\my

Re[2]: [Haskell-cafe] Re: ANN: System.FilePath 0.9

2006-07-26 Thread Bulat Ziganshin
Hello Krasimir, Wednesday, July 26, 2006, 10:46:13 AM, you wrote: The FilePath abstraction was discussed a number of times and it seems that people prefer an ADT representation instead of plain String. I tend to agree. Maybe such ADT based library can be integrated with some new IO

[Haskell-cafe] Frantk

2006-07-26 Thread Alvaro Galan
Hi, Im trying to use Frantk from winhughs but i dont know how to import the file, where to put the sources to work, how to import other libaries, etc. If i wanto to import Frantk.lh where i have to place (somo folder, inside the winhugs tree, where?) it or import it? Thanks in advance. Alvaro.

Re: [Haskell-cafe] Frantk

2006-07-26 Thread Neil Mitchell
Hi Alvaro, WinHugs has a search path, click on options to change it, and add the directory that corresponds to the copy of Frantk. Or alternatively put it in C:\Program Files\WinHugs\packages\frantk\your code here , which is already on the search path. Thanks Neil

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread David Roundy
On Wed, Jul 26, 2006 at 03:36:13AM +0100, Neil Mitchell wrote: pathSeparator :: Char The character that seperates directories. So what do I do with this? If I need it, it seems like the module has failed. Hopefully no one will ever use it. Its part of the low level functions that the

[Haskell-cafe] Re: ldap-haskell questions

2006-07-26 Thread Ferenc Wagner
Donn Cave [EMAIL PROTECTED] writes: Now that I look at what I did with ldap_set_option, I recall that s actually a little difficult to assign a type, since the third parameter is sometimes Int, Enum, TimeVal, String, and LDAP_OPT_* values overlap in a way that doesn't really say enum to me.

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Neil Mitchell
I'd just point out that I'm not aware of an operating system that GHC runs on that doesn't accept '/' as a path separator. It may be that you could fine an OS where you could compile with jhc or run with hugs that doesn't use '/' (e.g. MacOS 9), but support for MacOS 9 at this stage I wouldn't

Re: [Haskell-cafe] Newbie Q: Deriving MyOrd from Eq problem

2006-07-26 Thread Dmitri O.Kondratiev
On 7/25/06, Jared Updike [EMAIL PROTECTED] wrote: I am trying to derive MyOrd class from Eq (Prelude): class Eq a = MyOrd a where (%=), (%), (%=) :: a - a - Bool x %= y = (x y || x == y) x % y = y x x %= y = (y x || x == y) Q: What's wrong? Why 'Ord'

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Udo Stenzel
Andrew Pimlott wrote: The drive functions stand on their own as a chunk, and are possibly not well suited to a Posix system, but are critical for a Windows system. Why are they critical for portable code? I am fine with Windows-specific functions, but I think it's a mistake to bundle

Re: [Haskell-cafe] Newbie Q: Deriving MyOrd from Eq problem

2006-07-26 Thread voigt . 16734551
Hi Dmitri, I don't have answers for all your questions. But some, at least. --- Dmitri O.Kondratiev [EMAIL PROTECTED] wrote: -- Ok, then I can derive MyOrd class directly from Ord: class Ord a = MyOrd a where (%), (%=), (%), (%=) :: a - a - Bool x % y = x y x %= y =

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Duncan Coutts
On Wed, 2006-07-26 at 15:29 +0200, Udo Stenzel wrote: My criticism is that your properties are all specified in terms of string manipulation. Exactly. I believe, a FilePath should be an algebraic datatype. Most operations on that don't have to be specified, because they are simple and

Re: [Haskell-cafe] Re[2]: Why Haskell?

2006-07-26 Thread Sebastian Sylvan
On 7/26/06, SevenThunders [EMAIL PROTECTED] wrote: Bulat Ziganshin-2 wrote: Hello Matthew, Sunday, July 23, 2006, 10:35:41 AM, you wrote: sequence $ [ reffill b s | s - [0..(fi temits)-1], b - [0..(fi nc)-1]] Now thats interesting. I can see that this function is more

RE: [Haskell-cafe] ghc hackathon start time?

2006-07-26 Thread Simon Peyton-Jones
yes, 9am or 10am. Probably the former. S From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Fitzgerald Sent: 25 July 2006 18:31 To: Haskell Cafe Subject: [Haskell-cafe] ghc hackathon start time? What time on September 14th will the GHC Hackathon begin? I

RE: Re[2]: [Haskell-cafe] Why Haskell?

2006-07-26 Thread Simon Peyton-Jones
Looks possible. But it'd depend on using '' not '= \_ - ...', so a bit fragile. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neil | Mitchell | Sent: 23 July 2006 13:57 | To: Bulat Ziganshin | Cc: haskell-cafe@haskell.org | Subject: Re:

Re: [Haskell-cafe] Newbie Q: Deriving MyOrd from Eq problem

2006-07-26 Thread Daniel Fischer
Am Mittwoch, 26. Juli 2006 16:20 schrieb Dmitri O.Kondratiev: On 7/25/06, Jared Updike [EMAIL PROTECTED] wrote: I am trying to derive MyOrd class from Eq (Prelude): class Eq a = MyOrd a where (%=), (%), (%=) :: a - a - Bool x %= y = (x y || x == y) x % y

[Haskell-cafe] Re: ANN: System.FilePath 0.9

2006-07-26 Thread Neil Mitchell
Hi, Perhaps instead: directoryOf :: FilePath - String filenameOf :: FilePath - String extensionOf :: FilePath - String basenaneOf :: FilePath - String replaceFilename = joinFilePath . directoryOf replaceDirectory = flip joinFilePath . filenameOf Trying to design a

[Haskell-cafe] Re: ldap-haskell questions (+ rant!)

2006-07-26 Thread Donn Cave
On Wed, 26 Jul 2006, Ferenc Wagner wrote: ... I ended up binding ldap_initialize, which supports ldaps: URL-s, and was achievable in a 10 line absolutely nonintrusive patch (darcs sent). Good enough for me ATM. Yes, actually that's not just a good solution to your problem but a good idea

Re: [Haskell-cafe] Re: ANN: System.FilePath 0.9

2006-07-26 Thread Robert Dockins
On Jul 26, 2006, at 1:47 PM, Neil Mitchell wrote: Hi, Perhaps instead: directoryOf :: FilePath - String filenameOf :: FilePath - String extensionOf :: FilePath - String basenaneOf :: FilePath - String replaceFilename = joinFilePath . directoryOf replaceDirectory = flip

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Udo Stenzel
Duncan Coutts wrote: On Wed, 2006-07-26 at 15:29 +0200, Udo Stenzel wrote: Exactly. I believe, a FilePath should be an algebraic datatype. We've had this discussion before. The main problem is that all the current IO functions (readFile, etc) use the FilePath type, which is just a

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 03:36:13AM +0100, Neil Mitchell wrote: Its a rats nest to do it properly, but some very basic idea of does this path have things which there is no way could possibly be in a file - for example c:\|file is a useful thing to have. This seems to encourage the classic

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 03:29:01PM +0200, Udo Stenzel wrote: Andrew Pimlott wrote: Also, it looks from this that you treat paths differently depending on whether they end in a separator. Yet this makes no difference to the system. That seems wrong to me. Not to the system, but some

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 04:34:50PM +0100, Duncan Coutts wrote: On Wed, 2006-07-26 at 15:29 +0200, Udo Stenzel wrote: Exactly. I believe, a FilePath should be an algebraic datatype. Most operations on that don't have to be specified, because they are simple and have an obvious effect. Add

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Neil Mitchell
Hi So what's better? - use an ADT (correct and portable by construction), convert to String when calling the IO library - fumble with Strings, use an unholy mix of specialized and general functions, trip over a corner case Or provide an ADT, demand people marshal to and from this ADT

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Neil Mitchell
Hi Ok, this is a good use case. What should wget do if isValid fails? isValid (makeValid x) == True makeValid is system dependant, and unspecified in its behaviour, although obviously some kind of closeness to the original would be ideal. So what if isValid fails and we don't have this?

Re[2]: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Bulat Ziganshin
Hello Udo, Wednesday, July 26, 2006, 9:41:58 PM, you wrote: - parameterize the FilePath ADT on the character type, you get (FilePath Word16) on Windows (which uses UCS-2, not UCS-4 and not UTF-16) and if i correctly understand, UCS-2 uses 2 bytes for ANY char, while UTF-16 uses 2 or 4

Re[2]: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Bulat Ziganshin
Hello Duncan, Wednesday, July 26, 2006, 7:34:50 PM, you wrote: Exactly. I believe, a FilePath should be an algebraic datatype. Most operations on that don't have to be specified, because they are simple and have an obvious effect. Add a system specific parser and a system specific

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Duncan Coutts
On Wed, 2006-07-26 at 19:41 +0200, Udo Stenzel wrote: Duncan Coutts wrote: On Wed, 2006-07-26 at 15:29 +0200, Udo Stenzel wrote: Exactly. I believe, a FilePath should be an algebraic datatype. We've had this discussion before. The main problem is that all the current IO functions

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Duncan Coutts
On Wed, 2006-07-26 at 11:32 -0700, Andrew Pimlott wrote: On Wed, Jul 26, 2006 at 03:36:13AM +0100, Neil Mitchell wrote: Its a rats nest to do it properly, but some very basic idea of does this path have things which there is no way could possibly be in a file - for example c:\|file is a

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 08:19:47PM +0100, Neil Mitchell wrote: Ok, this is a good use case. What should wget do if isValid fails? makeValid is system dependant, and unspecified in its behaviour, although obviously some kind of closeness to the original would be ideal. So what if isValid

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread David Roundy
On Wed, Jul 26, 2006 at 11:39:40AM -0700, Andrew Pimlott wrote: On Wed, Jul 26, 2006 at 03:29:01PM +0200, Udo Stenzel wrote: Andrew Pimlott wrote: Also, it looks from this that you treat paths differently depending on whether they end in a separator. Yet this makes no difference to the

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Neil Mitchell
Hi re: isValid Perhaps we should be more specific and make it talk about illegal file name characters if that is indeed the use case. Perhaps we should provide a system-dependent list of characters that are not allowed in file names. For example, on windows that would include '?'. Then an

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Udo Stenzel
Andrew Pimlott wrote: Maybe the trailing slash is important enough to take into account. No, not the trailing slash. The difference between a directory and its contents is important enough. This is ususally encoded using a trailing slash, but I'd rather not worry about that detail in a

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 10:32:02PM +0100, Neil Mitchell wrote: Sorry, I meant to say what I think wget should do. IMO, it should have a conservative set of allowed characters, encode the filename into that Not enough, because of the LPT1 issue - unless you add L as a disallowed letter :)

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Doug Quale
Udo Stenzel [EMAIL PROTECTED] writes: No, not the trailing slash. The difference between a directory and its contents is important enough. This is ususally encoded using a trailing slash, but I'd rather not worry about that detail in a program. What does Emacs do with double separators?

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Jeremy Shaw
At Wed, 26 Jul 2006 23:07:36 +0200, Udo Stenzel wrote: What does Emacs do with double separators? I'm at a loss thinking of anything they could denote, but it could be useful. You mean like, /path/to/somewhere//with/double/seperator If so, it treats it as if you had typed in:

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Chris Kuklewicz
First, http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html may be useful to compare to. I learned C:\ is an absolute and C: is a relative path. What are the use cases? I can see four different types of file paths that one will want to manipulate. The following are all pure functions:

[Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-26 Thread Mike Gunter
I had hoped the History of Haskell paper would answer a question I've pondered for some time: why does Haskell have the if-then-else syntax? The paper doesn't address this. What's the story? thanks, -m ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-26 Thread mvanier
As opposed to what? Mike Mike Gunter wrote: I had hoped the History of Haskell paper would answer a question I've pondered for some time: why does Haskell have the if-then-else syntax? The paper doesn't address this. What's the story? thanks, -m

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-26 Thread Sebastian Sylvan
On 7/27/06, mvanier [EMAIL PROTECTED] wrote: As opposed to what? For example case-of, guards (in combination with let or where), or just a function: if :: Bool - a - a - a if True t _ = t if False _ e = e -- example usage myAbs x = if (x 0) (negate x) x /S -- Sebastian Sylvan

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-26 Thread Donn Cave
Quoth Sebastian Sylvan [EMAIL PROTECTED]: | On 7/27/06, mvanier [EMAIL PROTECTED] wrote: | As opposed to what? | | For example case-of, guards (in combination with let or where), or | just a function: | | if :: Bool - a - a - a | if True t _ = t | if False _ e = e | | -- example usage | myAbs x =

[Haskell-cafe] Re: Why does Haskell have the if-then-else syntax?

2006-07-26 Thread Dan Doel
On 7/26/06, Donn Cave [EMAIL PROTECTED] wrote: That looks to me like a different way to spell if then else, but maybe that's the answer to the question - conceptually, for every then there really is an else, however you spell it, and only in a procedural language does it make any sense to leave

Re: [Haskell-cafe] Re: Why does Haskell have the if-then-else syntax?

2006-07-26 Thread Sebastian Sylvan
On 7/27/06, Dan Doel [EMAIL PROTECTED] wrote: On 7/26/06, Donn Cave [EMAIL PROTECTED] wrote: That looks to me like a different way to spell if then else, but maybe that's the answer to the question - conceptually, for every then there really is an else, however you spell it, and only in a

Re: [Haskell-cafe] Why does Haskell have the if-then-else syntax?

2006-07-26 Thread Paul Hudak
Mike Gunter wrote: I had hoped the History of Haskell paper would answer a question I've pondered for some time: why does Haskell have the if-then-else syntax? The paper doesn't address this. What's the story? thanks, -m Thanks for asking about this -- it probably should be in the paper.