[Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread TJ
Hi again, Following up on my previous thread, I have figured out why it bothered me that we cannot have a list such as the following: [abc, 123, (1, 2)] :: Show a = [a] It seems to me that there is an annoying duality in treating simple algebraic data type vs type classes. As it stands, I can

Re: [Haskell-cafe] Beginners problem with the type system

2007-10-23 Thread Henrik Tramberend
On 22. Oct 2007, at 20:16 , Stefan O'Rear wrote: This type signature means that 'port' is return type overloaded - it can return ANY kind of port, and the caller gets to choose. Which I don't think is what you want. True. (Requires type family extension in GHC 6.8; an equivalent

[Haskell-cafe] Re: Hiding side effects in a data structure

2007-10-23 Thread Jon Fairbairn
Brandon S. Allbery KF8NH [EMAIL PROTECTED] writes: On Oct 21, 2007, at 6:29 , Jon Fairbairn wrote: No, they (or at least links to them) typically are that bad! Mind you, as far as fragment identification is concerned, so are a lot of html pages. But even if the links do have fragment ids,

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread TJ
On 10/23/07, Luke Palmer [EMAIL PROTECTED] wrote: On 10/23/07, TJ [EMAIL PROTECTED] wrote: What I find strange is, if we can have functions with hidden parameters, why can't we have the same for, say, elements of a list? Suppose that I have a list of type Show a = [a], I imagine that it

[Haskell-cafe] Re: Tutorial: Curry-Howard Correspondence

2007-10-23 Thread Jon Fairbairn
Derek Elkins [EMAIL PROTECTED] writes: On Mon, 2007-10-22 at 01:12 +0100, Lennart Augustsson wrote: There's nothing wrong with Haskell types. It's the terms that make Haskell types an inconsistent logic. Logics are what are consistent or not, so saying the logic Haskell's type system

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread Luke Palmer
On 10/23/07, TJ [EMAIL PROTECTED] wrote: What I find strange is, if we can have functions with hidden parameters, why can't we have the same for, say, elements of a list? Suppose that I have a list of type Show a = [a], I imagine that it would not be particularly difficult to have GHC insert

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread Jules Bean
Short answer: You are worrying about syntax. The things you want are possible. TJ wrote: Following up on my previous thread, I have figured out why it bothered me that we cannot have a list such as the following: [abc, 123, (1, 2)] :: Show a = [a] That type doesn't mean what you want it to

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread TJ
On 10/23/07, Jules Bean [EMAIL PROTECTED] wrote: Short answer: You are worrying about syntax. The things you want are possible. TJ wrote: Following up on my previous thread, I have figured out why it bothered me that we cannot have a list such as the following: [abc, 123, (1, 2)] :: Show

[Haskell-cafe] Learning hierarchy

2007-10-23 Thread Lutz Donnerhacke
Hi, in order to upload my teaching programms to hackage, I look for an accepted hierarchy to put the modules into. My current version is Learning.Donnerhacke.Algorithms.Sort ... etc. pp. Would such a hierarchy make sense? Is the a hope for inclusion of other modules? The main purpose of this

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a million element list)

2007-10-23 Thread Ketil Malde
[EMAIL PROTECTED] writes: 1. Avoid two pass filtering. 2. Avoid unecessary (++), with an accumulator. For example: Also, I find that 3. Accumulate equal elements, too pa (y:ys) s e b = case compare x y of ... to be a good choice. Otherwise, quicksort easily grows towards quadratic if

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a million element list)

2007-10-23 Thread Bertram Felgenhauer
Bernie Pope wrote: On 23/10/2007, at 8:09 AM, Thomas Hartman wrote: (Prelude sort, which I think is mergesort, just blew the stack.) GHC uses a bottom up merge sort these days. It starts off by creating a list of singletons, then it repeatedly merges adjacent pairs of lists until there

Re: [Haskell-cafe] Learning hierarchy

2007-10-23 Thread Lutz Donnerhacke
* Lutz Donnerhacke wrote: The main purpose of this moduls in my special case are: Implementation of the algorithms from Sedgewick's famous book. ... Sorry, I hit the send button a bit too early. ... They are used with very small main programms containing a FFI inclusion of a external C object

Re: [Haskell-cafe] will the real quicksort please stand up? (or: sorting a million element list)

