Re: Export lists in modules

2006-03-03 Thread Benjamin Franksen
On Friday 03 March 2006 10:52, Malcolm Wallace wrote: Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: 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

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

2006-03-01 Thread Johannes Waldmann
Jim Apple wrote: class MyMap f a b where myMap :: (a - b) - f a - f b instance (Functor f) = MyMap f a b where myMap = fmap instance (Ord a, Ord b) = MyMap Data.Set.Set a b where myMap = Data.Set.map OK (I guess). But my point was that I want to use do notation for Sets (in

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

2006-03-01 Thread Jim Apple
On 3/1/06, Johannes Waldmann [EMAIL PROTECTED] wrote: But my point was that I want to use do notation for Sets (in fact, for any kind of collection) so I'd need the original Functor and Monad. I understand this for Monad. Why not just redefine Functor, Oleg-style? I couldn't use ghc's

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: 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: 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: 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: 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: Export lists in modules

2006-02-27 Thread John Meacham
On Fri, Feb 24, 2006 at 09:20:10AM +0100, Ketil Malde wrote: I don't think saving one line from each file in projects using alternative Preludes justify adding one line to each file in projects using the standard Prelude. If there is any reason to think custom Preludes will outnumber the

Re: Export lists in modules

2006-02-24 Thread Johannes Waldmann
John Meacham wrote: On Thu, Feb 23, 2006 at 10:58:36AM +, Malcolm Wallace wrote: Some data-structures people (e.g. Chris Okasaki) are of the opinion that lists tend to be over-used (because they are built-in), when other datatypes might be much more appropriate. While this may be true

Re: Export lists in modules

2006-02-24 Thread Ketil Malde
Malcolm Wallace [EMAIL PROTECTED] writes: One of the problems with the current mechanism for overriding Prelude definitions, is that every module that /uses/ such an entity must also explicitly hide the original Prelude: I guess I don't quite understand what you are trying to achieve. Case

Re: Export lists in modules

2006-02-24 Thread Ketil Malde
Benjamin Franksen [EMAIL PROTECTED] writes: If this means that you must import Data.List almost everywhere, this won't change anything - only add yet another import to every file. But you could import something different instead! Yes. You can do that as it is, of course (well, more or less,

RE: Export lists in modules

2006-02-24 Thread Simon Peyton-Jones
Of | Ben Rudiak-Gould | Sent: 23 February 2006 21:26 | To: haskell-prime@haskell.org | Subject: Re: Export lists in modules | | Malcolm Wallace wrote: | An explicit interface would be useful for many purposes besides | machine-checked documentation. For instance, it could be used to | eliminate

Re: Export lists in modules

2006-02-24 Thread John Meacham
On Fri, Feb 24, 2006 at 12:13:14PM -, Simon Peyton-Jones wrote: You could imagine a) compiling recursive groups all at once b) somehow magically filtering the source file to omit anything undefined, leaving only defined stuff. which ought to be enough to tie the knot. jhc does a,

RE: Export lists in modules

2006-02-23 Thread Simon Marlow
On 23 February 2006 01:48, John Meacham wrote: On Wed, Feb 22, 2006 at 05:11:26PM -, Simon Marlow wrote: Indeed, the distinction between data newtype should be a completely private property, so we certainly shouldn't distinguish those in exports/imports. It's less clear to me whether

RE: Export lists in modules

