Re: [Haskell-cafe] Re: not possible with monad transformers ?

2004-12-01 Thread Jules Bean
On 30 Nov 2004, at 23:29, Ben Rudiak-Gould wrote: Jules Bean wrote: However, your problem *does* have a natural underlying monad, if you care to use it. I may be confused, but I don't think it does. It seems like the OP wants a type like data Perhaps a = Success a | Failure [Error] [snip] I

Re: [Haskell-cafe] Re: not possible with monad transformers ?

2004-12-01 Thread Jules Bean
On 1 Dec 2004, at 00:37, Marcin 'Qrczak' Kowalczyk wrote: Ben Rudiak-Gould [EMAIL PROTECTED] writes: I may be confused, but I don't think it does. It seems like the OP wants a type like data Perhaps a = Success a | Failure [Error] When writing a compiler, it makes sense to collect errors as by

Re: [Haskell-cafe] Equality of functions

2004-12-01 Thread Keean Schupke
[EMAIL PROTECTED] wrote: That is too pessimistic, I'm afraid. There is also an intensional equality. Granted, it can be sound but never, in general, complete (although it can be total). That is, if the comparison function returns True, then the arguments truly denote the same, identically the same

Re: [Haskell-cafe] Re: not possible with monad transformers ?

2004-12-01 Thread Josef Svenningsson
On Tue, 30 Nov 2004 18:36:46 + (UTC), Pavel Zolnikov [EMAIL PROTECTED] wrote: [..] type M2 a = OuptutMonadT Maybe String a whenError:: M2 a - M2 a - M2 a 1 foo a b = do 2 output before 3 let r = liftM2 (+) a b 4 `whenError` $ reportError error 5 return r

Re: [Haskell-cafe] Re: not possible with monad transformers ?

2004-12-01 Thread Marcin 'Qrczak' Kowalczyk
Jules Bean [EMAIL PROTECTED] writes: When writing a compiler, it makes sense to collect errors as by the writer monad, and not abort anything - producing dummy values instead (except perhaps some fatal errors when it's inconvenient). Or you could use the monad: data Perhaps a = Success a |

Re: [Haskell-cafe] Re: ACIO versus Execution Contexts

2004-12-01 Thread Adrian Hey
On Tuesday 30 Nov 2004 3:02 pm, Lennart Augustsson wrote: I reiterate: not even device drivers written in C use TWIs. (Well, at least not quality drivers. :)) A finite pool of N devices is still a unique resource. Ultimately you have to contain the problem locally with a modular solution, or

Re: [Haskell-cafe] Re: ACIO versus Execution Contexts

2004-12-01 Thread Lennart Augustsson
Adrian Hey wrote: On Tuesday 30 Nov 2004 3:02 pm, Lennart Augustsson wrote: I reiterate: not even device drivers written in C use TWIs. (Well, at least not quality drivers. :)) A finite pool of N devices is still a unique resource. Ultimately you have to contain the problem locally with a

Re: [Haskell-cafe] ACIO versus Execution Contexts

2004-12-01 Thread Adrian Hey
On Tuesday 30 Nov 2004 4:01 pm, Simon Peyton-Jones wrote: (d) I'm not averse to changing GHC in some way, but big changes (e.g top level -) would need a jolly persuasive argument and solid consensus. Smaller changes (e.g. a robust promise about top-level newMVars) are easier of course. (e)

Re: [Haskell-cafe] Re: ACIO versus Execution Contexts

2004-12-01 Thread Adrian Hey
On Wednesday 01 Dec 2004 12:07 pm, Lennart Augustsson wrote: Adrian Hey wrote: It's not a language issue. It's a design issue. And in the case of device drivers you do want to pass the buck up to the layer that handles device drivers. Having each driver keep it's own global state is just

Re: [Haskell-cafe] Re: ACIO versus Execution Contexts

2004-12-01 Thread MR K P SCHUPKE
Actually I now think that not only are top level TWIs okay, I can get extra contexts by rewriting the MVar module. Here I can create a TWI in the new MVar module called context, and all mvar writes and reads would be parameterised by context. In this way I can change the context then call oneShot