2007-10-23 Thread Claus Reinke
It has been noted in a few places that the 2 line quicksort demo in the Introduction section of the haskell wiki http://www.haskell.org/haskellwiki/Introduction isn't a real quicksort, and wouldn't scale well with longer lists. Interested, and wanting to put my recently learned test data

Uniqueness of principle type? (was Re: [Haskell-cafe] Type vs TypeClass duality)

2007-10-23 Thread Jules Bean
TJ wrote: No. I am saying that Haskell's type system forces me to write boilerplate. Fair enough. Why can't it automatically construct them then? Assuming we do have a syntax for A list of objects, each of which is of some possibly different type 'a', subject only to the restriction that a

Re: [Haskell-cafe] XML parser recommendation?

2007-10-23 Thread Malcolm Wallace
Yitzchak Gale [EMAIL PROTECTED] wrote: Henning Thielemann wrote: HXT uses Parsec, which is strict. Is is strict to the extent that it cannot produce any output at all until it has read the entire XML document? That would make HXT (and Parsec, for that matter) useless for a large

[Haskell-cafe] Re: Using Haddock to document ADTs

2007-10-23 Thread Simon Marlow
Alfonso Acosta wrote: I'm beginning to get familiar with Haddock and I want to document a library which, as usually happens, has some ADT definitions. I'd like to document the ADTs both for the end-user (who shouldn't be told about its internal implementation) and future developers. Haddock

Re: [Haskell-cafe] XML parser recommendation?

2007-10-23 Thread Yitzchak Gale
Malcolm Wallace wrote: HaXml now uses the polyparse library, and you can choose whether you want well-formedness checking with the original strict parser, or lazy space-efficient on-demand parsing. Initial performance results show that parsing XML lazily is always better than 2x as fast, and

[Haskell-cafe] Re: OS Abstraction module??

2007-10-23 Thread Simon Marlow
Galchin Vasili wrote: I am really talking about a module or perhaps a Haskell class that provides notion for multiple threads of execution, semaphores, .. that hides POSIX vs Win32 APIs .. I wonder if this discussion is missing the point: if you only want to do threads, then Haskell (or

Re: Uniqueness of principle type? (was Re: [Haskell-cafe] Type vs TypeClass duality)

2007-10-23 Thread TJ
On 10/23/07, Jules Bean [EMAIL PROTECTED] wrote: I believe it is to do with the requirement that expressions have a unique principle type. Certainly in principle the algorithm you outline is possible, but I don't know what else you would lose. I'm not familiar with the term principal type. I

[Haskell-cafe] ANNOUNCE: dataenc 0.9

2007-10-23 Thread Magnus Therning
My collection of data encoding functions are now available at http://hackage.haskell.org/cgi-bin/hackage-scripts/package/dataenc-0.9: Dependencies base License LGPL Copyright Magnus Therning, 2007 AuthorMagnus Therning Maintainer

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-23 Thread Isaac Dupree
Brent Yorgey wrote: The point is, what you'd *like* (say) extendSequence [1,2,5,14,42] to do is return the *infinite* list of Catalan numbers, but that's very, very difficult to do in general! Actually impossible, since OEIS contains Busy Beaver sequences, which are not computable! (although

Re: [Haskell-cafe] Re: Using Haddock to document ADTs

2007-10-23 Thread Isaac Dupree
Simon Marlow wrote: Alfonso Acosta wrote: I'm beginning to get familiar with Haddock and I want to document a library which, as usually happens, has some ADT definitions. I'd like to document the ADTs both for the end-user (who shouldn't be told about its internal implementation) and future

Re: [Haskell-cafe] OS Abstraction module??

2007-10-23 Thread Isaac Dupree
Galchin Vasili wrote: In discussing this OS Abstraction Layer, I think I am thinking of some notion of laziness (read ... decisions made at run-time .. not compile-time .. otherwise I think we have to resort to ifdefs which are not so nice and require a lot of code maintenance.) It is

Re: [Haskell-cafe] XML parser recommendation?

2007-10-23 Thread Yitzchak Gale
Another question about HaXML and HXT - what is the level of XML spec. compliance? The many who have tried to implement compliant XML parsers in various languages - and the few who have succeeded - all agree that this is much harder than it seems at first. Most of the time, the final result is an

Re: [Haskell-cafe] ANNOUNCE: dataenc 0.9

2007-10-23 Thread Yitzchak Gale
Magnus Therning wrote: My collection of data encoding functions are now available Nice! Should this effort be coordinated with Unicode-related encoding/decoding? See the Encoding class in Twan van Laarhoven's CompactString library: http://twan.home.fmf.nl/compact-string/ and Johan Tibell's

Re: [Haskell-cafe] XML parser recommendation?

2007-10-23 Thread Yitzchak Gale
Malcolm Wallace wrote: I have been considering moving the lexer to use ByteString instead of String, which would neatly solve that problem too. Doesn't the lexer come only after decoding? Then you have Unicode. Does ByteString still help? -Yitz ___

Re[2]: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread Bulat Ziganshin
Hello Luke, Tuesday, October 23, 2007, 12:42:19 PM, you wrote: of me whining about Haskell's lack of OO features. How are you supposed to design your programs modularly if you can't have a type-agnostic list? But it doesn't bug me anymore. I can't really say why. i tink because it's very

[Haskell-cafe] ANNOUNCE: zlib and bzlib 0.4 releases

2007-10-23 Thread Duncan Coutts
I'm pleased to announce updates to the zlib and bzlib packages. The releases are on hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bzlib What's new in these releases is that the packages work with a wider range

Re: [Haskell-cafe] ANNOUNCE: zlib and bzlib 0.4 releases

2007-10-23 Thread Yitzchak Gale
Duncan Coutts wrote: I'm very happy to get feedback on the API, the documentation or of course any bug reports. It would be nice if the API could be the same for all character and data codecs. Thanks, Yitz ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] OS Abstraction module??

2007-10-23 Thread David Roundy
On Mon, Oct 22, 2007 at 09:44:11PM -0500, Galchin Vasili wrote: Hi Ryan, Thanks for your generous response. By the way, you don't want to use typeclasses here; they solve the problem of having more than one possible interface at runtime, whereas you only care about compile-time .. in

Re: [Haskell-cafe] Re: [Haskell] [Fwd: undecidable overlappinginstances: a bug?]

2007-10-23 Thread Claus Reinke
Hi Mark, Declaration Formula --- --- class Eq a = Ord a forall a. Ord a = Eq a instance Eq a = Eq [a] forall a. Eq a = Eq [a] class C a b | a - b forall a, b. C a b /\ C a c = b = c This correspondence between declarations and

Re: [Haskell-cafe] XML parser recommendation?

2007-10-23 Thread Uwe Schmidt
Yitzchak Gale wrote: Another question about HaXML and HXT - what is the level of XML spec. compliance? Implementing the XML 1.0 Standard was one of the goals of HXT when starting the project. This includes full support of DTD processing, which turned out to be the hardest part of the whole

Re: [Haskell-cafe] OS Abstraction module??

2007-10-23 Thread David Roundy
On Tue, Oct 23, 2007 at 09:10:02AM -0400, Isaac Dupree wrote: Galchin Vasili wrote: In discussing this OS Abstraction Layer, I think I am thinking of some notion of laziness (read ... decisions made at run-time .. not compile-time .. otherwise I think we have to resort to ifdefs which are not

Re: [Haskell-cafe] ANNOUNCE: zlib and bzlib 0.4 releases

2007-10-23 Thread Duncan Coutts
On Tue, 2007-10-23 at 16:34 +0200, Yitzchak Gale wrote: Duncan Coutts wrote: I'm very happy to get feedback on the API, the documentation or of course any bug reports. It would be nice if the API could be the same for all character and data codecs. Hmm, though the inputs and outputs are

[Haskell-cafe] Re: XML parser recommendation?

2007-10-23 Thread Rene de Visser
Uwe Schmidt [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] it into HXT. This still does not solve the processing of very very large XML document. I doubt, whether we can do this with a DOM like approach, as in HXT or HaXml. Lazy input does not solve all problems. A SAX like

Re: [Haskell-cafe] OS Abstraction module??

2007-10-23 Thread Tommy M. McGuire
David Roundy wrote: On Mon, Oct 22, 2007 at 09:44:11PM -0500, Galchin Vasili wrote: Hi Ryan, I am trying to avoid ifdef's and have all decisions made at run-time (maybe given the nature of Haskell .. i..e static/compile-time type checking this is impossible) ... I don't see how in any

Re: [Haskell-cafe] string literals and haskell'

2007-10-23 Thread Justin Bailey
On 10/22/07, Neil Mitchell [EMAIL PROTECTED] wrote: If this now reports no errors, who wants to guess which come up as escape codes, and which don't. The way other languages like C# have dealt with this is by introducing a new type of quoted string: @:\/ The C# implementation is really

Re: [Haskell-cafe] Re: XML parser recommendation?

2007-10-23 Thread Ketil Malde
Rene de Visser [EMAIL PROTECTED] writes: If I undertand the coding correctly every tag is stored as a seperate Haskell string. As each byte of a string under GHC takes 12 bytes this alone leads to high memory usage. Not that it detracts from your point, but I guess that is 24 bytes per

Re: [Haskell-cafe] string literals and haskell'

2007-10-23 Thread Chaddaï Fouché
2007/10/23, Justin Bailey [EMAIL PROTECTED]: My two cents - I haven't found another language that handles heredocs as nicely as Ruby does. Perl Heredocs do the same things and predates Ruby's (at least they do all you described and a bit more). But what would be really nice is a way to write

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread Carl Witty
On Tue, 2007-10-23 at 17:40 +0800, TJ wrote: On 10/23/07, Jules Bean [EMAIL PROTECTED] wrote: That is, the type inference algorithm which GHC uses, which is not the only one you can imagine, but for a variety of reasons is considered to be one of the best choices, cannot 'automatically'

Re: [Haskell-cafe] XML parser recommendation?

2007-10-23 Thread Ketil Malde
Ketil Malde [EMAIL PROTECTED] writes: HaXml on my list after TagSoup, which I'm about to get to work, I think (got distracted a bit ATM). As it is, I managed to parse my document using TagSoup. One major obstacle was the need to process a sizeable partition of the file. Using 'partitions'

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread Tristan Allwood
Why can't it automatically construct them then? Assuming we do have a syntax for A list of objects, each of which is of some possibly different type 'a', subject only to the restriction that a is a member of typeclass Show, as the following: ls :: [a where Show a] Then I would

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread Sebastian Sylvan
On 23/10/2007, Jules Bean [EMAIL PROTECTED] wrote: I will also repeat the non-justified assertion that others have made, and that I've made myself in the other thread, that you don't need existentials as often in haskell as you do in OO languages, and they certainly don't always need to be

Re: [Haskell-cafe] Re: Type-level arithmetic

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-12 at 13:52 -0400, Steve Schafer wrote: On Fri, 12 Oct 2007 18:24:38 +0100, you wrote: I was actually thinking more along the lines of a programming language where you can just write head :: (n 1) = List n x - x tail :: List n x - List (n-1) x (++) :: List n x

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-19 at 00:02 +0200, [EMAIL PROTECTED] wrote: Dan Weston writes: ... now I am totally flummoxed: thm1 :: (a - a) - a thm1 f = let x = f x in x thm1 (const 1) 1 I *thought* that the theorem ((a = a) = a) is not derivable (after all, 0^(0^0) = 0^1 = 0),

Re: [Haskell-cafe] Polymorphic (typeclass) values in a list?

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-19 at 23:57 +0800, TJ wrote: Henning Thielemann: class Renderable a where render :: a - RasterImage scene :: Renderable a = [a] This signature is valid, but it means that all list elements must be of the same Renderable type. Yes, that's exactly the

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-12 at 19:33 -0400, Brandon S. Allbery KF8NH wrote: On Oct 12, 2007, at 18:35 , Albert Y. C. Lai wrote: You are not expected to be convinced this, but it seems continuations completely characterize system programming. :) Didn't someone already prove all monads can be

Re: [Haskell-cafe] Do you trust Wikipedia?

2007-10-23 Thread Jonathan Cast
On Fri, 2007-10-19 at 02:45 +0200, [EMAIL PROTECTED] wrote: PR Stanley writes: One of the reasons I'm interested in Wikipedia and Wikibook is because you're more likely to find Latex source code used for typesetting the maths. Latex is the one and only 100% tool right now. A lot of

Re: [Haskell-cafe] Type vs TypeClass duality

2007-10-23 Thread TJ
Tristan Allwood: Very cool. I don't understand some (a lot of) parts though: instance Show a = Reify (ShowConstraint a) where reify = ShowC ShowC has type (Show a) = ShowConstraint a, whereas reify is supposed to have type ShowConstraint a. data SingleList (a :: * - *) where Cons :: (a