Re: Export lists in modules

2006-02-28 Thread Malcolm Wallace
Johannes Waldmann [EMAIL PROTECTED] wrote: For reference, in Java, ... there's nice syntactic sugar for looping over collections: CollectionE c; for (E item : c) { ... } I'd say this is an example of moving away from a left-biased representation, or at least freeing the programmer from

Re[2]: overlapping instances and constraints

2006-02-28 Thread Bulat Ziganshin
Hello John, Tuesday, February 28, 2006, 4:23:24 AM, you wrote: i had plans to propose the same and even more: instance C2 a b | a/=b JM I was thinking it would be all kinds of useful if we had two predefined JM classes JM class Eq a b JM class NEq a b JM where Eq has instances exactly

Re: overlapping instances and constraints

2006-02-28 Thread Claus Reinke
instance C2 a b | a/=b I was thinking it would be all kinds of useful if we had two predefined classes class Eq a b class NEq a b where Eq has instances exactly when its two types are equal and NEq has instances exactly when its two types are not equal. class Eq a b instance Eq a a

Re: Export lists in modules

2006-02-28 Thread Johannes Waldmann
Malcolm Wallace wrote: Johannes Waldmann [EMAIL PROTECTED] wrote: For reference, in Java, ... there's nice syntactic sugar for looping over collections: CollectionE c; for (E item : c) { ... } In Haskell, this is called 'fmap'. :-) OK, then show me an instance Functor Set so that I can

Re: Export lists in modules

2006-02-28 Thread Johannes Waldmann
Cale Gibbard wrote: important point is that the elements and structure of the collection are being constructed one at a time as you iterate over it, and they are easily garbage collected as soon as you're done with them. OK, I kind of buy that argument. Though the very word deforestation

Re: Export lists in modules

2006-02-28 Thread Malcolm Wallace
Johannes Waldmann [EMAIL PROTECTED] wrote: In Haskell, this is called 'fmap'. :-) OK, then show me an instance Functor Set so that I can use it :-) instance Function Set where fmap = Data.Set.mapMonotonic Ok, so this introduces a precondition on the function being mapped, so there is

instance Functor Set, was: Re: Export lists in modules

2006-02-28 Thread Johannes Waldmann
Malcolm Wallace wrote: But if contexts-on-datatypes worked correctly, data Set a = Ord a = then even the real map from Data.Set: map :: (Ord a, Ord b) = (a - b) - Set a - Set b could be an instance method of Functor. I'd love that. But I don't quite understand: do you

Re: realToFrac issues

2006-02-28 Thread Lennart Augustsson
Cale Gibbard wrote: This change means that Rational is no longer a field. It makes me feel uneasy at least. Should we really expect realToFrac to propagate those values? Look at its type: realToFrac :: (Real a, Fractional b) = a - b Nothing about the Fractional class would seem to indicate

Re: instance Functor Set, was: Re: Export lists in modules

2006-02-28 Thread Malcolm Wallace
But if contexts-on-datatypes worked correctly, data Set a = Ord a = then even the real map from Data.Set: map :: (Ord a, Ord b) = (a - b) - Set a - Set b could be an instance method of Functor. I'd love that. But I don't quite understand: do you think this

Re[2]: overlapping instances and constraints

2006-02-28 Thread Bulat Ziganshin
Hello Claus, Tuesday, February 28, 2006, 1:54:25 PM, you wrote: CR class NEq a b CR instance Fail a = NEq a a CR instance NEq a b i think that this definition just use ad-hoc overlapping instances resolution mechanism that we want to avoid :))) -- Best regards, Bulat

RE: Export lists in modules

2006-02-28 Thread Simon Marlow
On 28 February 2006 13:37, Lennart Augustsson wrote: John Meacham wrote: I mean, even a for loop in haskell is done as mapM action [0..10] I'd say _most_ uses of lists are deforested away because they are used to express control and dataflow and arn't actually used as persistant

Re: [Haskell'-private] pragmas and annotations (RE: the record system)

2006-02-28 Thread Malcolm Wallace
Simon Marlow [EMAIL PROTECTED] wrote: How does ENCODING work for a UTF-16 file, for example? We don't know the file is UTF-16 until we read the ENCODING pragma, and we can't read the ENCODING pragma because it's in UTF-16. Use the same type of heuristic as XML uses (for instance). * If

Re: [Haskell'-private] pragmas and annotations (RE: the record system)

2006-02-28 Thread kahl
Malcolm.Wallace wrote: (But then, how would you guarantee that the first three characters in the file must be {-# ?) In particular, what do you propose for literate source? (I hardly have any .hs files.) As far as I can see, it seems to be possible to get LaTeX to work with UTF8; the

Re: realToFrac issues

2006-02-28 Thread Cale Gibbard
On 28/02/06, John Meacham [EMAIL PROTECTED] wrote: On Tue, Feb 28, 2006 at 12:44:04AM -0500, Cale Gibbard wrote: I'm almost scared to ask: does this mean we need negative zero as well? good point. probably. This change means that Rational is no longer a field. It makes me feel uneasy at

Re: the MPTC Dilemma (please solve)

2006-02-28 Thread Claus Reinke
You addressed this to me -- but I'm an advocate for rather conservative extensions whereas you are calling for extensions that go beyond what any current implementation can do. generally, that may be true,-) but in this specific case, I was just asking for an effort to document the differences

Re: instance Functor Set, was: Re: Export lists in modules

2006-02-28 Thread Jim Apple
On 2/28/06, Johannes Waldmann [EMAIL PROTECTED] wrote: Malcolm Wallace wrote: But if contexts-on-datatypes worked correctly, data Set a = Ord a = then even the real map from Data.Set: map :: (Ord a, Ord b) = (a - b) - Set a - Set b could be an instance method of

Re: overlapping instances and constraints

2006-02-28 Thread Niklas Broberg
On 2/28/06, Ben Rudiak-Gould [EMAIL PROTECTED] wrote: Simon Peyton-Jones wrote: - A program that type checks can have its meaning changed by adding an instance declaration - Similarly adding import M() can change the meaning of a program (by changing which instances are visible -

Re: overlapping instances and constraints

2006-02-28 Thread Niklas Broberg
Claus Reinke wrote: most of us would be happy if instance contexts would be required to uniquely determine the instance to be chosen, a rather conservative extension of current practice. I'm not so sure about the most of us, as you note yourself the defaulting pattern is quite popular (and