[Haskell-cafe] Rank-2 types and class constraints

2004-12-01 Thread Stefan Holdermans
Hi, Just out of curiosity (I cannot come up with a practical example): Why doesn't the following piece of code type check in GHC (with extensions)? foo :: (forall a . (Eq a) = a) - Integer foo = undefined It seems like the type-class constraint is playing a decisive rĂ´le here, since the

Re: [Haskell-cafe] Rank-2 types and class constraints

2004-12-01 Thread Ralf Laemmel
Hi, foo _ = undefined works fine. Otherwise the poor little a has no chance to get disambiguated. ... Ambiguous type variable `a' in the top-level constraint ... Ralf Stefan Holdermans wrote: Hi, Just out of curiosity (I cannot come up with a practical example): Why doesn't the following piece

[Haskell-cafe] Forcing type conversion - probably FAQ(?)

2004-12-01 Thread Dusan Kolar
Hello, I'm trying to make work the following code (I'm using GHCi with flags -fglasgow-exts -fallow-undecidable-instances): infixl 6 :+, :- infixl 6 .+, .- data TMyExpr = TMyExpr :+ TMyExpr | TMyExpr :- TMyExpr | Val Int | Id String class MkExpr a b where (.+)

Re: [Haskell-cafe] Forcing type conversion - probably FAQ(?)

2004-12-01 Thread Henning Thielemann
On Wed, 1 Dec 2004, Dusan Kolar wrote: Hello, I'm trying to make work the following code (I'm using GHCi with flags -fglasgow-exts -fallow-undecidable-instances): infixl 6 :+, :- infixl 6 .+, .- data TMyExpr = TMyExpr :+ TMyExpr | TMyExpr :- TMyExpr |

[Haskell-cafe] Top-level state debate on the wiki

2004-12-01 Thread Ben Rudiak-Gould
I put up a wiki page summarizing the main proposals for top-level mutable state. The type-dictionary approach isn't there yet, but there's a space for it; I'll probably fill it in within the next 24 hours unless someone else feels like doing it first. Please add more detail, objections,

Re: [Haskell-cafe] Top-level state debate on the wiki

2004-12-01 Thread Adrian Hey
On Wednesday 01 Dec 2004 6:29 pm, Ben Rudiak-Gould wrote: I put up a wiki page summarizing the main proposals for top-level mutable state. The type-dictionary approach isn't there yet, but there's a space for it; I'll probably fill it in within the next 24 hours unless someone else feels like

[Haskell-cafe] Re: Non-technical Haskell question

2004-12-01 Thread John Goerzen
On 2004-11-30, GoldPython [EMAIL PROTECTED] wrote: Has anyone tried presenting the language to the average rank and file programming community? If so, was it successful? If not, is there interest in doing so? I am very interested in doing that. I'm a relatively recent Haskeller. I come from

Re: [Haskell-cafe] Top-level state debate on the wiki

2004-12-01 Thread Jules Bean
On 1 Dec 2004, at 18:29, Ben Rudiak-Gould wrote: Here's the page: http://haskell.org/hawiki/GlobalMutableState Nice summary. What I think is missing is an explanation of when you would want this feature (and when you wouldn't, more importantly). Here is the kind of platonic dialogue that

[Haskell-cafe] memory leak in Random.randoms or makeList?

2004-12-01 Thread S. Alexander Jacobson
Using ghci, I am getting this error message: *Main timeOp $ print $ sizeFM bigFM' GHC's heap exhausted: current limit is 268435456 bytes; From this code: makeList x = map ((\x-x `mod` range).abs) $ Random.randoms (Random.mkStdGen x)::[Int] range=10

Re: [Haskell-cafe] Re: Non-technical Haskell question

2004-12-01 Thread Benjamin Franksen
On Wednesday 01 December 2004 21:18, John Goerzen wrote: I also have a very small start on a haskell for hackers (hackers in the non-evil sense) sort of document. One this doesn't ignore I/O as hard or unimportant. I/O in Haskell doesn't suck. I come from a similar area (large control