Re: Monomorphism restriction

2006-10-14 Thread Iavor Diatchki
Hello, On 10/14/06, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello haskell-prime, first is the monomorphism restriction. why isn't it possible to check _kind_ of parameter-less equation and apply monomorphism restrictions only to values of kind '*'? so, this: sum = foldr1 (*) will become

Re: Monomorphism restriction - is this still needed for efficiency?

2006-06-12 Thread Simon Marlow
Brian Hulley wrote: I'm wondering if the monomorphism restriction is now just an anachronism from Haskell 98 or if it is still needed for efficiency ie should I just now use -fno-monomorphism-restriction when compiling all my code to consign it to the dustbin of history? :-) A related

Re: Monomorphism restriction - is this still needed for efficiency?

2006-06-12 Thread Brian Hulley
Simon Marlow wrote: Brian Hulley wrote: I'm wondering if the monomorphism restriction is now just an anachronism from Haskell 98 or if it is still needed for efficiency ie should I just now use -fno-monomorphism-restriction when compiling all my code to consign it to the dustbin of history?

RE: monomorphism/hugs98/ghc-5.02.3

2002-06-03 Thread Simon Marlow
However, in ghc-5.02.3 for Haskell 98 (without glasgow extensions) it seems that is not the case. I _guessed_ that I need to use the flag -fno-monomorphism-restriction but I don't know whether I've failed to turn it on or if the problem is to be found somewhere else. A related problem

Re: monomorphism/hugs98/ghc-5.02.3

2002-05-31 Thread Matt Fairtlough
Thanks a lot for the solution! And of course the ghci behaviour is much more sensible than the hugs one. And for pointing me to the mail archive. It encourages me to submit my next problem: stack overflow with simple Show instances...more later I wonder if there is a list of Hugs to GHCI

Re: monomorphism/hugs98/ghc-5.02.3

2002-05-31 Thread Alastair Reid
It encourages me to submit my next problem: stack overflow with simple Show instances...more later Let me guess that this involves a data declaration of the form: data Foo = ... | Foo op ... | ... That is an infix data constructor whose first argument is a recursive reference to the

Re: monomorphism/hugs98/ghc-5.02.3

2002-05-31 Thread Matt Fairtlough
Hmm. It might be related but I somehow doubt it. The buggy program is -- module Bug2 where data Bug2 = Bug2 instance Show Bug2 where showsPrec _ Bug2 str = showChar '?' str -- (stack overflow on Bug2 Bug2) and

Re: monomorphism/hugs98/ghc-5.02.3

2002-05-31 Thread Sigbjorn Finne
() and static.c:showsPrecRhs() in the current Hugs98 sources for details of the tweaks made. --sigbjorn - Original Message - From: Alastair Reid [EMAIL PROTECTED] To: Matt Fairtlough [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, May 31, 2002 09:38 Subject: Re

Re: monomorphism/hugs98/ghc-5.02.3

2002-05-30 Thread Jay Cox
--- Matt Fairtlough [EMAIL PROTECTED] wrote: instance (Eq a, Testit a) = Super (Test a) where sup1 (Test{f1=x, f2=y}) = Just Test{f1=x, f2=y} where y' = top y x' = top x top :: [a] - a top (s:st) = s is it possible to compile this program in ghc-5.02.3? Maybe

Re: Monomorphism, monomorphism...

2001-10-24 Thread Hannah Schroeter
Hello! On Mon, Oct 08, 2001 at 07:38:09PM +, Marcin 'Qrczak' Kowalczyk wrote: Mon, 8 Oct 2001 11:35:48 +0200, Hannah Schroeter [EMAIL PROTECTED] pisze: Now, with the typical dictionary implementation of type classes, this wouldn't really be too difficult. Dictionaries would have to

Re: Monomorphism, monomorphism...

2001-10-24 Thread Lennart Augustsson
Hannah Schroeter wrote: I don't think so. Why not create a dictionary record while compiling the associated instance (which may, by the H'98 definition, occur only once in the program)? One problem is that certain Haskell programs need an unbounded number of instances. -- Lennart

Re: Monomorphism, monomorphism...

