Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Ketil Malde
Daniel Fischer <[EMAIL PROTECTED]> writes: >> 'everything matters' is wrong even for IO actions, because the >> actual value returned when the action is executed is completely >> irrelevant to the IO action's identity. > Now that I cannot swallow, that would mean > return 4 == return 5. I would

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread ajb
G'day all. Quoting Daniel Fischer <[EMAIL PROTECTED]>: > The sad truth is that IO actions in general aren't well defined entities > (unless we index them with the space-time-coordinates of their invocation). Not really. One of the ways that IO used to be implemented (still might be on some Hask

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jan-Willem Maessen
On Jan 24, 2005, at 8:53 PM, Jorge Adriano Aires wrote: And it would say nothing about things like: return 4 >> return 5 ==?== return 5 I can live with it. I feel obliged to point out (because the repeated references to the question are driving me up the wall) that this simple equality holds in

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jorge Adriano Aires
(Sorry about the recurrent self answers) > Maybe (not sure) it is sensible to > sapecify return::(a -> IO a), as an action with no side effects such that > return x === return x iff x === x. return x === return y iff x === y<-- this is what I meant to write. But even that is not enough, s

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jorge Adriano Aires
> >This isn't obvious to me. So x is an action, and it does not always > > produces the same side effects when executed. But why should that make > > x/=x? It is the same action, it gets one line from the input, and then > > prints it... > > OK, but then the different side-effects could not be use

Re: [Haskell-cafe] what is a stack overflow?

2005-01-24 Thread Iavor Diatchki
hi, it may happen for different reasons, but a common one is when you have a foldl pattern (programming with an accumulator), for example like this: sumList1 [] accum = accum sumList1 (x:xs) accum = sumList1 xs (x + accum) this adds a list of numbers with an accumulator. because haskell is

Re: [Haskell-cafe] what is a stack overflow?

2005-01-24 Thread S. Alexander Jacobson
Thank you iavor. But the -K option doesn't appear to work with ghci. And I guess the bigger question is what sort of code causes a stack overflow. If 5M is enough stack for most programs then I obviously have some basic coding error which is causing a stack overflow... What sort of code c

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Daniel Fischer
Am Montag, 24. Januar 2005 22:59 schrieb Benjamin Franksen: > Both are wrong. 'just the result matters' is the correct POV for functions, > but not for IO actions. 'everything matters' is wrong even for IO actions, > because the actual value returned when the action is executed is completely > irre

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Daniel Fischer
Am Dienstag, 25. Januar 2005 00:29 schrieb Jorge Adriano Aires: >> x = getLine >>= putStrLn >This isn't obvious to me. So x is an action, and it does not always produces >the same side effects when executed. But why should that make x/=x? It is the >same action, it gets one line from the input, a

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jorge Adriano Aires
> A constant c :: a is just morphism(function) c : 0 -> a, where 0 is the > initial object (empty set). --- Rant2 "correction" Opss I messed up here. Should be terminal should 1-> a (terminal object/unit set). At least that's how I usually think of constants in haskell 1 is ()... so I thin

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Daniel Fischer
Am Montag, 24. Januar 2005 20:25 schrieb Keean Schupke: > I think the endofunctors are defined on the types, not the values > though. So the object of the category is the endofunctor (Type -> Type), > and unit and join are the identity and binary associative operator on > which a Monad is defined.

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jorge Adriano Aires
> We face a severe problem here, not only that IO a is not an instance of Eq, > which takes this whole discussion outside the realm of Haskell, on top of > > that we find the horrible fact that x /= x may be true in the IO Monad, > consider > > x = getLine >>= putStrLn > > or anything similar --

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Benjamin Franksen
On Monday 24 January 2005 21:23, Daniel Fischer wrote: > Am Montag, 24. Januar 2005 11:47 schrieb Jules Bean: > > > > Here are the three monad laws as written on the nomaware site: > > > > 1. (return x) >>= f == f x > > 2. m >>= return == m > > 3. (m >>= f) >>= g == m >>

[Haskell-cafe] what is a stack overflow?

2005-01-24 Thread S. Alexander Jacobson
GHC assumes the user knows the difference between the heap and the stack. I don't. No matter how much heap I specify on the GHCi command line, I get a stack overflow exception. I have no idea what that means or how to remedy it. Hints? Note: My program is basically creating a few 100k ite

Re: [Haskell-cafe] File path programme

2005-01-24 Thread Ben Rudiak-Gould
Isaac Jones wrote: >You might be interested in the new FilePath module that's in the >works. There's been a lot of work to make these functions portable. > >http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/libraries/base/System/FilePath.hs I didn't realize this was in CVS. IMHO this library is de

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Daniel Fischer
Am Montag, 24. Januar 2005 11:47 schrieb Jules Bean: > Here are the three monad laws as written on the nomaware site: > > 1. (return x) >>= f == f x > 2. m >>= return == m > 3. (m >>= f) >>= g == m >>= (\x -> f x >>= g) > > Taking rule 1, we do not simply mean that

Re: [Haskell-cafe] Re: Hugsvs GHC (again)was: Re: Somerandomnewbiequestions

2005-01-24 Thread Glynn Clements
Ketil Malde wrote: > > The point is that the Unix documentation does not consider the short > > pause as data is read off your hard drive to be blocking. So that's why > > select will always report that data is available when you use it with a > > file handle. > > Isn't this also for historic re

Re: [Haskell-cafe] Re: Hugsvs GHC (again)was: Re: Somerandomnewbiequestions

2005-01-24 Thread Glynn Clements
David Roundy wrote: > > >If you're reading from a random-access file, there's no way it can > > >tell you when the file data is buffered, because it doesn't know which > > >part of the file you plan to read. The OS may try to guess for > > >readahead purposes, but select()'s behavior can't dep

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Keean Schupke
Jules Bean wrote: I've lost track of what you mean by 'this case' and indeed of what you mean by 'join' (did you mean mplus? the word join is normally used for the operation of type m (m a) -> m a, which is not often used directly in haskell) However, even addressing your point about endofuncto

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jorge Adriano Aires
> Right, but we are dealing with the type system here. Remember Haskell > monoids are functors on types, not on values ... (ie the base objects the > 'category theory' is applied to are the types not the values)... > > Therefore we only consider the types when considering Monads. How so? Functors

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jules Bean
On 24 Jan 2005, at 18:18, Keean Schupke wrote: Ashley Yakeley wrote: If you remember your category theory, you'll recall that two morphisms are not necessarily the same just because they're between the same two objects. For instance, the objects may be sets, and the morphisms may be functions b

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Keean Schupke
Ashley Yakeley wrote: If you remember your category theory, you'll recall that two morphisms are not necessarily the same just because they're between the same two objects. For instance, the objects may be sets, and the morphisms may be functions between sets: morphisms from A to B are the same

Re: [Haskell-cafe] Hugs for Zaurus

2005-01-24 Thread John Goerzen
On Mon, Jan 24, 2005 at 04:48:49PM +, Graham Klyne wrote: > At 20:15 21/01/05 +, John Goerzen wrote: > >I have built a fixed Hugs for the Zaurus PDA running the OpenZaurus > >distribution. Download here: > >http://quux.org/devel/zaurus/hugs_hugs98-Nov2003-r1_arm.ipk > > Cool! > > I've of

Re: [Haskell-cafe] File path programme

2005-01-24 Thread Graham Klyne
At 15:17 20/01/05 -0500, Mark Carroll wrote: I tried writing a little command-line utility to find the relative path of one thing from another thing (with Unix-like systems in mind). ... FWIW, there's logic to do something like this in my URI module [1]. Bear in mind that there is not, in general

Re: [Haskell-cafe] HaXmL and the IO Monad

2005-01-24 Thread Graham Klyne
At 14:53 21/01/05 +, John Goerzen wrote: I've been playing with HaXmL lately. I've had a need to convert one XML document to another, and HaXmL was very nice for that. Along the way, I've discovered that I need to do some I/O as part of the conversion (specifically due to timezone-related calc

Re: [Haskell-cafe] Hugs for Zaurus

2005-01-24 Thread Graham Klyne
At 20:15 21/01/05 +, John Goerzen wrote: Hello, I have built a fixed Hugs for the Zaurus PDA running the OpenZaurus distribution. Download here: http://quux.org/devel/zaurus/hugs_hugs98-Nov2003-r1_arm.ipk Cool! I've often thought Haskell should be a good language for programming PDA functions

Re: [Haskell-cafe] weird behavior using HUnit

2005-01-24 Thread Keith Wansbrough
> > GHC's memory profiling? > > I just gave it a try: when compiled with -prof -auto-all, my program > is memory hungry in both cases, so I cannot really compare... [cc'd back to list in case anyone else finds this useful; hope that's OK] Ah. The cost-centre annotations get in the way of the op

[Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Ashley Yakeley
In article <[EMAIL PROTECTED]>, Keean Schupke <[EMAIL PROTECTED]> wrote: > Right, but we are dealing with the type system here. Remember Haskell > monoids are functors on types, not on values ... (ie the base objects the > 'category theory' is applied to are the types not the values)... > > Ther

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jules Bean
On 24 Jan 2005, at 10:32, Keean Schupke wrote: Right, but we are dealing with the type system here. Remember Haskell monoids are functors on types, not on values ... (ie the base objects the 'category theory' is applied to are the types not the values)... Therefore we only consider the types when

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Keean Schupke
Ashley Yakeley wrote: I don't believe this represents a good understanding of IO actions as Haskell values. For instance, 'return ()' and 'putStrLn "Hello"' are the same type, but are clearly different actions and so are usually considered to be different values. That the latter prints out text

[Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Ashley Yakeley
In article <[EMAIL PROTECTED]>, Keean Schupke <[EMAIL PROTECTED]> wrote: > Yes it is, side effects are quite clearly not counted. The value > of (putStrLn "Hello" >> mzero") is mzero. I don't believe this represents a good understanding of IO actions as Haskell values. For instance, 'return ()'

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Keean Schupke
Just thinking about this, a monad is a Functor plus two natural-tranformations, Unit and Join. Is there an equivalent definition for MonadPlus... I am not sure I understand where MonadPlus comes from? Is it just a Functor and two different definitions of Unit and Join (from those chosen to be i

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Jules Bean
On 24 Jan 2005, at 09:36, Keean Schupke wrote: Ashley Yakeley wrote: I disagree. Clearly (putStrLn "Hello" >> mzero) is not the same as mzero. Yes it is, side effects are quite clearly not counted. The value of (putStrLn "Hello" >> mzero") is mzero. This makes no sense to me at all. putStrLn "He

Re: [Haskell-cafe] Re: what is inverse of mzero and return?

2005-01-24 Thread Keean Schupke
Ashley Yakeley wrote: I disagree. Clearly (putStrLn "Hello" >> mzero) is not the same as mzero. Yes it is, side effects are quite clearly not counted. The value of (putStrLn "Hello" >> mzero") is mzero. In reference to the idea of splitting MonadPlus, what category would you be operating in, if

Re: [Haskell-cafe] Re: File path programme

2005-01-24 Thread Keean Schupke
Marcin 'Qrczak' Kowalczyk wrote: These rules agree on "foo", "foo." and "foo.tar.gz", yet disagree on "foo.bar."; I don't know which is more natural. Filename extensions come from DOS 8.3 format. In these kind of names only one '.' is allowed. Unix does not have filename extensions, as '.' is ju