Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Miguel Mitrofanov
What is it for? Yes, you would know that only A and B are Public, but you have no way of telling that to the compiler. I usually prefer something like that: class Public x where blah :: ... isAB :: forall y. (A - y) - (B - y) - x - y Both solutions, however, allow the user to declare some

Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Miguel Mitrofanov
Oops... Sorry, wrong line. Should be isAB :: forall p. p A - p B - p x On 18 Jul 2009, at 10:51, Miguel Mitrofanov wrote: What is it for? Yes, you would know that only A and B are Public, but you have no way of telling that to the compiler. I usually prefer something like that: class

[Haskell-cafe] Importance of identity element in finger trees?

2009-07-18 Thread Daniel Peebles
Hi all, I was looking at finger trees and the tricks for getting priority queues out of them seemed a little hackish, with a distinguished infinity element or maxBound. But it seems (although I have not yet tried it) like in many cases the monoid's identity element wouldn't be necessary (a bit

Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Conor McBride
Hi Miguel On 18 Jul 2009, at 07:58, Miguel Mitrofanov wrote: Oops... Sorry, wrong line. Should be isAB :: forall p. p A - p B - p x Yep, dependent case analysis, the stuff of my thesis,... On 18 Jul 2009, at 10:51, Miguel Mitrofanov wrote: What is it for? I have a different purpose in

Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Stefan Holdermans
Conor, I'm scared. What about this? data EQ :: * - * - * where Refl :: EQ x x class Public x where blah :: EQ x Fred instance Public Fred where blah = Refl What happens when I say newtype Jim = Hide Fred deriving Public ? I tried it. I get blah :: EQ Jim Fred It's clear that

Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Conor McBride
On 18 Jul 2009, at 01:43, Lennart Augustsson wrote: As far as I know it works. It's an old Oleg trick. Then it probably does work. The only drawback is that error messages may refer to Private. As I found out when probing its security. No instance for Moo.Private shows up. I guess that's

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-18 Thread Jon Fairbairn
Henning Thielemann lemm...@henning-thielemann.de writes: On Thu, 16 Jul 2009, Fernan Bolando wrote: Hi all I recently used 2 hours of work looking for a bug that was causing Program error: Prelude.!!: index too large A good way to avoid such problems is to avoid partial functions at

Re: [Haskell-cafe] Plot data reconstruction reading pixel colors from image files

2009-07-18 Thread Andrew Coppin
Henning Thielemann wrote: Felipe Lessa schrieb: On Fri, Jul 17, 2009 at 06:31:20PM +0200, Cetin Sert wrote: How can I open and read colors of specific pixels of an image file in Haskell? Which packages, functions do you recommend? You could try DevIL, SDL-image or Gtk, I guess.

[Haskell-cafe] cabal version issue

2009-07-18 Thread Vasili I. Galchin
Hello, vigalc...@ubuntu:~/FTP/Haskell/06052009.Swish-0.2.1$ cabal --version cabal-install version 0.5.1 using version 1.4.0.1 of the Cabal library vigalc...@ubuntu:~/FTP/Haskell/Swish-0.2.1$ cabal configure --user --prefix=$HOME Warning: swish.cabal: A package using section syntax should require

Re: [Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-18 Thread Wolfgang Jeltsch
Am Samstag, 18. Juli 2009 06:31 schrieben Sie: On Jul 18, 2009, at 2:35 AM, Wolfgang Jeltsch wrote: So I should upload a package with German identifiers to Hackage? Sure, why not? The fact that I can't read it is my loss, not your fault, and there will be plenty of other German-reading

[Haskell-cafe] catchSTM and asynchronous exceptions

2009-07-18 Thread Peter Robinson
I couldn't find any information on whether catchSTM catches asynchronous exceptions so I tried to run the following: import Control.Concurrent.STM import Control.Concurrent import Control.Exception import Prelude hiding (catch) test = do tid - myThreadId forkIO (threadDelay 500

newtype deriving, was Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Conor McBride
Hi Stefan On 18 Jul 2009, at 09:42, Stefan Holdermans wrote: Conor, What happens when I say newtype Jim = Hide Fred deriving Public ? I tried it. I get blah :: EQ Jim Fred It's clear that GeneralizedNewtypeDeriving goes too far. Now, I am scared. This should be regarded as a bug in

Re: [Haskell-cafe] can there be (hash-table using) O(n) version of this (I think currently) n log n algo?

2009-07-18 Thread Matthias Görgens
However you can use the wider idea of hashing: A nesting of two finite maps. One fast, but approximative map. And one slow, but exact map. The quintessential example is an array indexed with some hash function for the first map. And linked lists of (key,value) pairs as the latter. In Haskell

Re: [Haskell-cafe] Importance of identity element in finger trees?

2009-07-18 Thread Ross Paterson
On Sat, Jul 18, 2009 at 03:57:12AM -0400, Daniel Peebles wrote: I was looking at finger trees and the tricks for getting priority queues out of them seemed a little hackish, with a distinguished infinity element or maxBound. But it seems (although I have not yet tried it) like in many cases

Re: [Haskell-cafe] can there be (hash-table using) O(n) version of this (I think currently) n log n algo?

2009-07-18 Thread Bulat Ziganshin
Hello Thomas, Saturday, July 18, 2009, 2:24:21 AM, you wrote: Further, is there a hashtable implementation for haskell that doesn't live in IO? Maybe in ST or something? import Prelude hiding (lookup) import qualified Data.HashTable import Data.Array import qualified Data.List as List data

Re: [Haskell-cafe] ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-18 Thread Miguel Mitrofanov
On 18 Jul 2009, at 13:26, Wolfgang Jeltsch wrote: Am Samstag, 18. Juli 2009 06:31 schrieben Sie: On Jul 18, 2009, at 2:35 AM, Wolfgang Jeltsch wrote: So I should upload a package with German identifiers to Hackage? Sure, why not? The fact that I can't read it is my loss, not your fault,

Re: [Haskell-cafe] cabal version issue

2009-07-18 Thread Sjoerd Visscher
The message means that the .cabal file should contain the line Cabal- Version: = 1.2 Sjoerd On Jul 18, 2009, at 11:17 AM, Vasili I. Galchin wrote: Hello, vigalc...@ubuntu:~/FTP/Haskell/06052009.Swish-0.2.1$ cabal --version cabal-install version 0.5.1 using version 1.4.0.1 of the Cabal

Re: newtype deriving, was Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Stefan Holdermans
Conor, What happens when I say newtype Jim = Hide Fred deriving Public ? I tried it. I get blah :: EQ Jim Fred Thinking of it; this *does* make sense in System FC. The newtype- declaration gives you as an axiom Hide :: Jim ~ Fred To give an instance of Public for Jim, we have to

Re: newtype deriving, was Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Wolfgang Jeltsch
Am Samstag, 18. Juli 2009 11:43 schrieb Conor McBride: The trouble here is that somewhere along the line (GADTs? earlier?) it became possible to construct candidates for p :: * - * which don't respect isomorphism. Hello Conor, I’m not sure whether I exactly understand what you mean here. I

Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Dougal Stanton
On Fri, Jul 17, 2009 at 4:38 PM, Conor McBrideco...@strictlypositive.org wrote: class Private x where public :: (forall x. Public x = x - y) - y public f = f Pike data Pike = Pike instance Private Pike instance Public Pike -- But if I don't tell 'em

Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Wolfgang Jeltsch
Am Samstag, 18. Juli 2009 08:58 schrieb Miguel Mitrofanov: Oops... Sorry, wrong line. Should be isAB :: forall p. p A - p B - p x Is this a well-known approach for closing classes? I came across the same idea and implemented a generic framework for closing classes in this way. I did this to

Re: [Haskell-cafe] Re: Debugging methods for haskell

2009-07-18 Thread Fernan Bolando
On Sat, Jul 18, 2009 at 4:57 PM, Jon Fairbairnjon.fairba...@cl.cam.ac.uk wrote: Henning Thielemann lemm...@henning-thielemann.de writes: On Thu, 16 Jul 2009, Fernan Bolando wrote: Hi all I recently used 2 hours of work looking for a bug that was causing Program error: Prelude.!!: index

Re: newtype deriving, was Re: [Haskell-cafe] is closing a class this easy?

2009-07-18 Thread Conor McBride
Hi Wolfgang On 18 Jul 2009, at 13:42, Wolfgang Jeltsch wrote: Am Samstag, 18. Juli 2009 11:43 schrieb Conor McBride: The trouble here is that somewhere along the line (GADTs? earlier?) it became possible to construct candidates for p :: * - * which don't respect isomorphism. Hello Conor,

[Haskell-cafe] ANNOUNCE: graphviz-2999.0.0.0

2009-07-18 Thread Ivan Lazar Miljenovic
I am pleased to announce a new release of the graphviz package for Haskell, which provides bindings to the GraphViz [1] suite of tools. [1] http://www.graphviz.org/ Probably the biggest and most important change in this release is that AFAICT, all 152 attributes utilised/supported by GraphViz

Re: [Haskell-cafe] can there be (hash-table using) O(n) version of this (I think currently) n log n algo?

2009-07-18 Thread Thomas Hartman
Thanks Bulat. FWIW, i take it that http://www.haskell.org/haskellwiki/Shootout/Knucleotide is what Edward was referring to, with the shootouts. It seems that a lot of progress has been made but not much has been migrated back to hackage. Going back to my original question, I am now looking for

[Haskell-cafe] Haskell Weekly News: Issue 126 - July 18, 2009

2009-07-18 Thread Brent Yorgey
--- Haskell Weekly News http://sequence.complete.org/hwn/20090718 Issue 126 - July 18, 2009 --- Welcome to issue 126 of HWN, a newsletter covering

Re[2]: [Haskell-cafe] can there be (hash-table using) O(n) version of this (I think currently) n log n algo?

2009-07-18 Thread Bulat Ziganshin
Hello Thomas, Saturday, July 18, 2009, 7:23:10 PM, you wrote: Going back to my original question, I am now looking for a dead simple motivating example for showing the example of using a (good) hashtable over Data.Map spell checking? -- Best regards, Bulat

Re: [Haskell-cafe] can there be (hash-table using) O(n) version of this (I think currently) n log n algo?

2009-07-18 Thread Don Stewart
tphyahoo: The code below is, I think, n log n, a few seconds on a million + element list. Have you tried the judy arrays library on Hackage? (It provides a hashtable, which I've used occasionally) -- Don ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] ANNOUNCE: graphviz-2999.0.0.0

2009-07-18 Thread Zsolt Dollenstein
Hi, On Sat, Jul 18, 2009 at 10:23 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: I am pleased to announce a new release of the graphviz package for Haskell, which provides bindings to the GraphViz [1] suite of tools. Nice work! As the way of defining an attribute for a specific

Re: [Haskell-cafe] Re: [Haskell] Re: 20 years ago

2009-07-18 Thread wren ng thornton
Richard O'Keefe wrote: On Jul 15, 2009, at 5:25 PM, Benjamin L.Russell wrote: it interesting that you should use the biological term disease; according to a post [1] entitled Re: Re: Smalltalk Data Structures and Algorithms, by K. K. Subramaniam, dated Mon, 29 Jun 2009 11:25:34 +0530, on the

Re: [Haskell-cafe] Re: [Haskell] Re: 20 years ago

2009-07-18 Thread wren ng thornton
Richard O'Keefe wrote: On Jul 15, 2009, at 5:25 PM, Benjamin L.Russell wrote: it interesting that you should use the biological term disease; according to a post [1] entitled Re: Re: Smalltalk Data Structures and Algorithms, by K. K. Subramaniam, dated Mon, 29 Jun 2009 11:25:34 +0530, on the

Re: [Haskell-cafe] Haskell Zippers on Wikibooks: teasing! :)

2009-07-18 Thread wren ng thornton
Peter Verswyvelen wrote: After my colleague explained me about zippers and how one could derive the datatype using differential rules, I had to read about it. So I started reading http://en.wikibooks.org/wiki/Haskell/Zippers#Mechanical_Differentiation This page contains the sentence: *For a

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-18 Thread wren ng thornton
Andrew Coppin wrote: That seems simple enough (although problematic to implement). However, the Report seems to say that it matters whether or not the bindings are muturally recursive [but I'm not sure precisely *how* it matters...] Seriously, check out the classic Milner paper. Of

[Haskell-cafe] Problem with lazy IO

2009-07-18 Thread Maciej Piechotka
Hello. I've tried to combine lazy IO and parsec. The hole process is done by network. Currently I have implemented 'short parsers' so I enter them on need. To update state I have following code: parser2nntp :: Monad m = NntpParser m a - NntpT m a parser2nntp p = do s - NntpT (gets $ input .

Re: [Haskell-cafe] A voyage of undiscovery

2009-07-18 Thread wren ng thornton
Andrew Coppin wrote: Robert Greayer wrote: f0 _ = (foo True, foo 'x') where foo = id is well-typed. Really? That actually works? How interesting... This suggests to me that where-clauses also do strange things to the type system. Not too strange, in fact we need it to do that for

[Haskell-cafe] was: Debugging methods for haskell structured data types the right way in haskell

2009-07-18 Thread Fernan Bolando
On Sun, Jul 19, 2009 at 7:40 AM, wren ng thorntonw...@freegeek.org wrote: Fernan Bolando wrote: The intention is z0 is a system parameter and database, it contains a set of info needed to define a particular simulation it looks like ( [n,m...], [m,o,p]) n is is a list info settings for the

Re: [Haskell-cafe] Re: Debugging methods for haskell

2009-07-18 Thread wren ng thornton
Fernan Bolando wrote: The intention is z0 is a system parameter and database, it contains a set of info needed to define a particular simulation it looks like ( [n,m...], [m,o,p]) n is is a list info settings for the circuit analysis m is a list of statistics for the circuits that is need in