Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Martin Norbäck
tis 2002-05-14 klockan 06.37 skrev anatoli: Brian Huffman [EMAIL PROTECTED] wrote: Here is a printf-style function that I hacked up this morning; it uses type classes but it doesn't need functional dependencies: [snip] It's very nice and even extendable, though `class Printf String' is

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Sebastien Carlier
On Tuesday, May 14, 2002, at 06:37 AM, anatoli wrote: Brian Huffman [EMAIL PROTECTED] wrote: Here is a printf-style function that I hacked up this morning; it uses type classes but it doesn't need functional dependencies: [snip] It's very nice and even extendable, though `class Printf

State monads don't respect the monad laws in Haskell

2002-05-14 Thread Simon Marlow
An interesting revelation just occurred to Simon P.J. and myself while wondering about issues to do with exceptions in the IO monad (see discussion on [EMAIL PROTECTED] if you're interested). The question we were considering was whether the following should hold in the IO monad: (return

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread David Feuer
On Tue, May 14, 2002, Simon Marlow wrote: An interesting revelation just occurred to Simon P.J. and myself while wondering about issues to do with exceptions in the IO monad (see discussion on [EMAIL PROTECTED] if you're interested). The question we were considering was whether the

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Ross Paterson
On Tue, May 14, 2002 at 12:14:02PM +0100, Simon Marlow wrote: The question we were considering was whether the following should hold in the IO monad: (return () = \_ - undefined) `seq` 42 == undefined [as implied by the left-identity monad law] This discrepancy applies to any

Apparel Helmet Links - Super sales Savings

2002-05-14 Thread PlanetMoto.com
MILLIONS of dollars in brand name high quality motorcycle accessories featured on this month’s sites. Some products are being liquidated at unbelievable blowout prices! Most products are being sold for significant discounts off of retail pricing. In some cases prices have been slashed up to 70%

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread anatoli
Martin Norbäck [EMAIL PROTECTED] wrote: I agree that i18n needs positional arguments. What's wrong with simply doing like this: printf I have %. %. %..[trained, show 1, Jedi] printf %2. %3. %1. I have. [trained, show 1, Jedi] Nothing is exceptionally wrong with it, except it's not as

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Robert Ennals
Martin Norbäck [EMAIL PROTECTED] wrote: I agree that i18n needs positional arguments. What's wrong with simply doing like this: printf I have %. %. %..[trained, show 1, Jedi] printf %2. %3. %1. I have. [trained, show 1, Jedi] Nothing is exceptionally wrong with it, except it's

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread George Russell
Simon Marlow wrote [snip] So the IO monad in Haskell, at least as we understand it, doesn't satisfy the monad laws (or, depending on your point of view, seq breaks the monad laws). [snip] Cheers Simon. One of the awkward things about the Haskell events I implemented is that although I make

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Martin Norbäck
tis 2002-05-14 klockan 16.45 skrev Robert Ennals: Martin Norbäck [EMAIL PROTECTED] wrote: I agree that i18n needs positional arguments. What's wrong with simply doing like this: printf I have %. %. %..[trained, show 1, Jedi] printf %2. %3. %1. I have. [trained, show 1, Jedi]

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Dylan Thurston
On Tue, May 14, 2002 at 03:45:36PM +0100, Robert Ennals wrote: Just thought I would jump in and say that, unlike (it seems) everyone else, I hate printf in C. It is a horrible horrible inextensible hack of a function that I find extremely awkward to use. ... I personally much prefer the

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Dylan Thurston
On Tue, May 14, 2002 at 04:57:12PM +0200, George Russell wrote: According to the report Instances of Monad should satisfy the following laws: return a = k = k m = return= m m = (\x - k x = h) = (m = k) = h so neither IO nor my events satisfy this. Up to

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread anatoli
Robert Ennals [EMAIL PROTECTED] wrote: I personally much prefer the syntax currently used in Haskell, which is also essentially what is used in most other recent languages, including Java, C++, and (god help me) Perl. In the example given, I could write: I have ++ action ++ ++

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread George Russell
Dylan Thurston wrote: [snip] I've often been bothered by the inconsistent treatment of laws in the report; why are there laws for functors, monads, and quot/rem and div/mod, and not much else? I'm pleased to see that the laws that are given actually do have exceptions. [snip] Even the

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread Robert Ennals
Robert Ennals [EMAIL PROTECTED] wrote: I personally much prefer the syntax currently used in Haskell, which is also essentially what is used in most other recent languages, including Java, C++, and (god help me) Perl. In the example given, I could write: I have ++ action ++

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Jan-Willem Maessen
Dylan Thurston [EMAIL PROTECTED] writes: I don't think this is necessarily wise to drop this from the report altogether. To me, it seems comparable to associativity of addition for instances of Num; many instances don't satisfy it (e.g., Float), but it's a useful guideline to keep in mind.

Re: preprocessing printf/regex strings (like ocaml)

2002-05-14 Thread anatoli
Robert Ennals [EMAIL PROTECTED] wrote: Surely that problem only arises if one insists on encoding all the relevant information inside a string. This is pretty much the only option, because translators and programmers are different people. Translators can deal with simple text files with one

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread George Russell
S.M.Kahrs wrote: [snip] I don't think this really solves the problem with the left unit (not in general, and not for IO either), it merely pushes it to a different place. [snip] Not being a category theorist I find this all a bit confusing. Can you give an example where with GHC and the fix I

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread S.M.Kahrs
S.M.Kahrs wrote: [snip] I don't think this really solves the problem with the left unit (not in general, and not for IO either), it merely pushes it to a different place. [snip] Not being a category theorist I find this all a bit confusing. Nothing to do with category theory. I took

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Ken Shan
On 2002-05-14T12:32:30-0400, Jan-Willem Maessen wrote: And I'd really much rather we cleaned up the semantics of seq---or better yet, fixed the problems with lazy evaluation which make seq necessary in the first place. A general question: What is seq useful for, other than efficiency? --

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Hal Daume III
It's useful for: debug :: Show a = a - a debug x = unsafePerformIO (hPutStrLn stderr (show x)) `seq` x (Presumably trace is defined similarly) One may ask the question: what is seq useful for not in conjunction with unsafePerformIO, other than efficiency. That, I don't know the answer to. -

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Jorge Adriano
One may ask the question: what is seq useful for not in conjunction with unsafePerformIO, other than efficiency. That, I don't know the answer to. Here is an example. main::IO() main=do time1 - getCPUTime w - return $! calcSomething time2 - getCPUTime ... J.A.

How to get functional software engineering experience?

2002-05-14 Thread Jeffrey Palmer
Hello all, I've got a not-quite-so-technically-detailed question for everyone. For the past ten or so years, I've been building relatively large real-world software systems, and I've always been interested in finding new and innovative ways to reduce complexity and improve system

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Iavor S. Diatchki
hello, this is misleading. seq only evaluates to whnf, i.e. the outermost lazy constructor (or lambda) and that only if the seq ... expression is actually evaluated, which is often tricky to ensure. furthermore, for non-functions one can get the same behaviour, by using a case with a pattern.

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Hal Daume III
True, but using seq you can define deepSeq/rnf (depening on which camp you're from), which isn't misleading in this way. -- Hal Daume III Computer science is no more about computers| [EMAIL PROTECTED] than astronomy is about telescopes. -Dijkstra | www.isi.edu/~hdaume On Tue, 14 May

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Alastair Reid
Hal Daume [EMAIL PROTECTED] writes: [seq is] useful for: debug :: Show a = a - a debug x = unsafePerformIO (hPutStrLn stderr (show x)) `seq` x (Presumably trace is defined similarly) One may ask the question: what is seq useful for not in conjunction with unsafePerformIO, other than

Re: How to get functional software engineering experience?

2002-05-14 Thread Andrew J Bromage
G'day all. On Tue, May 14, 2002 at 04:47:13PM -0500, Jeffrey Palmer wrote: Are there any options for people like me, or does my functional experience remain limited to the hobby* work I can squeeze in at night and on weekends? Thoughts? The first thing you have to understand is that

(no subject)

2002-05-14 Thread LAURENT MPETI KABILA
REQUEST FOR URGENT BUSINESS ASSISTANCE -- I stumbled into your contact by stroke of luck after a long search for an honest and trust worthy person who could handle issue with high confidentiality. I was so dilghted when i got your contact and i decided to

Re: How to get functional software engineering experience?

2002-05-14 Thread John Hughes
However, it appears that the only place (short of Ericsson) I can actually work on a complex functional system is in academia. Unfortunately, this is not an option, as I have no Ph.D., and going back to school is probably not realistic. There are other companies using Erlang, if not on as

Re: State monads don't respect the monad laws in Haskell

2002-05-14 Thread Jay Cox
On Tue, 14 May 2002, Ken Shan wrote: On 2002-05-14T12:32:30-0400, Jan-Willem Maessen wrote: And I'd really much rather we cleaned up the semantics of seq---or better yet, fixed the problems with lazy evaluation which make seq necessary in the first place. A general question: What is

RE: stgSyn/CoreToStg.lhs:1112: Couldn't match `#' against `*'

2002-05-14 Thread Simon Peyton-Jones
Title: Message maybe you need to rebuild the compiler you are compiling *with*? -Original Message-From: Mike Thomas [mailto:[EMAIL PROTECTED]] Sent: 13 May 2002 22:19To: Simon Peyton-Jones; [EMAIL PROTECTED]Subject: Re: stgSyn/CoreToStg.lhs:1112: Couldn't match `#'

Re: stgSyn/CoreToStg.lhs:1112: Couldn't match `#' against `*'

2002-05-14 Thread Mike Thomas
MessageHi Simon. maybe you need to rebuild the compiler you are compiling *with*? That's exactly what I'm trying to do with the latest CVS Head, so I assume you mean to try switching back to the Glasgow team's 5.02 or 5.03 releases to build. As the compiler I am using was built with the GHC

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Ashley Yakeley
At 2002-05-14 02:24, Simon Marlow wrote: This is bizarre: the definition of evaluate in Exception is exactly the one you gave above, yet they behave differently. You may have uncovered a compiler bug, I'll look into it. I might ask which is correct: according to the rules for seq, evaluate'

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Simon Marlow
This is bizarre: the definition of evaluate in Exception is exactly the one you gave above, yet they behave differently. You may have uncovered a compiler bug, I'll look into it. I might ask which is correct: according to the rules for seq, evaluate' undefined should be bottom, but

RE: Prelude.catch vs. Exception.catch

2002-05-14 Thread Simon Marlow
At 2002-05-14 02:58, Simon Marlow wrote: I must admit I can't think of any compelling reasons for the change, other than the fact that this is functionality that we don't have at the moment, and therefore might be useful. Opinions? I need a function that does this: evaluate ::

Re: Replacing the Prelude

2002-05-14 Thread Dylan Thurston
On Sun, May 12, 2002 at 09:31:38PM -0700, Ashley Yakeley wrote: I have recently been experimenting writing code that replaces large chunks of the Prelude, compiling with -fno-implicit-prelude. I notice that I can happily redefine numeric literals simply by creating functions called

RE: Replacing the Prelude

2002-05-14 Thread Simon Peyton-Jones
Ashley writes | I was hoping to do something similar for 'do' notation by redefining | (), (=) etc., but unfortunately GHC is quite insistent | that 'do' notation quite specifically refers to GHC.Base.Monad Dylan replies | I'm surprised that ghc uses the fromInteger and fromRational |

Re: Replacing the Prelude

2002-05-14 Thread Dylan Thurston
On Sun, May 12, 2002 at 09:31:38PM -0700, Ashley Yakeley wrote: I have recently been experimenting writing code that replaces large chunks of the Prelude, compiling with -fno-implicit-prelude. I notice that I can happily redefine numeric literals simply by creating functions called

RE: Replacing the Prelude

2002-05-14 Thread Simon Peyton-Jones
Ashley writes | I was hoping to do something similar for 'do' notation by redefining | (), (=) etc., but unfortunately GHC is quite insistent | that 'do' notation quite specifically refers to GHC.Base.Monad Dylan replies | I'm surprised that ghc uses the fromInteger and fromRational |