Re: [Haskell-cafe] Re: Re: Data.Ring -- Pre-announce

2010-01-04 Thread Luke Palmer
On Mon, Jan 4, 2010 at 1:13 PM, Maciej Piechotka wrote: > However then we lost the monoid (ok. I haven't send patch but please > accept[1]) along with alternative/monad plus - which is much more > popular, standard and useful then Copointed/Comonad. This point is a self-fulfilling prophecy. We d

Re: [Haskell-cafe] HackageDB is not for ... ?

2010-01-04 Thread Andrey Sisoyev
> Find other package and send a patch (like category-extras) if it > applies? That is good, if I find other package, that satisfies my requirements (or does, with my patch). But that's a solution for a different case. Consider (1) and (2) to be conceptually unique. > [Solution C] Create package.

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread ajb
G'day all. Quoting Derek Elkins : Ignoring bottoms the free theorem for fmap can be written: If h . p = q . g then fmap h . fmap p = fmap q . fmap g Setting p = id gives h . id = h = q . g && fmap h . fmap id = fmap q . fmap g Using fmap id = id and h = q . g we get, fmap h . fmap id = fmap h

[Haskell-cafe] Re: lawless instances of Functor

2010-01-04 Thread Maciej Piechotka
On Tue, 2010-01-05 at 08:01 +0900, Derek Elkins wrote: > On Tue, Jan 5, 2010 at 7:14 AM, Paul Brauner wrote: > > Hi, > > > > I'm trying to get a deep feeling of Functors (and then pointed Functors, > > Applicative Functors, etc.). To this end, I try to find lawless > > instances of Functor that sa

Re: [Haskell-cafe] Significant slow-down in parallel code?

2010-01-04 Thread Jamie Morgenstern
I am using 6.12... are there any good pointers as to how one uses threadscope? On Mon, Jan 4, 2010 at 3:14 PM, Neil Mitchell wrote: > Hi Jamie, > > First question, what version of GHC are you using? There are > significant performance improvements to parallel code in GHC 6.12, so > it's worth an

Re: [Haskell-cafe] Why doesn't laziness save the day here?

2010-01-04 Thread Daniel Fischer
Am Dienstag 05 Januar 2010 02:31:20 schrieb Dale Jordan: > Kind and Generous Haskellers: > > I am ensnared in a briar patch of infinite lists and Random gnerators > trying to use laziness to advantage. Here's my code: > > - 8< > import Control.Applicative > imp

[Haskell-cafe] Re: HackageDB is not for ... ?

2010-01-04 Thread Maciej Piechotka
On Mon, 2010-01-04 at 17:26 -0800, Andrey Sisoyev wrote: > Hello everybody! > Hello > - > Consider cases: > (1) > I don't want to publish package A, because I doubt anyone will find it > useful. > But I develop independent packages B and C, that will be useful

Re: [Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Daniel Fischer
Am Montag 04 Januar 2010 22:25:28 schrieb Daniel Fischer: > compos ps = fst (tfold mergeSP $ nwise 1 mergeSP (pairwise mergeSP (multip > ps))) > > tfold f (a: ~(b: ~(c:xs))) > = (a `f` (b `f` c)) `f` tfold f xs > > nwise k f xs = let (ys,zs) = splitAt k xs in rfold f ys : nwise

[Haskell-cafe] Why doesn't laziness save the day here?

2010-01-04 Thread Dale Jordan
Kind and Generous Haskellers: I am ensnared in a briar patch of infinite lists and Random gnerators trying to use laziness to advantage. Here's my code: - 8< import Control.Applicative import Control.Monad import Control.Monad.Random import Control.Monad.Sta

[Haskell-cafe] HackageDB is not for ... ?

2010-01-04 Thread Andrey Sisoyev
Hello everybody! I'm planning not a small project, and intuition suggests me, that I should use heavily the rule "separate and rule". So I must separate the project into many maximum independent and general pieces (packages), make them, and finally glue it into my project. The pieces and their de

Re: [Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Daniel Fischer
Am Montag 04 Januar 2010 16:30:18 schrieb Will Ness: > Heinrich Apfelmus quantentunnel.de> writes: > > > > (I haven't followed the whole thread, but hopefully I have enough grasp > > of it to make a useful remark. :)) > > > > Concerning lists as producer/consumer, I think that's exactly what lazy

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Dan Piponi
On Mon, Jan 4, 2010 at 4:15 PM, Paul Brauner wrote: > I wonder why this isn't some "classic" category theory result (maybe it is ?) It doesn't hold in category theory in general. Haskell (or at least a certain subset) is special - many things that just *look* category theoretical turn out to ac

Re: [Haskell-cafe] Compiling a shared library on MacOS X

2010-01-04 Thread Mark Wotton
There's a patch for it in GHC HEAD by Stephen Blackheath and me, and an accompanying patch for Cabal. http://hackage.haskell.org/trac/ghc/ticket/3550 http://hackage.haskell.org/trac/hackage/ticket/591 has the details. mark On Mon, Jan 4, 2010 at 10:36 AM, Ivan Miljenovic wrote: > If I recall c

Re: [Haskell-cafe] Compiling a shared library on MacOS X

2010-01-04 Thread Chris Eidhof
I'm not sure if it is of any help, but at the haskell-wiki there's an article about how to communicate between Haskell and Objective-C using XCode: http://haskell.org/haskellwiki/Using_Haskell_in_an_Xcode_Cocoa_project -chris On 4 jan 2010, at 00:36, Ivan Miljenovic wrote: > If I recall correc

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Paul Brauner
Thanks. I was wondering if the free theorem of fmap entailed that implication, but I'm not used enough to decipher the output of the tool, neither am I able to generate it by hand. However, if this holds (law1 => law2), I wonder why this isn't some "classic" category theory result (maybe it is ?).

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Dan Piponi
On Mon, Jan 4, 2010 at 3:26 PM, Derek Elkins wrote: > Yes, I have the same problem...Basically, I'm > pretty sure the construction of that free theorem doesn't rely on any > of the actual details... For a long time I've thought such a higher order free theorem must exist, and I've mentioned it t

Re: [Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Daniel Fischer
Am Montag 04 Januar 2010 19:16:32 schrieb Will Ness: > Daniel Fischer web.de> writes: > > Am Montag 04 Januar 2010 13:25:47 schrieb Will Ness: > > > Euler's sieve is > > > > > > sieve (p:ps) xs = h ++ sieve ps (t `minus` map (p*) [p,p+2..]) > > > where (h,t) = span (< p*p) x

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Derek Elkins
On Tue, Jan 5, 2010 at 8:22 AM, Brent Yorgey wrote: > On Mon, Jan 04, 2010 at 11:49:33PM +0100, Steffen Schuldenzucker wrote: >> >> data Foo a = Foo a >> >> instance Functor Foo where >>     fmap f (Foo x) = Foo . f . f $ x >> >> Then: >> >> fmap id (Foo x) == Foo . id . id $ x == Foo x >> >> fmap

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Derek Elkins
On Tue, Jan 5, 2010 at 8:15 AM, Dan Piponi wrote: > On Mon, Jan 4, 2010 at 3:01 PM, Derek Elkins wrote: > >> Ignoring bottoms the free theorem for fmap can be written: >> >> If h . p = q . g then fmap h . fmap p = fmap q . fmap g > > When I play with http://haskell.as9x.info/ft.html I get example

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Brent Yorgey
On Mon, Jan 04, 2010 at 11:49:33PM +0100, Steffen Schuldenzucker wrote: > > data Foo a = Foo a > > instance Functor Foo where > fmap f (Foo x) = Foo . f . f $ x > > Then: > > fmap id (Foo x) == Foo . id . id $ x == Foo x > > fmap (f . g) (Foo x) == Foo . f . g . f . g $ x > fmap f . f

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Dan Piponi
On Mon, Jan 4, 2010 at 3:01 PM, Derek Elkins wrote: > Ignoring bottoms the free theorem for fmap can be written: > > If h . p = q . g then fmap h . fmap p = fmap q . fmap g When I play with http://haskell.as9x.info/ft.html I get examples that look more like: If fmap' has the same signature as t

Re: [Haskell-cafe] Re: Re: Data.Ring -- Pre-announce

2010-01-04 Thread Derek Elkins
On Tue, Jan 5, 2010 at 5:13 AM, Maciej Piechotka wrote: > On Mon, 2010-01-04 at 07:17 -0700, Luke Palmer wrote: >> On Mon, Jan 4, 2010 at 6:51 AM, Maciej Piechotka >> wrote: >> > About comonad - not exactly as every comonad is copointed and the only >> > possible way is extract Empty = _|_ >> >>

Re: [Haskell-cafe] A question on DSL's

2010-01-04 Thread Tom Hawkins
On Mon, Jan 4, 2010 at 9:41 PM, Luke Palmer wrote: > On Mon, Jan 4, 2010 at 12:16 PM, Tom Hawkins wrote: >> One argument for option 2 is to carry forward datatypes to the target >> language.  For example, if you want to describe a state machine with >> the state as a type: > > What do you mean "c

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Derek Elkins
On Tue, Jan 5, 2010 at 7:14 AM, Paul Brauner wrote: > Hi, > > I'm trying to get a deep feeling of Functors (and then pointed Functors, > Applicative Functors, etc.). To this end, I try to find lawless > instances of Functor that satisfy one law but not the other. > > I've found one instance that s

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Jochem Berndsen
Steffen Schuldenzucker wrote: > data Foo a = Foo a > > instance Functor Foo where > fmap f (Foo x) = Foo . f . f $ x I think this doesn't typecheck. Cheers, Jochem -- Jochem Berndsen | joc...@functor.nl | joc...@牛在田里.com ___ Haskell-Cafe mailing

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Derek Elkins
On Tue, Jan 5, 2010 at 7:49 AM, Steffen Schuldenzucker wrote: > Hi Paul, > > Paul Brauner wrote: >> Hi, >> >> I'm trying to get a deep feeling of Functors (and then pointed Functors, >> Applicative Functors, etc.). To this end, I try to find lawless >> instances of Functor that satisfy one law but

Re: [Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Steffen Schuldenzucker
Hi Paul, Paul Brauner wrote: > Hi, > > I'm trying to get a deep feeling of Functors (and then pointed Functors, > Applicative Functors, etc.). To this end, I try to find lawless > instances of Functor that satisfy one law but not the other. > > I've found one instance that satisfies fmap (f.g) = f

Re: [Haskell-cafe] curl on windows?

2010-01-04 Thread Henk-Jan van Tuyl
On Mon, 04 Jan 2010 16:55:44 +0100, Günther Schmidt wrote: Hi, how can I install curl on windows (XP)? Download the C code for cURL from: http://curl.haxx.se/download.html Unpack the source; to avoid problems with scripts, use paths without spaces. See the instructions at: http:

[Haskell-cafe] lawless instances of Functor

2010-01-04 Thread Paul Brauner
Hi, I'm trying to get a deep feeling of Functors (and then pointed Functors, Applicative Functors, etc.). To this end, I try to find lawless instances of Functor that satisfy one law but not the other. I've found one instance that satisfies fmap (f.g) = fmap f . fmap g but not fmap id = id: data

Re: [Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Daniel Fischer
Am Montag 04 Januar 2010 18:08:42 schrieb Will Ness: > Daniel Fischer web.de> writes: > > Am Sonntag 03 Januar 2010 09:54:37 schrieb Will Ness: > > > The quesion of a memory blowup with the treefolding merge still > > > remains. For some reason using its second copy for a feeder doesn't > > > redu

Re: [Haskell-cafe] A question on DSL's

2010-01-04 Thread Luke Palmer
On Mon, Jan 4, 2010 at 12:16 PM, Tom Hawkins wrote: > One argument for option 2 is to carry forward datatypes to the target > language.  For example, if you want to describe a state machine with > the state as a type: What do you mean "carry forward". Can you elaborate on your simple example? W

Re: [Haskell-cafe] Significant slow-down in parallel code?

2010-01-04 Thread Neil Mitchell
Hi Jamie, First question, what version of GHC are you using? There are significant performance improvements to parallel code in GHC 6.12, so it's worth an upgrade. Once you've upgraded you might want to try out threadscope which is designed to help track down these sorts of problems. If you are u

[Haskell-cafe] Re: Re: Data.Ring -- Pre-announce

2010-01-04 Thread Maciej Piechotka
On Mon, 2010-01-04 at 07:17 -0700, Luke Palmer wrote: > On Mon, Jan 4, 2010 at 6:51 AM, Maciej Piechotka > wrote: > > About comonad - not exactly as every comonad is copointed and the only > > possible way is extract Empty = _|_ > > I think this module could be cleaned up by disallowing empty li

[Haskell-cafe] HXT XSLT example?

2010-01-04 Thread Günther Schmidt
Hi, is there a simple example for XSLT via HXT? You know something like take this xml file, apply this xsl file, dump to stdout. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] A question on DSL's

2010-01-04 Thread Tom Hawkins
One argument for option 2 is to carry forward datatypes to the target language. For example, if you want to describe a state machine with the state as a type: data StopLightState = Red | Yellow | Green With option 1, values of type StopLightState will be resolved at compile-time, not run-time.

[Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Will Ness
Emil Axelsson chalmers.se> writes: > > > For me, a real smart compiler is one that would take in e.g. (sum $ > > take n $ > > cycle $ [1..m]) and spill out a straight up math formula, inside a few ifs > > maybe (just an aside). > > (Also an aside, I couldn't resist...) > > Then I'm sure yo

[Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Will Ness
Daniel Fischer web.de> writes: > > > Am Montag 04 Januar 2010 13:25:47 schrieb Will Ness: > > > Euler's sieve is > > > > sieve (p:ps) xs = h ++ sieve ps (t `minus` map (p*) [p,p+2..]) > > where (h,t) = span (< p*p) xs > > Not quite. That's a variant of the postponed fil

Re: [Haskell-cafe] Why can't we make an instance declaration on a type synonym?

2010-01-04 Thread Brandon Simmons
On Mon, Jan 4, 2010 at 12:11 PM, Reid Barton wrote: > On Mon, Jan 04, 2010 at 11:50:57AM -0500, Brandon Simmons wrote: >> On Sun, Jan 3, 2010 at 2:22 AM, Ivan Lazar Miljenovic >> wrote: >> > jberryman writes: >> > >> >> This may be a dumb question, but why can we not declare a Monad >> >> instan

Re: [Haskell-cafe] A question on DSL's

2010-01-04 Thread CK Kashyap
Thanks Jasper ... Thanks John, While most of the use case I had in mind seems to fit the EDSL description, I had some in the proper DSL category as well... So, my prejudice had been towards option one - and I was unable to visualize a situation where option 1 would not work - or become too probl

Re: [Haskell-cafe] A question on DSL's

2010-01-04 Thread John Van Enk
To start with, can you clarify that you are looking for an Embedded DSL (sometimes called Light Weight DSL)? A _proper_ DSL has its own interpreter/compiler where an EDSL/LwDSL leverages the compiler of a host language (in this case, Haskell). Assuming you're referring to an EDSL, I'll respond. :

Re: [Haskell-cafe] A question on DSL's

2010-01-04 Thread Jasper Van der Jeugt
Hello, I see no real reason to use the second approach, unless you're doing something tremendously new and big. Besides, the first solution is much easier and will be easier to maintain (in case the back end changes). Kind regards, Jasper Van der Jeugt On Mon, Jan 4, 2010 at 6:14 PM, CK Kashyap

[Haskell-cafe] A question on DSL's

2010-01-04 Thread CK Kashyap
Hi, I am not sure if I'm using DSL in the right context here but I am referring to those solutions that allow us to write code in Haskell and generate a target code source code of another language or even object code for that matter. I am aware of two ways of achieving this - 1. Implement funct

Re: [Haskell-cafe] Why can't we make an instance declaration on a type synonym?

2010-01-04 Thread Reid Barton
On Mon, Jan 04, 2010 at 11:50:57AM -0500, Brandon Simmons wrote: > On Sun, Jan 3, 2010 at 2:22 AM, Ivan Lazar Miljenovic > wrote: > > jberryman writes: > > > >> This may be a dumb question, but why can we not declare a Monad > >> instance of a type synonym? This question came to me while working

[Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Will Ness
Daniel Fischer web.de> writes: > > Am Sonntag 03 Januar 2010 09:54:37 schrieb Will Ness: > > > > The quesion of a memory blowup with the treefolding merge still remains. > > For some reason using its second copy for a feeder doesn't reduce the > > memory (as reported by standalone compiled progr

Re: [Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Daniel Fischer
Am Montag 04 Januar 2010 13:25:47 schrieb Will Ness: > Daniel Fischer web.de> writes: > > Am Sonntag 03 Januar 2010 09:54:37 schrieb Will Ness: > > > Daniel Fischer web.de> writes: > > > > But there's a lot of list constructuion and deconstruction necessary > > > > for the Euler sieve. > > > > >

Re: [Haskell-cafe] Why can't we make an instance declaration on a type synonym?

2010-01-04 Thread Brandon Simmons
On Sun, Jan 3, 2010 at 2:22 AM, Ivan Lazar Miljenovic wrote: > jberryman writes: > >> This may be a dumb question, but why can we not declare a Monad >> instance of a type synonym? This question came to me while working >> with the State monad recently and feeling that the requirement that we >>

Re: [Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Emil Axelsson
For me, a real smart compiler is one that would take in e.g. (sum $ take n $ cycle $ [1..m]) and spill out a straight up math formula, inside a few ifs maybe (just an aside). (Also an aside, I couldn't resist...) Then I'm sure you'd say that Feldspar [1] has a smart compiler :) The above exp

[Haskell-cafe] Space Efficiency When Sorting a List of Many Lists

2010-01-04 Thread Peter Green
Heinrich, thanks for some great help and food for thought! (More on performance of your solution below) Thanks for describing the background of this problem in detail! I was mainly asking because I'm always looking for interesting Haskell topics that can be turned into a tutorial of sorts, a

[Haskell-cafe] curl on windows?

2010-01-04 Thread Günther Schmidt
Hi, how can I install curl on windows (XP)? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Will Ness
Heinrich Apfelmus quantentunnel.de> writes: > > Will Ness wrote: > > > > I keep thinking that storage duplication with span, filter etc. is not > > really > > necessary, and can be replaced with some pointer chasing - especially when > > there's only one consumer present for the generated valu

Re: [Haskell-cafe] Interpreting profiling results

2010-01-04 Thread Daniel Fischer
Am Montag 04 Januar 2010 02:17:06 schrieb Patrick LeBoutillier: > Hi, > > This question didn't get any replies on the beginners list, I thought > I'd try it here... Sorry, been occupied with other things. I already took a look, but hadn't anything conclusive enough to reply yet. > > I've writte

Re: [Haskell-cafe] Re: Data.Ring -- Pre-announce

2010-01-04 Thread John Van Enk
I've heard this a few times and am slowly becoming convinced of it. I'll try my current use without the Empty and see how it goes. Given that I've heard this from several places, I'll probably drop Empty. On Mon, Jan 4, 2010 at 9:17 AM, Luke Palmer wrote: > On Mon, Jan 4, 2010 at 6:51 AM, Macie

Re: [Haskell-cafe] Re: Data.Ring -- Pre-announce

2010-01-04 Thread Luke Palmer
On Mon, Jan 4, 2010 at 6:51 AM, Maciej Piechotka wrote: > About comonad - not exactly as every comonad is copointed and the only > possible way is extract Empty = _|_ I think this module could be cleaned up by disallowing empty lists. You have this nice semantic property that "every clist has a f

[Haskell-cafe] Re: Data.Ring -- Pre-announce

2010-01-04 Thread Maciej Piechotka
On Thu, 2009-12-31 at 04:59 -0500, John Van Enk wrote: > Hi List, > > I recently needed a ring structure (circular list with bi-directional > access) and didn't see anything obvious on Hackage. I threw something > together fairly quickly and would like some feedback before tossing it > on Hackage.

[Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Heinrich Apfelmus
Will Ness wrote: > > I keep thinking that storage duplication with span, filter etc. is not really > necessary, and can be replaced with some pointer chasing - especially when > there's only one consumer present for the generated values. > > What I mean is thinking of lists in terms of produce/

[Haskell-cafe] Re: Space Efficiency When Sorting a List of Many Lists

2010-01-04 Thread Heinrich Apfelmus
Peter Green wrote: > Luke Palmer wrote: >> Yes, by a lot. Sorting requires keeping the entire list in memory. >> And Haskell lists, unfortunately, are not that cheap in terms of space >> usage (I think [Int] uses 3 words per element). >> >>> but my questions are: >>>(1) Am I doing anything

[Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Will Ness
Daniel Fischer web.de> writes: > > > Am Sonntag 03 Januar 2010 09:54:37 schrieb Will Ness: > > > Daniel Fischer web.de> writes: > > > > > But there's a lot of list constructuion and deconstruction necessary for > > > the Euler sieve. > > > > yes. Unless, of course, s smart compiler recognize

Re: [Haskell-cafe] Data.Ring -- Pre-announce

2010-01-04 Thread Wouter Swierstra
Hi John, > I threw something together fairly quickly and would like some feedback before > tossing it on Hackage. > > I'd really appreciate if some one would: > > make sure the code looks goodish (127 lines with full docs) > make sure my tests look saneish A similar structure is used in XMonad w

[Haskell-cafe] Re: [Very long] (CHP?) Compressing, MD5 and big files

2010-01-04 Thread Maciej Piechotka
On Sun, 2010-01-03 at 17:34 +0100, Maciej Piechotka wrote: > I have following problem: I'd like to operate on big files so I'd > prefere to operate on 'stream' instead of whole file at a time to avoid > keeping too much in memory. I need to calculate MD5 and compress file. > > I tried to use some

Re: Re[2]: [Haskell-cafe] Template Haskell - substitution in pattern in a lambda

2010-01-04 Thread Gregory Crosswhite
Cool, Burat! Those are the first tutorials I've read on TH that have succeeded in giving me a sense of how I can actually use it! Thanks for writing them up. :-D Cheers, Greg On Jan 4, 2010, at 3:12 AM, Bulat Ziganshin wrote: > Hello Patrick, > > Monday, January 4, 2010, 5:59:18 AM, you wr

Re[2]: [Haskell-cafe] Template Haskell - substitution in pattern in a lambda

2010-01-04 Thread Bulat Ziganshin
Hello Patrick, Monday, January 4, 2010, 5:59:18 AM, you wrote: > I'm guessing no such syntax exists? you are right. look at http://www.haskell.org/bz/th3.htm http://www.haskell.org/bz/thdoc.htm -- Best regards, Bulatmailto:bulat.zigans...@gmail.com __