2001-10-24 Thread Marcin 'Qrczak' Kowalczyk
Wed, 24 Oct 2001 10:36:22 +0200, Hannah Schroeter [EMAIL PROTECTED] pisze: Why not create a dictionary record while compiling the associated instance (which may, by the H'98 definition, occur only once in the program)? Instances with contexts are commonly represented as functions which make

Re: Monomorphism, monomorphism...

2001-10-10 Thread Marcin 'Qrczak' Kowalczyk
09 Oct 2001 13:55:04 -0700, Carl R. Witty [EMAIL PROTECTED] pisze: The TREX paper from Mark Jones and Benedict Gaster (I hope I have the names right) had both extensible records and extensible variants (extensible variants being what you would need to implement downcasts), I don't think so.

Re: Monomorphism, monomorphism...

2001-10-10 Thread Carl R. Witty
Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: 09 Oct 2001 13:55:04 -0700, Carl R. Witty [EMAIL PROTECTED] pisze: The TREX paper from Mark Jones and Benedict Gaster (I hope I have the names right) had both extensible records and extensible variants (extensible variants being what

Re: Monomorphism, monomorphism...

2001-10-10 Thread Ashley Yakeley
At 2001-10-10 03:59, Marcin 'Qrczak' Kowalczyk wrote: We need some type T such that it's possible to define a family of functions for arbitrary choices of A: upA :: A - T downA :: T - Maybe A satisfying downA (upA a) = Just a. We want to choose the type for T before deciding the exact

Re: Extensible downcasts impossible in Haskell? (was Re: Monomorphism, monomorphism...)

2001-10-09 Thread Marcin 'Qrczak' Kowalczyk
Tue, 9 Oct 2001 10:50:19 +1300, Tom Pledger [EMAIL PROTECTED] pisze: I'm curious about this impossibility. - Is it well known? If so, would someone please refer me to a paper or posting which explains it? I don't know. I'm not even sure if some clever encoding couldn't express it,

Re: Monomorphism, monomorphism...

2001-10-09 Thread Carl R. Witty
Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: Since OO languages often use subtypes to emulate constructors of algebraic types, they need downcasts. In Haskell it's perhaps less needed but it's a pity that it's impossible to translate an OO scheme which makes use of downcasts into

Re: Monomorphism, monomorphism...

2001-10-08 Thread Hannah Schroeter
Hello! On Sun, Oct 07, 2001 at 11:29:09AM +, Marcin 'Qrczak' Kowalczyk wrote: [...] Shouldn't the compiler be able to limit the recomputations to one per instance of the class? It would require very unusual implementation. Currently the compiler doesn't need to build

Re: Monomorphism, monomorphism...

2001-10-08 Thread Marcin 'Qrczak' Kowalczyk
Mon, 8 Oct 2001 11:35:48 +0200, Hannah Schroeter [EMAIL PROTECTED] pisze: Now, with the typical dictionary implementation of type classes, this wouldn't really be too difficult. Dictionaries would have to be make hashable and comparable. For a sane semantics you can't compare their

Extensible downcasts impossible in Haskell? (was Re: Monomorphism, monomorphism...)

2001-10-08 Thread Tom Pledger
Marcin 'Qrczak' Kowalczyk writes: : | Since OO languages often use subtypes to emulate constructors of | algebraic types, they need downcasts. In Haskell it's perhaps less | needed but it's a pity that it's impossible to translate an OO | scheme which makes use of downcasts into Haskell in

Re: Monomorphism, monomorphism...

2001-10-07 Thread Marcin 'Qrczak' Kowalczyk
Sat, 6 Oct 2001 22:22:24 -0700, Juan Carlos Arévalo Baeza [EMAIL PROTECTED] pisze: A pattern which is something other than an identifier. Like defining a function, as opposed to defining a constant? No: a pattern, e.g. (x,y), Just y, (x:_) etc. A function definition looks like an

Re: Monomorphism, monomorphism...

2001-10-06 Thread Marcin 'Qrczak' Kowalczyk
Fri, 5 Oct 2001 19:02:50 -0700, Juan Carlos Arévalo Baeza [EMAIL PROTECTED] pisze: If a declaration group Meaning something like let g = isNil up there? Yes, a group of mutually recursive bindings or a single non-recursive binding (equations inside let or where or at module toplevel).

Re: Monomorphism, monomorphism...

2001-10-06 Thread Karl-Filip Faxen
Hi! Marcin wrote: Juan Carlos Arévalo Baeza wrote: Karl-Filip wrote: - a - Bool (without quantification and with IsNil a among the predicates). This is something I didn't understand either. Which predicates? I think isNil a goes to the context of the whole expression containing the

Re: Monomorphism, monomorphism...

2001-10-06 Thread Juan Carlos Arévalo Baeza
On 6 Oct 2001 09:31:54 GMT, Marcin 'Qrczak' Kowalczyk wrote: First of all, thanks a lot for the detailed response. Yes, ... yes ... yes Well, I'm glad I got some of it right. Gives me hope :) contains a pattern binding with a nonvariable pattern   Meaning... what exactly? A pattern

re: Monomorphism Restriction

2001-06-10 Thread Bernard James POPE
Ashley Yakeley, Seattle WA, writes: Is there a point to the monomorphism restriction in GHC and Hugs? In practice, all it seems to mean is occasionally require unnecessary explicit type signatures. I think the point is made clearly enough in section 4.5.5 of the Haskell 98 language report,

Re: monomorphism ...

1999-02-26 Thread Jerzy Karczmarczuk
John Hughes : Everybody agrees the monomorphism restriction is a pain: ... So, let's make it visible, in the simplest possible way. Let there be TWO forms of binding: x = e, and x := e (say). A binding of the form `x = e' is interpreted using call-by-name, and may of course be overloaded:

Re: Monomorphism

1999-02-25 Thread Fergus Henderson
On 24-Feb-1999, John C. Peterson [EMAIL PROTECTED] wrote: You can't nuke monomorphism without addressing the ambiguity problem. If you've got the time, would you mind giving an example of the kind of ambiguity you're talking about? I think I know roughly the kind of problem you're talking

Re: monomorphism etc.

1998-11-13 Thread Fergus Henderson
On 12-Nov-1998, Lennart Augustsson [EMAIL PROTECTED] wrote: [...] if you dislike tuples you can use nested pairs At the cost of losing a little type-safety. -- Fergus Henderson [EMAIL PROTECTED] | "Binaries may die WWW: http://www.cs.mu.oz.au/~fjh | but source code lives forever" PGP:

Re: monomorphism etc.

1998-11-12 Thread Lennart Augustsson
I think it would be really nice if it were possible to create a container capable of containing any number of objects of any number of types It would That's not possible in Haskell. Since you want an any number of different types in this new type it would need to have a variable number

Re: monomorphism etc.

1998-11-12 Thread Lennart Augustsson
[...] if you dislike tuples you can use nested pairs At the cost of losing a little type-safety. That's really a very minimal loss. (And it's not really a loss of type safety, just the possibilty of confusing a part of a "tuple" with another "tuple"). I'd be more worried about the

nested pairs (was Re: monomorphism etc.)

1998-11-12 Thread Claus Reinke
But if you dislike tuples you can use nested pairs, like infixr 0 :. data T a b = a :. b Now you can write 'a' :. True :. "Hello" :. () which has type T Char (T Bool (T String ())) But I guess that's not what you were after? -- Lennart Fergus replied: [...] if you dislike

Re: nested pairs (was Re: monomorphism etc.)

1998-11-12 Thread Claus Reinke
PS. I've got a length function for ``heterogeneous lists'', as they appear in nested pairs, in Hugs. However, it uses the type system extensions available in 1.3c or in 1.4 [98 BETA]. How much can you do in plain Haskell??? in Cayenne?-) oops. On second thought, this length

RE: monomorphism wierdness

1998-11-11 Thread Simon Peyton-Jones
I allege that this is a Hugs bug! Yes, delayTrans is monomorphic, so it can only be used at one type. And indeed, it *is* used at one type, namely Bool. We use the defaults when the situation is ambiguous; here it isn't. Perhaps I should add a clarifying para to the report? Simon

Re: Monomorphism

1998-07-21 Thread Simon L Peyton Jones
Olaf suggests Hence I suggest that part (b) of rule 1 of the MR should be deleted, i.e. simple pattern bindings are just treated as function bindings. As I have said in a previous email, the recomputation issue could be handled by warnings from the compiler. That would indeed not fall

RE: Monomorphism

1998-07-21 Thread michael
[EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Monomorphism To: Olaf Chitil [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Monomorphism From: Simon L Peyton Jones [EMAIL PROTECTED] Olaf suggests Hence I suggest that part (b) of rule 1 of the MR should

Re: Monomorphism

1998-07-21 Thread Simon L Peyton Jones
I'm going to ask a very stupid question. Why on earth is len computed twice in this example? I really don't understand this! I have to confess that I mischievously hoped that someone would say this: it demonstates the point nicely that lifting the monomorphism restriction would cause

Re: Monomorphism

1998-07-21 Thread Ralf Hinze
One of the original motivations for questioning the DMR steems from the fact that function definitions expressed as simple pattern bindings are sometimes rejected. The definition sum as = foldr (+) 0 as is accepted but sum = foldr (+) 0 is not which is admittingly irritating.

RE: Monomorphism

1998-07-21 Thread Jon . Fairbairn
On 21 Jul, [EMAIL PROTECTED] wrote: I'm going to ask a very stupid question. not stupid, actually quite subtle! Why on earth is len computed twice in this example? I really don't understand this! I think the confusion arises from the use of the terms poly- and mono- morphism to refer

Re: Monomorphism

1998-07-20 Thread Olaf Chitil
Simon L Peyton Jones wrote: What worries me is that a programmer might write this: read2 :: (Read a, Read b) = String - (a,b) read2 2 = let [(r1,s1)] = read s [(r2,s2)] = read s1 in (r1,r2) The examples of John

Re: Monomorphism

1998-07-16 Thread Simon L Peyton Jones
read :: Read a = String - a read s = let [(r,s')] = reads s in r This *won't compile* if you don't treat the let binding definition monomorphicly. Without monomorphism, the types of r and s' are r :: Read a = a s' :: Read a = String This leads to an ambiguity error for s'.

Re: Monomorphism

1998-07-15 Thread Jeffrey R. Lewis
John C. Peterson wrote: While some may argue that avoiding re-evaluation is the justification for the monomorphism restriction, the real issue is ambiguity. Without some form of monomorphism (or scoped type variables?? Someone needs to convince me that scoped type variables fix everything

Re: Monomorphism

1998-07-15 Thread Alex Ferguson
John Peterson defends the DMR: read :: Read a = String - a read s = let [(r,s')] = reads s in r This *won't compile* if you don't treat the let binding definition monomorphicly. Without monomorphism, the types of r and s' are r :: Read a = a s' :: Read a = String This leads to an