2006-02-23 Thread Simon Marlow
On 22 February 2006 17:27, Malcolm Wallace wrote: However, I would be equally happy to combine type/newtype/data into a single keyword for exports. for the record, I am in favour of tagging export specifiers with 'class' or 'type' (using 'type' for all type constructors, in light of yours and

Re: Export lists in modules

2006-02-23 Thread Malcolm Wallace
Ketil Malde [EMAIL PROTECTED] wrote: I would solve this problem by reducing the Prelude to just a core. List function could go, for example, (mostly) into Data.List. If this means that you must import Data.List almost everywhere, this won't change anything - only add yet another import

RE: Export lists in modules

2006-02-23 Thread Simon Marlow
On 23 February 2006 10:28, Jean-Philippe Bernardy wrote: I lost track of what is the issue being tackled here. What's broken with the current way of specifying exported entities? Imho it's the best system that I've seen (across all languages I know). A lot of language chose to separate

Re: Export lists in modules

2006-02-23 Thread Malcolm Wallace
Simon Marlow [EMAIL PROTECTED] wrote: However, I would be equally happy to combine type/newtype/data into a single keyword for exports. for the record, I am in favour of tagging export specifiers with 'class' or 'type' (using 'type' for all type constructors, in light of yours and

RE: Export lists in modules

2006-02-23 Thread Simon Marlow
On 23 February 2006 11:14, Malcolm Wallace wrote: Simon Marlow [EMAIL PROTECTED] wrote: However, I would be equally happy to combine type/newtype/data into a single keyword for exports. for the record, I am in favour of tagging export specifiers with 'class' or 'type' (using 'type' for

Re: Export lists in modules

2006-02-23 Thread Ketil Malde
Malcolm Wallace [EMAIL PROTECTED] writes: you would simply replace the implicit import Prelude with an explicit import Prelude.Standard (or use a build flag like -fimplicit-prelude, or +98). Why not keep it implicit? If you want the alternative behavior, you know where to get it (import

Re: minimal Prelude (was Re: Export lists in modules)

2006-02-23 Thread Tomasz Zielonka
On Wed, Feb 22, 2006 at 05:12:47PM +, Malcolm Wallace wrote: Everything else that is currently in the Haskell'98 Prelude is re-distributed across a variety of small modules. Where a syntactic desugaring rule currently uses an entity from the Prelude, the new interpretation is that it uses

Re: Export lists in modules

2006-02-23 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: The main difference is that I'm doing away with parentheses, commas, and export specifiers, and using layout and full declaration syntax instead. (I don't really want to discuss this very rough idea any more though, it's just a distraction, and I'm not

Re: Export lists in modules

2006-02-23 Thread Ben Rudiak-Gould
Malcolm Wallace wrote: An explicit interface would be useful for many purposes besides machine-checked documentation. For instance, it could be used to eliminate the hs-boot or hi-boot files used by some compilers when dealing with recursive modules. Why *does* ghc require hs-boot files? What

Re: Implicit Prelude (was Re: Export lists in modules)

2006-02-23 Thread Taral
On 2/23/06, Ben Rudiak-Gould [EMAIL PROTECTED] wrote: In fact, this suggests a compromise: how about implicitly importing the Prelude only if the module header is omitted? That way there'll be no impact on short (single-module) programs. +1 -- Taral [EMAIL PROTECTED] Computer science is no

Re: Export lists in modules

2006-02-23 Thread Bernard Pope
On Thu, 2006-02-23 at 21:04 +0100, Marcin 'Qrczak' Kowalczyk wrote: Simon Marlow [EMAIL PROTECTED] writes: The main difference is that I'm doing away with parentheses, commas, and export specifiers, and using layout and full declaration syntax instead. (I don't really want to discuss this

Re: Export lists in modules

2006-02-23 Thread Aaron Denney
On 2006-02-21, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Dienstag, 21. Februar 2006 04:41 schrieb John Meacham: on this note, I thought it would be nice to do a 'mostly unqualified' import. import Foo qualified(foo,bar) which will have the effect of import Foo hiding(foo,bar) import

Re: Export lists in modules

2006-02-22 Thread Malcolm Wallace
John Meacham [EMAIL PROTECTED] wrote: Malcolm Wallace wrote: There is also the issue that we might adopt the proposal to allow (and perhaps eventually, to require) type signatures on export lists. All I have to say is please, no to the requiring part that is. I don't seriously propose

Re: Export lists in modules

2006-02-22 Thread Johannes Waldmann
Malcolm Wallace wrote: ... but that if there are thus two signatures for an entity, they must be identical. This is to prevent the case where one modifies the definition of the function, making it more general, but forgets to modify the corresponding export. Sounds like the perfect example

Re: Export lists in modules

2006-02-22 Thread John Meacham
On Wed, Feb 22, 2006 at 12:07:44PM +, Malcolm Wallace wrote: At the moment, only one type signature is permitted per entity (except for FFI foreign exports, where the exported signature may be more specific than the definitional signature). My proposal is that the normal export list can

Re: Export lists in modules

2006-02-22 Thread Malcolm Wallace
Johannes Waldmann [EMAIL PROTECTED] wrote: Sounds like the perfect example to illustrate the point that information shouldn't be doubled in the first place. Yes, I suppose one could argue that. Can you say why you want the type in the export list? As a compact description of the module

Re: Export lists in modules

2006-02-22 Thread Malcolm Wallace
Simon Peyton-Jones [EMAIL PROTECTED] wrote: | I don't seriously propose for haskell-prime that signatures should | be required on exports. Just permitting them would be a large and | useful step up already. If this is to be a serious proposal, someone had better think what to do about

Re: Export lists in modules

2006-02-22 Thread Wolfgang Jeltsch
Am Dienstag, 21. Februar 2006 21:59 schrieb Ketil Malde: Wolfgang Jeltsch [EMAIL PROTECTED] writes: On the other hand, sometimes it makes sense to have a mostly qualified import. For example, if you import Data.Set or Data.Map you might want only the type constructors to be imported

Re: Export lists in modules

2006-02-22 Thread Johannes Waldmann
Malcolm Wallace wrote: An explicit interface would be useful for many purposes besides machine-checked documentation. I don't see why you need the signature in two places (at the point at declaration and in the export list) for that. Do you want the compiler to check conformance (of the

Re: Export lists in modules

2006-02-22 Thread Georg Martius
On Wednesday 22 February 2006 15:53, Malcolm Wallace wrote: Simon Peyton-Jones [EMAIL PROTECTED] wrote: | I don't seriously propose for haskell-prime that signatures should | be required on exports. Just permitting them would be a large and | useful step up already. If this is to be a

Re: Export lists in modules

2006-02-22 Thread Henrik Nilsson
Dear all, Malcolm wrote: As far as I can see, there is very little to change. Here is a concrete proposal. [...] Anyone see any difficulties? Georg asked: No, but one question: If the type signature is given in the export lists, is it then necessary (or even allowed) later on? I would

RE: Export lists in modules

2006-02-22 Thread Simon Marlow
On 22 February 2006 14:54, Malcolm Wallace wrote: Simon Peyton-Jones [EMAIL PROTECTED] wrote: I don't seriously propose for haskell-prime that signatures should be required on exports. Just permitting them would be a large and useful step up already. If this is to be a serious proposal,

Re: Export lists in modules

2006-02-21 Thread Malcolm Wallace
Jared Updike [EMAIL PROTECTED] wrote: I am not sure if this has been mentioned before, but something I would really find useful is the ability to tell Haskell to export everything in a function except for some named functions. No one has responded so ... I believe some people (perhaps

Re: Export lists in modules

2006-02-21 Thread Cale Gibbard
On 21/02/06, Malcolm Wallace [EMAIL PROTECTED] wrote: There is also the issue that we might adopt the proposal to allow (and perhaps eventually, to require) type signatures on export lists. If so, then it would be kind of ridiculous to have interface signatures only for the things you are

Re: Export lists in modules

2006-02-21 Thread Georg Martius
On Tuesday 21 February 2006 11:40, Malcolm Wallace wrote: Jared Updike [EMAIL PROTECTED] wrote: I am not sure if this has been mentioned before, but something I would really find useful is the ability to tell Haskell to export everything in a function except for some named functions.

Re: Export lists in modules

2006-02-20 Thread Jared Updike
I am not sure if this has been mentioned before, but something I would really find useful is the ability to tell Haskell to export everything in a function except for some named functions. No one has responded so I thought I would make a suggestion about what the syntax might look like to do

Re: Export lists in modules

2006-02-20 Thread Christopher Brown
Jared, How about combining the two (since 'hiding' is already a reserved word): module Module hiding ( list, of, things, not, to, export ) where Everything gets exported except what you explicitly hide. Is this general enough? Are there reasons why this might not work? And does

Re: Export lists in modules

2006-02-20 Thread John Meacham
on this note, I thought it would be nice to do a 'mostly unqualified' import. import Foo qualified(foo,bar) which will have the effect of import Foo hiding(foo,bar) import qualified Foo(foo,bar) since usually you can import a whole module unqualified except for a few troublemakers.