From carter.schonwald at gmail.com Tue Jul 1 01:41:34 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Mon, 30 Jun 2014 21:41:34 -0400 Subject: [Haskell-cafe] Haskell Wiki user account creation In-Reply-To: References: Message-ID: Let's ask relrod et all on the infrastructure irc channel? On Monday, June 30, 2014, Thomas Schilling wrote: > Yeah, that's me. > > I asked on this list to set up a shared mail queue that goes into > phabricator (or some other ticketing system), but I didn't get any > actionable reply. > > On 30 June 2014 17:38, Carter Schonwald > wrote: > > did you try doing that? :) > > > > > > On Mon, Jun 30, 2014 at 11:33 AM, Haitham Gad > wrote: > >> > >> Hi, > >> > >> I read the following note at the log-in page of haskell wiki: > >> > >> NOTE: Automatic wiki account creation has been disabled. If you would > like > >> an account please email "nominolo" (at the email service from Google) > or on > >> the haskell-cafe mailing list. > >> > >> Does anyone know the exact email address I should be sending to (is it > >> nominolo at gmail.com )? > >> > >> Thanks, > >> Haitham > >> > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve.trout at gmail.com Tue Jul 1 03:17:09 2014 From: steve.trout at gmail.com (Steve Trout) Date: Mon, 30 Jun 2014 22:17:09 -0500 Subject: [Haskell-cafe] Algorithm for labeling same-colored regions in a 2D array? Message-ID: (Apparently joining the list through the Google Groups interface doesn't work, but the post still shows up there. Sorry if you see this twice!) For fun, I'm writing a rules engine for the board game Go (in Haskell obviously). I have a board, which is a grid of spaces that can contain a black piece, a white piece, or nothing. Part of what i need to do is to detect regions of the same "color" (black, white, or empty) and get information about them like their size, the color of the bordering spaces, etc. Regions are bounded by other colors or the board edges in cardinal directions. I'm just starting on this so I haven't picked my data structures yet, but Vector (Vector _) or Map (Int, Int) _ are what I've toyed with. I have a vague idea of how I would go about this in an imperative language with mutation. I'd iterate over the board, keeping lists of points contained in the same region, combining (relabeling) regions if they happen to connect later on. (I realize there are probably better algorithms in those languages, but that would be my first attempt.) I know i could cobble something like this together in the State monad, but I have a feeling that there ought to be a better (more "Haskellish"/pure-functional) way. What would a Haskellish algorithm for this kind of thing look like? I wouldn't mind a complete answer or just a nudge in the right direction. Thanks, -Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Tue Jul 1 03:23:50 2014 From: bob at redivi.com (Bob Ippolito) Date: Mon, 30 Jun 2014 20:23:50 -0700 Subject: [Haskell-cafe] Algorithm for labeling same-colored regions in a 2D array? In-Reply-To: References: Message-ID: I've done this before with a data structure inspired by Union-Find https://github.com/etrepum/exercism-exercises/blob/master/haskell/go-counting/Counting.hs On Mon, Jun 30, 2014 at 8:17 PM, Steve Trout wrote: > (Apparently joining the list through the Google Groups interface doesn't > work, but the post still shows up there. Sorry if you see this twice!) > > For fun, I'm writing a rules engine for the board game Go (in Haskell > obviously). I have a board, which is a grid of spaces that can contain a > black piece, a white piece, or nothing. Part of what i need to do is to > detect regions of the same "color" (black, white, or empty) and get > information about them like their size, the color of the bordering spaces, > etc. Regions are bounded by other colors or the board edges in cardinal > directions. I'm just starting on this so I haven't picked my data > structures yet, but Vector (Vector _) or Map (Int, Int) _ are what I've > toyed with. > > I have a vague idea of how I would go about this in an imperative language > with mutation. I'd iterate over the board, keeping lists of points > contained in the same region, combining (relabeling) regions if they happen > to connect later on. (I realize there are probably better algorithms in > those languages, but that would be my first attempt.) I know i could cobble > something like this together in the State monad, but I have a feeling that > there ought to be a better (more "Haskellish"/pure-functional) way. > > What would a Haskellish algorithm for this kind of thing look like? I > wouldn't mind a complete answer or just a nudge in the right direction. > > Thanks, > -Steve > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bog at khumba.net Tue Jul 1 06:31:40 2014 From: bog at khumba.net (Bryan Gardiner) Date: Mon, 30 Jun 2014 23:31:40 -0700 Subject: [Haskell-cafe] Algorithm for labeling same-colored regions in a 2D array? In-Reply-To: References: Message-ID: <20140630233140.248a2457@khumba.net> Good to see other Go projects here. I'm currently just taking the easy route and using bucket fill to compute groups and their liberties. So far I'm just dealing with playing individual moves, and it runs acceptably for that; no scoring or boards large enough for this to matter yet. I'll probably switch to something like union-find eventually. That's a better idea and it sounds like you want something with good asymptotic performance, anyway. computeGroup here: http://khumba.net/git/?p=goatee.git;a=blob;f=src/Khumba/Goatee/Sgf/Board.hs;hb=HEAD Cheers, Bryan On Mon, 30 Jun 2014 20:23:50 -0700 Bob Ippolito wrote: > I've done this before with a data structure inspired by Union-Find > https://github.com/etrepum/exercism-exercises/blob/master/haskell/go-counting/Counting.hs > > > On Mon, Jun 30, 2014 at 8:17 PM, Steve Trout wrote: > > > (Apparently joining the list through the Google Groups interface doesn't > > work, but the post still shows up there. Sorry if you see this twice!) > > > > For fun, I'm writing a rules engine for the board game Go (in Haskell > > obviously). I have a board, which is a grid of spaces that can contain a > > black piece, a white piece, or nothing. Part of what i need to do is to > > detect regions of the same "color" (black, white, or empty) and get > > information about them like their size, the color of the bordering spaces, > > etc. Regions are bounded by other colors or the board edges in cardinal > > directions. I'm just starting on this so I haven't picked my data > > structures yet, but Vector (Vector _) or Map (Int, Int) _ are what I've > > toyed with. > > > > I have a vague idea of how I would go about this in an imperative language > > with mutation. I'd iterate over the board, keeping lists of points > > contained in the same region, combining (relabeling) regions if they happen > > to connect later on. (I realize there are probably better algorithms in > > those languages, but that would be my first attempt.) I know i could cobble > > something like this together in the State monad, but I have a feeling that > > there ought to be a better (more "Haskellish"/pure-functional) way. > > > > What would a Haskellish algorithm for this kind of thing look like? I > > wouldn't mind a complete answer or just a nudge in the right direction. > > > > Thanks, > > -Steve > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > -- Go game editor :: http://khumba.net/projects/goatee :: AGPL, Haskell I: [pulseaudio] main.c: Fresh high-resolution timers available! Bon appetit! From gale at sefer.org Tue Jul 1 12:18:17 2014 From: gale at sefer.org (Yitzchak Gale) Date: Tue, 1 Jul 2014 15:18:17 +0300 Subject: [Haskell-cafe] Need help - my haskell code is over 50 times slower than equivalent perl implementation In-Reply-To: References: <1403629522.3587.18.camel@chi.nicolast.be> <20140624171426.GQ1418@henry> Message-ID: Hi Kashyap, I'm responding only now because I just saw this thread on reddit. You wrote: > it is clear that String for IO is a bad idea - > I wonder if examples of String based readFile > etc for beginners is a good idea It's not always a bad idea. Especially for beginners. Conceptually, String is the simplest, and often the performance isn't so bad. For serious applications, though, you should use the text library. One thing you should never use for text is ByteString - that is for binary data, not text. Lazy IO is also OK in simple cases. But as you have seen, for real applications you need to be aware of its limitations. When there is interleaving of IO operations between multiple resources, the simplicity of lazy IO disappears very quickly. In those cases, you should consider alternative IO libraries, such as conduit and pipes. Regards, Yitz From hjgtuyl at chello.nl Tue Jul 1 13:57:10 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Tue, 01 Jul 2014 15:57:10 +0200 Subject: [Haskell-cafe] Haskell Wiki user account creation In-Reply-To: References: Message-ID: On Mon, 30 Jun 2014 17:33:36 +0200, Haitham Gad wrote: > Hi, > > I read the following note at the log-in page of haskell wiki: > > NOTE: Automatic wiki account creation has been disabled. If you would > like > an account please email "nominolo" (at the email service from Google) or > on > the haskell-cafe mailing list. > > Does anyone know the exact email address I should be sending to (is it > nominolo at gmail.com)? > > Thanks, > Haitham I can do that for you, which user name do you want to have? Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From nominolo at googlemail.com Tue Jul 1 14:11:56 2014 From: nominolo at googlemail.com (Thomas Schilling) Date: Tue, 1 Jul 2014 16:11:56 +0200 Subject: [Haskell-cafe] Haskell Wiki user account creation In-Reply-To: References: Message-ID: Sorry, I should have mentioned that. He contacted me directly, so this particular request has been handled. On 1 July 2014 15:57, Henk-Jan van Tuyl wrote: > On Mon, 30 Jun 2014 17:33:36 +0200, Haitham Gad > wrote: > >> Hi, >> >> I read the following note at the log-in page of haskell wiki: >> >> NOTE: Automatic wiki account creation has been disabled. If you would like >> an account please email "nominolo" (at the email service from Google) or >> on >> the haskell-cafe mailing list. >> >> Does anyone know the exact email address I should be sending to (is it >> nominolo at gmail.com)? >> >> Thanks, >> Haitham > > > > I can do that for you, which user name do you want to have? > > Regards, > Henk-Jan van Tuyl > > > -- > Folding at home > What if you could share your unused computer power to help find a cure? In > just 5 minutes you can join the world's biggest networked computer and get > us closer sooner. Watch the video. > http://folding.stanford.edu/ > > > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From haithamgad at gmail.com Tue Jul 1 14:38:53 2014 From: haithamgad at gmail.com (Haitham Gad) Date: Tue, 1 Jul 2014 10:38:53 -0400 Subject: [Haskell-cafe] Haskell Wiki user account creation In-Reply-To: References: Message-ID: Yes, I already got the account. Thanks! On Tue, Jul 1, 2014 at 10:11 AM, Thomas Schilling wrote: > Sorry, I should have mentioned that. He contacted me directly, so this > particular request has been handled. > > On 1 July 2014 15:57, Henk-Jan van Tuyl wrote: > > On Mon, 30 Jun 2014 17:33:36 +0200, Haitham Gad > > wrote: > > > >> Hi, > >> > >> I read the following note at the log-in page of haskell wiki: > >> > >> NOTE: Automatic wiki account creation has been disabled. If you would > like > >> an account please email "nominolo" (at the email service from Google) or > >> on > >> the haskell-cafe mailing list. > >> > >> Does anyone know the exact email address I should be sending to (is it > >> nominolo at gmail.com)? > >> > >> Thanks, > >> Haitham > > > > > > > > I can do that for you, which user name do you want to have? > > > > Regards, > > Henk-Jan van Tuyl > > > > > > -- > > Folding at home > > What if you could share your unused computer power to help find a cure? > In > > just 5 minutes you can join the world's biggest networked computer and > get > > us closer sooner. Watch the video. > > http://folding.stanford.edu/ > > > > > > http://Van.Tuyl.eu/ > > http://members.chello.nl/hjgtuyl/tourdemonad.html > > Haskell programming > > -- > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.g.larson at gmail.com Tue Jul 1 17:25:54 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Tue, 1 Jul 2014 13:25:54 -0400 Subject: [Haskell-cafe] use of -Werror Message-ID: Is there a consensus within the Haskell community on the use of -Werror in packages uploaded to Cabal? Most places where I've worked, building with -Werror has been considered a laudable ideal, but fixing all the old warnings in the codebase was too much work, so it wasn't done. I suppose -Werror could cause problems in heterogeneous build environments. -- Johan Larson -- Toronto, Canada -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Jul 1 17:30:11 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 1 Jul 2014 13:30:11 -0400 Subject: [Haskell-cafe] use of -Werror In-Reply-To: References: Message-ID: On Tue, Jul 1, 2014 at 1:25 PM, Johan Larson wrote: > Is there a consensus within the Haskell community on the use of -Werror in > packages uploaded to Cabal? > GHC's interpretation of Haskell, and the warnings it provides, change often enough that -Werror is generally a good way to lock a package to one or a small number of GHC releases. As such, last I heard Hackage complained if -Werror was found in a package's cabal file. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Tue Jul 1 17:34:25 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 1 Jul 2014 13:34:25 -0400 Subject: [Haskell-cafe] use of -Werror In-Reply-To: References: Message-ID: yeah, -Wall makes enough noise to have a good ROI What I do though, is enable Werror on my Travis Ci formulae. On Tue, Jul 1, 2014 at 1:30 PM, Brandon Allbery wrote: > > On Tue, Jul 1, 2014 at 1:25 PM, Johan Larson > wrote: > >> Is there a consensus within the Haskell community on the use of -Werror >> in packages uploaded to Cabal? >> > > GHC's interpretation of Haskell, and the warnings it provides, change > often enough that -Werror is generally a good way to lock a package to one > or a small number of GHC releases. As such, last I heard Hackage complained > if -Werror was found in a package's cabal file. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Tue Jul 1 18:12:25 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Tue, 1 Jul 2014 20:12:25 +0200 Subject: [Haskell-cafe] use of -Werror In-Reply-To: References: Message-ID: -Werror has unintended consequenses in a release. Say you are using transformers/mtl and you want to stay backwards compatible, you can't use Except since it's just in the new versions, but with -Werror you couldn't use Error since it would produce deprecation warnings. CPP isn't an option since that would change the implementation. I don't like the idea of disabling deprecation warninings since that setting has at least module level granularity, if other deprecations pop up I want to see those! By enabling -Werror you are turning a non breaking change (deprecation) into a breaking one and not even an upper bound of <= A.B.C.D would be safe since the number of components are arbitrary. The granularity of disabled warnings is part of the problem, it'd be really nice if you could disable deprecation warnings for specific identifiers, same with a lot of the other warnings. - Adam On Tue, Jul 1, 2014 at 7:34 PM, Carter Schonwald wrote: > yeah, -Wall makes enough noise to have a good ROI > > What I do though, is enable Werror on my Travis Ci formulae. > > > On Tue, Jul 1, 2014 at 1:30 PM, Brandon Allbery > wrote: > >> >> On Tue, Jul 1, 2014 at 1:25 PM, Johan Larson >> wrote: >> >>> Is there a consensus within the Haskell community on the use of -Werror >>> in packages uploaded to Cabal? >>> >> >> GHC's interpretation of Haskell, and the warnings it provides, change >> often enough that -Werror is generally a good way to lock a package to one >> or a small number of GHC releases. As such, last I heard Hackage complained >> if -Werror was found in a package's cabal file. >> >> -- >> brandon s allbery kf8nh sine nomine >> associates >> allbery.b at gmail.com >> ballbery at sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad >> http://sinenomine.net >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlists at pmade.com Tue Jul 1 18:23:22 2014 From: mlists at pmade.com (Peter Jones) Date: Tue, 01 Jul 2014 12:23:22 -0600 Subject: [Haskell-cafe] use of -Werror References: Message-ID: <87oax9x7j9.fsf@pmade.com> Johan Larson writes: > Is there a consensus within the Haskell community on the use of -Werror in > packages uploaded to Cabal? I like to hide -Werror behind a cabal flag: flag maintainer description: Enable settings for the package maintainer. default: False if flag(maintainer) ghc-options: -Werror -- Peter Jones, Founder, Devalot.com Defending the honor of good code From carter.schonwald at gmail.com Tue Jul 1 18:43:05 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 1 Jul 2014 14:43:05 -0400 Subject: [Haskell-cafe] use of -Werror In-Reply-To: <87oax9x7j9.fsf@pmade.com> References: <87oax9x7j9.fsf@pmade.com> Message-ID: @Peter you'll want to write flag maintainer description: Enable settings for the package maintainer. default: False manual: True note the Manual : True piece, you'll be creating a world of sad if cabal-install auto sets that to true by accident ! :) On Tue, Jul 1, 2014 at 2:23 PM, Peter Jones wrote: > Johan Larson writes: > > Is there a consensus within the Haskell community on the use of -Werror > in > > packages uploaded to Cabal? > > I like to hide -Werror behind a cabal flag: > > flag maintainer > description: Enable settings for the package maintainer. > default: False > > if flag(maintainer) > ghc-options: -Werror > > -- > Peter Jones, Founder, Devalot.com > Defending the honor of good code > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlists at pmade.com Tue Jul 1 19:06:06 2014 From: mlists at pmade.com (Peter Jones) Date: Tue, 01 Jul 2014 13:06:06 -0600 Subject: [Haskell-cafe] use of -Werror References: <87oax9x7j9.fsf@pmade.com> Message-ID: <87ha30yk4h.fsf@pmade.com> Carter Schonwald writes: > note the Manual : True piece, you'll be creating a world of sad if > cabal-install auto sets that to true by accident ! :) How would that happen? (Just curious.) -- Peter Jones, Founder, Devalot.com Defending the honor of good code From carter.schonwald at gmail.com Tue Jul 1 19:07:57 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 1 Jul 2014 15:07:57 -0400 Subject: [Haskell-cafe] use of -Werror In-Reply-To: <87ha30yk4h.fsf@pmade.com> References: <87oax9x7j9.fsf@pmade.com> <87ha30yk4h.fsf@pmade.com> Message-ID: every flag defaults to Manual: True I think and then when cabal is trying to find a good build plan it will twiddle flags! On Tue, Jul 1, 2014 at 3:06 PM, Peter Jones wrote: > Carter Schonwald writes: > > note the Manual : True piece, you'll be creating a world of sad if > > cabal-install auto sets that to true by accident ! :) > > How would that happen? (Just curious.) > > -- > Peter Jones, Founder, Devalot.com > Defending the honor of good code > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlists at pmade.com Tue Jul 1 19:09:45 2014 From: mlists at pmade.com (Peter Jones) Date: Tue, 01 Jul 2014 13:09:45 -0600 Subject: [Haskell-cafe] use of -Werror References: <87oax9x7j9.fsf@pmade.com> <87ha30yk4h.fsf@pmade.com> Message-ID: <87a98syjye.fsf@pmade.com> Carter Schonwald writes: > every flag defaults to Manual: True I think > and then when cabal is trying to find a good build plan it will twiddle > flags! Wow. Well, that's good to know. Thanks. -- Peter Jones, Founder, Devalot.com Defending the honor of good code From amit at amitlevy.com Tue Jul 1 19:46:48 2014 From: amit at amitlevy.com (Amit Aryeh Levy) Date: Tue, 01 Jul 2014 12:46:48 -0700 Subject: [Haskell-cafe] Declarative database migrations In-Reply-To: References: Message-ID: <53B31028.6030808@amitlevy.com> postgresql-orm has a very simple DSL and migration model modeled after active record's db migrations, as well as a utility, `pg_migrate`, for running migrations, rolling back migrations and creating boiler plate code for new migrations: http://hackage.haskell.org/package/postgresql-orm-0.3.0/docs/Database-PostgreSQL-Migrations.html -Amit On 06/29/2014 06:39 AM, Timur Amirov wrote: > Hello! > > Looking for tools to use discovered that I miss something like Rails > database migrations in haskell. > Is there a package for it (describe the whole schema and/or particular > migrations)? > > -- > Timur Amirov > Berlin, Germany > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From trebla at vex.net Tue Jul 1 20:57:40 2014 From: trebla at vex.net (Albert Y. C. Lai) Date: Tue, 01 Jul 2014 16:57:40 -0400 Subject: [Haskell-cafe] handling non-string command line arguments In-Reply-To: References: Message-ID: <53B320C4.7090602@vex.net> On 14-06-28 03:28 PM, Johan Larson wrote: > I've been looking at choices for parsing command line arguments, > including getOpt. The examples I can find focus on string arguments, > whereas I am interested in numbers. In the application at hand, it is > particularly important to issue clear error messages when arguments > don't parse as numbers or are out of range. My https://github.com/treblacy/random-read has an example of realistic arguments using optparse-applicative. It goes as far as random-read --prob=2/3 file1 file2 file3... The 2/3 there has to be a rational number between 0 and 1 in the syntax "numerator/denominator". If you give "234" or "abc", you get one error message. If you give "30/7", you get a different error message. From carter.schonwald at gmail.com Tue Jul 1 21:42:50 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 1 Jul 2014 17:42:50 -0400 Subject: [Haskell-cafe] use of -Werror In-Reply-To: <87a98syjye.fsf@pmade.com> References: <87oax9x7j9.fsf@pmade.com> <87ha30yk4h.fsf@pmade.com> <87a98syjye.fsf@pmade.com> Message-ID: I meant defaults to manual : false, But you get the idea. (I could be wrong. But still worth being explicit in your cabal files so no need to remember what the default is) On Tuesday, July 1, 2014, Peter Jones wrote: > Carter Schonwald > writes: > > every flag defaults to Manual: True I think > > and then when cabal is trying to find a good build plan it will twiddle > > flags! > > Wow. Well, that's good to know. Thanks. > > -- > Peter Jones, Founder, Devalot.com > Defending the honor of good code > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Wed Jul 2 01:20:58 2014 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Wed, 2 Jul 2014 11:20:58 +1000 Subject: [Haskell-cafe] use of -Werror In-Reply-To: References: <87oax9x7j9.fsf@pmade.com> <87ha30yk4h.fsf@pmade.com> <87a98syjye.fsf@pmade.com> Message-ID: Why does cabal-install twiddle flags though? Surely if I say "default: False" that means "don't set this to True unless you actually want it". Having an extra "Manual" field seems like duplication. On 2 July 2014 07:42, Carter Schonwald wrote: > I meant defaults to manual : false, > But you get the idea. > (I could be wrong. But still worth being explicit in your cabal files so no > need to remember what the default is) > > > On Tuesday, July 1, 2014, Peter Jones wrote: >> >> Carter Schonwald writes: >> > every flag defaults to Manual: True I think >> > and then when cabal is trying to find a good build plan it will twiddle >> > flags! >> >> Wow. Well, that's good to know. Thanks. >> >> -- >> Peter Jones, Founder, Devalot.com >> Defending the honor of good code >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From allbery.b at gmail.com Wed Jul 2 01:26:03 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 1 Jul 2014 21:26:03 -0400 Subject: [Haskell-cafe] use of -Werror In-Reply-To: References: <87oax9x7j9.fsf@pmade.com> <87ha30yk4h.fsf@pmade.com> <87a98syjye.fsf@pmade.com> Message-ID: On Tue, Jul 1, 2014 at 9:20 PM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > Why does cabal-install twiddle flags though? > > Surely if I say "default: False" that means "don't set this to True > unless you actually want it". Having an extra "Manual" field seems > like duplication. > Not exactly. You use it to specify which alternative to try first; and the reason it's trying alternatives is so that it can adapt to different platforms: dependency versions (e.g. the old split-base flag), Unix vs. Windows, etc. Controlling which one is tried first may be necessary to ensure it doesn't accidentally match something that appears to work but is less correct or appropriate than the alternative. For example, using an older library setup may work in installations that have both old and new libraries, but trying the new one first is likely to have e.g. performance or compatibility benefits. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From ganesh at earth.li Wed Jul 2 05:44:42 2014 From: ganesh at earth.li (Ganesh Sittampalam) Date: Wed, 02 Jul 2014 06:44:42 +0100 Subject: [Haskell-cafe] use of -Werror In-Reply-To: <87oax9x7j9.fsf@pmade.com> References: <87oax9x7j9.fsf@pmade.com> Message-ID: <53B39C4A.5050006@earth.li> On 01/07/2014 19:23, Peter Jones wrote: > Johan Larson writes: >> Is there a consensus within the Haskell community on the use of -Werror in >> packages uploaded to Cabal? > > I like to hide -Werror behind a cabal flag: > > flag maintainer > description: Enable settings for the package maintainer. > default: False > > if flag(maintainer) > ghc-options: -Werror I do this too (with the Manual flag), but one problem is it makes 'cabal check' complain even with the conditional: https://github.com/haskell/cabal/issues/1775 There's the cabal.config option mentioned in that issue but it's less discoverable. Ganesh From renick at gmail.com Wed Jul 2 11:58:18 2014 From: renick at gmail.com (Renick Bell) Date: Wed, 2 Jul 2014 20:58:18 +0900 Subject: [Haskell-cafe] haskell in several upcoming live performances in the UK Message-ID: Hello everyone. I hope the Haskell Cafe will tolerate this musical interruption. I suppose it's not so often that you can hear two different performers use Haskell in their performances in one concert, but if you live in the UK you have several opportunities to do so in the next few days. Both Alex McLean and I will be playing at Algorave NIME on Thursday night in London at Corsica Studios. The event starts at 21:00. Alex will be playing in the duo Canute with Matthew Yee-King, and I will be playing a solo set. http://www.nime2014.org/public-events/concerts-and-installations/ After that, it's the UK algorave tour, with stops in Brighton (07/04), Sheffield (07/06), Leeds (07/07), Manchester (07/08), and York (07/09): http://algorave.com/ Both Alex and I will perform in Sheffield and Manchester. I will be playing all of the above dates. See Alex fling Haskell in Emacs and me in vim, tmux, and xmonad! If you haven't heard Alex's music recently, he did a great track the other day: https://soundcloud.com/yaxu/at-last There's this set he did in Antwerp in May: https://www.youtube.com/watch?v=fgRDKxkHCSw My sets are likely to resemble this one that I did last Friday in Portugal: https://soundcloud.com/renick/live-at-xcoax-2014-porto-portugal-june-27-2014 Or this one from the Linux Audio Conference in May: https://soundcloud.com/renick/live-at-the-linux-audio-conference-2014-karlsruhe-germany-may-5th-2014 If you come to one of the performances, please come up and say hello. I really want to meet the UK Haskell crew! Hope to see you there, dancing to Haskell or just relaxing and enjoying the music. Best, Renick -- Renick Bell - http://renickbell.net - http://twitter.com/renick - http://the3rd2nd.com From leza.ml at fecrd.cujae.edu.cu Wed Jul 2 19:52:52 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Wed, 02 Jul 2014 15:52:52 -0400 Subject: [Haskell-cafe] Problem with type in a function Message-ID: <53B46314.5040208@fecrd.cujae.edu.cu> Hi, I have the following function plotf :: Ploteable a => ([a] -> IO ()) -> (a -> a) -> [a] -> IO () plotf plot fn xs = plot $ map fn xs that compiles correctly, but when I use it with: plotf win sin [1..100::Double] -- where win :: [Double] -> IO () I'm geting the error: No instance for (Ploteable Double) arising from a use of ?plotf? In the expression: plotf win sin [1 .. 100 :: Double] In an equation for ?it?: it = plotf win sin [1 .. 100 :: Double] What am I missing? Thanks! 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From miguelimo38 at yandex.ru Wed Jul 2 20:07:19 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Thu, 3 Jul 2014 00:07:19 +0400 Subject: [Haskell-cafe] Problem with type in a function In-Reply-To: <53B46314.5040208@fecrd.cujae.edu.cu> References: <53B46314.5040208@fecrd.cujae.edu.cu> Message-ID: <70391291-1C0F-4260-8286-D173DE6B3F12@yandex.ru> Exactly what it is telling you you're missing. You said "plotf applies to any type 'a' if it's of class Ploteable". Then you try to use it with a=Double. So, it doesn't see how Double is of class Ploteable. On 02 Jul 2014, at 23:52, Leza Morais Lutonda wrote: > > Hi, > > I have the following function > > plotf :: Ploteable a => ([a] -> IO ()) -> (a -> a) -> [a] -> IO () > plotf plot fn xs = plot $ map fn xs > > that compiles correctly, but when I use it with: > > plotf win sin [1..100::Double] -- where win :: [Double] -> IO () > > I'm geting the error: > No instance for (Ploteable Double) arising from a use of ?plotf? > In the expression: plotf win sin [1 .. 100 :: Double] > In an equation for ?it?: it = plotf win sin [1 .. 100 :: Double] > > What am I missing? > > Thanks! > > > > 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From leza.ml at fecrd.cujae.edu.cu Wed Jul 2 20:13:51 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Wed, 02 Jul 2014 16:13:51 -0400 Subject: [Haskell-cafe] Problem with type in a function In-Reply-To: <70391291-1C0F-4260-8286-D173DE6B3F12@yandex.ru> References: <53B46314.5040208@fecrd.cujae.edu.cu> <70391291-1C0F-4260-8286-D173DE6B3F12@yandex.ru> Message-ID: <53B467FF.6070408@fecrd.cujae.edu.cu> OK. I got it. I was just confused about Double being instance of Ploteable when I have [Double] as an instance. I'm sorry. On 02/07/14 16:07, MigMit wrote: > Exactly what it is telling you you're missing. You said "plotf applies to any type 'a' if it's of class Ploteable". Then you try to use it with a=Double. So, it doesn't see how Double is of class Ploteable. > > On 02 Jul 2014, at 23:52, Leza Morais Lutonda wrote: > >> Hi, >> >> I have the following function >> >> plotf :: Ploteable a => ([a] -> IO ()) -> (a -> a) -> [a] -> IO () >> plotf plot fn xs = plot $ map fn xs >> >> that compiles correctly, but when I use it with: >> >> plotf win sin [1..100::Double] -- where win :: [Double] -> IO () >> >> I'm geting the error: >> No instance for (Ploteable Double) arising from a use of ?plotf? >> In the expression: plotf win sin [1 .. 100 :: Double] >> In an equation for ?it?: it = plotf win sin [1 .. 100 :: Double] >> >> What am I missing? >> >> Thanks! >> >> >> >> 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > -- *Leza Morais Lutonda, Lemol-C* /Electronic and Telecomunicaction Eng./ /Software Development and Architecture Entusiast/ http://lemol.github.io @lemolsoft in twitter 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Wed Jul 2 20:14:12 2014 From: chrisdone at gmail.com (Christopher Done) Date: Wed, 2 Jul 2014 13:14:12 -0700 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo Message-ID: The Haskell 2010 report is here: http://darcs.haskell.org/haskell2010-report Also mirrored in git here: git at github.com:hvr/haskell2010-report.git This version doesn't build because it uses old "Char" instead of "Data.Char"-style imports. So my version here: https://github.com/chrisdone/haskell2010-report Fixes that: https://github.com/chrisdone/haskell2010-report/commit/6a773abb7201f4854ba5173227da28bf868747e5 But that's as far as I get. Here is what happens when I run $ cd tools; make; cd .. $ cd report; make I get: http://lpaste.net/raw/5699097250156773376 As is typical in the LaTeX, a torrent of uninteresting information is spewed out. Finally, at the end, it says: > (./haskell.ind (./index-intro.tex) > ! Argument of \OT1\" has an extra }. > > \par > l.61 \item |hyperindexformat{\"} > , 51, 73, 107, 112 > ? Does anyone familiar with the language of LaTeX have any idea what's going on? Has anyone successfully been able to build it? If so, please state the exact steps to do so and I will be very grateful. Ciao! From alois.cochard at gmail.com Wed Jul 2 20:17:08 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Wed, 2 Jul 2014 21:17:08 +0100 Subject: [Haskell-cafe] How to deal with dependency bounds for an application Message-ID: Hey, I have wrote a little tool and some people had issues installing it with cabal and had to use "--reorder-goals" to be able to install it [1]. Obviously it's because I have very few dependency bounds (actually near none aside base). I don't have to be convince that it's a bad idea, the motivation for adding bounds are pretty clear... but... I'm not sure how to define them? Should I know what is the lowest possible combination of my dependencies who would compile... because if I'm too strict it might be difficult for some user to install? or maybe I should target as lowest what is in current haskell-platform? I'm looking for some advice and feedback from maintainers. Thanks in advance! [1]: https://github.com/aloiscochard/codex/issues/6 -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From doaitse at swierstra.net Wed Jul 2 21:58:05 2014 From: doaitse at swierstra.net (S. Doaitse Swierstra) Date: Wed, 2 Jul 2014 23:58:05 +0200 Subject: [Haskell-cafe] handling non-string command line arguments In-Reply-To: References: Message-ID: <16995AF7-BC68-4AFC-A34D-C25850431046@swierstra.net> You can use http://hackage.haskell.org/package/uu-options, designed to parser command line options. It even allows for combining various elements on the command line into a single option field. See the second half of the paper mentioned on hackage for examples of its use. Since the parsers make use of uu-parsinglib the user gets "autocorrection" and nice error messages for free. Doaitse On 28 Jun 2014, at 21:28 , Johan Larson wrote: > I've been looking at choices for parsing command line arguments, including getOpt. The examples I can find focus on string arguments, whereas I am interested in numbers. In the application at hand, it is particularly important to issue clear error messages when arguments don't parse as numbers or are out of range. > > I could use getOpt as a first pass with string arguments and then turn the strings into validated numbers in a second pass, but that's a bit awkward. Alternately I could use the options records with Options -> IO Options functions. But both of these solutions treat type mismatches differently from other options errors. > > Has anyone found a cleaner solution? > > -- > Johan Larson -- Toronto, Canada > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From djsamperi at gmail.com Wed Jul 2 23:31:55 2014 From: djsamperi at gmail.com (Dominick Samperi) Date: Wed, 2 Jul 2014 19:31:55 -0400 Subject: [Haskell-cafe] GLUT under Windows using ghc 7.8.2? Message-ID: It appears that The Haskell Platform includes libglut32.a and other important libs, so it is self-contained, provided users can work with the version of ghc that is provided: currently 7.6.3 under Windows. In particular, 'cabal install glut' works fine with the default version of ghc. But if I try using ghc-7.8.2 I get: Configuring GLUT-2.5.1.1... cabal: Missing dependencies on a foreign library: * Missing C library: glut32 ... All of the following do not change the result: 1. Adding --extra-lib-dirs=c:\glut-3.7.6-bin to the command line. 2. Using freeglut instead of glut 3. Copying libglut.a from The Haskell Package mingw/lib directory to c:\ghc-3.8.2\mingw\lib (dangerous because I am mixing architectures here). How does cabal decide that the C library glut32 is missing? Where is it looking? Why doesn't it look in the places I specify? Thanks, Dominick From djsamperi at gmail.com Thu Jul 3 00:29:07 2014 From: djsamperi at gmail.com (Dominick Samperi) Date: Wed, 2 Jul 2014 20:29:07 -0400 Subject: [Haskell-cafe] GLUT under Windows using ghc 7.8.2? In-Reply-To: References: Message-ID: Answer: The Haskell Platform ships with a 32bit version of ghc, and this explains why glut32 is used. I tried to use 64bit ghc-7.8.2 with the same glut library, and got the message "Missing C library glut32". There is no problem using 32bit ghc-7.8.2 (with the --extra-lib-dirs option). The error message is misleading though... On Wed, Jul 2, 2014 at 7:31 PM, Dominick Samperi wrote: > It appears that The Haskell Platform includes libglut32.a and other > important libs, so it is self-contained, provided users can work with > the version of ghc that is provided: currently 7.6.3 under Windows. > > In particular, 'cabal install glut' works fine with the default version > of ghc. But if I try using ghc-7.8.2 I get: > Configuring GLUT-2.5.1.1... > cabal: Missing dependencies on a foreign library: > * Missing C library: glut32 > ... > > All of the following do not change the result: > 1. Adding --extra-lib-dirs=c:\glut-3.7.6-bin to the command line. > 2. Using freeglut instead of glut > 3. Copying libglut.a from The Haskell Package mingw/lib directory to > c:\ghc-3.8.2\mingw\lib (dangerous because I am mixing > architectures here). > > How does cabal decide that the C library glut32 is missing? Where > is it looking? Why doesn't it look in the places I specify? > > Thanks, > Dominick From ok at cs.otago.ac.nz Thu Jul 3 01:46:17 2014 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Thu, 3 Jul 2014 13:46:17 +1200 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo In-Reply-To: References: Message-ID: <91458495-54DB-40A9-AF49-13E5C0428593@cs.otago.ac.nz> On 3/07/2014, at 8:14 AM, Christopher Done wrote: >> (./haskell.ind (./index-intro.tex) >> ! Argument of \OT1\" has an extra }. >> >> \par >> l.61 \item |hyperindexformat{\"} >> , 51, 73, 107, 112 >> ? > > Does anyone familiar with the language of LaTeX have any idea what's > going on? The \" command in TeX says "You see the next item? Put a diaeresis over it." So it is expecting a plain character, or possibly a command naming a character. But } is an "active" character with a special meaning. The most likely explanation here is that \" should *really* be \textquotedbl. Apparently someone thought \" in TeX was like \" in a C string, but it never has been. If you can change that line from \item |hyperindexformat{\"}.... to \item |hyperindexformat{\textquotdbl}.... the problem *might* go away. From dstcruz at gmail.com Thu Jul 3 05:59:23 2014 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 2 Jul 2014 23:59:23 -0600 Subject: [Haskell-cafe] Haskell Weekly News: Issue 298 Message-ID: Welcome to issue 298 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from June 15 to 28, 2014 Quotes of the Week * Kinnison * imagines a radio station playing only things like 'Life tru a Lens', stuff by 'Dire States' or 'Monadonna' Top Reddit Stories * Today I published an introductory book on Haskell Data Analysis Domain: haskelldata.com, Score: 99, Comments: 26 Original: [1] http://goo.gl/R2kRFu On Reddit: [2] http://goo.gl/Ka0oP5 * Backpack: An ML-like module system for Haskell Domain: plv.mpi-sws.org, Score: 76, Comments: 44 Original: [3] http://goo.gl/7Zkxbg On Reddit: [4] http://goo.gl/78H37f * Cgrep, a context-aware grep for source code. Domain: awgn.github.io, Score: 67, Comments: 13 Original: [5] http://goo.gl/q1VdEA On Reddit: [6] http://goo.gl/2NNTrO * Teenage Haskell Domain: twdkz.wordpress.com, Score: 63, Comments: 7 Original: [7] http://goo.gl/cvJ0ap On Reddit: [8] http://goo.gl/aISHlG * GHC 7.10 gains -XBinaryLiterals language syntax extensions Domain: github.com, Score: 63, Comments: 14 Original: [9] http://goo.gl/qfWvAg On Reddit: [10] http://goo.gl/NOVgme * Haskelier - Haskell for the Advanced Layman Domain: haskelier.tumblr.com, Score: 59, Comments: 26 Original: [11] http://goo.gl/pLsRB1 On Reddit: [12] http://goo.gl/5HBSWD * Barely Functional: Writing a Real Program in Haskell Domain: ben.kirw.in, Score: 57, Comments: 36 Original: [13] http://goo.gl/4yWLuL On Reddit: [14] http://goo.gl/B1LX8f * hmatrix 0.16 now BSD3 and with static dimension checking Domain: github.com, Score: 51, Comments: 10 Original: [15] http://goo.gl/C5zKzk On Reddit: [16] http://goo.gl/A94AkD * Formatting: type-safe printf-like library by chrisdone Domain: hackage.haskell.org, Score: 51, Comments: 24 Original: [17] http://goo.gl/DHM0Yn On Reddit: [18] http://goo.gl/zUQN02 * Haskell 2014 accepted papers, with links (pull requests welcome) Domain: github.com, Score: 50, Comments: 5 Original: [19] http://goo.gl/B2f434 On Reddit: [20] http://goo.gl/XSmJGo * Real World Haskell - Outdated Parts? Domain: self.haskell, Score: 50, Comments: 12 Original: [21] http://goo.gl/5YhIOT On Reddit: [22] http://goo.gl/5YhIOT * I'm trying my hardest to learn this language and only get more and more discouraged. Domain: self.haskell, Score: 48, Comments: 111 Original: [23] http://goo.gl/9vuPBe On Reddit: [24] http://goo.gl/9vuPBe * Using f-algebras to produce a statically typed functional programming language Domain: burz.github.io, Score: 47, Comments: 19 Original: [25] http://goo.gl/9YCz4k On Reddit: [26] http://goo.gl/DvWBPS * 'ghc-make' released Domain: neilmitchell.blogspot.de, Score: 47, Comments: 19 Original: [27] http://goo.gl/JlMS1a On Reddit: [28] http://goo.gl/kO2FQP * A simple alternative to De Bruijn indexing, from ICFP 2013 Domain: pchiusano.io, Score: 46, Comments: 24 Original: [29] http://goo.gl/7PBIM2 On Reddit: [30] http://goo.gl/PGmQ6W * Haskoin: A Haskell implementation of the Bitcoin protocol. Domain: github.com, Score: 44, Comments: 0 Original: [31] http://goo.gl/n0eCEI On Reddit: [32] http://goo.gl/bvsE24 * What is the state of "The JavaScript Problem"? What is the currently preferred way to solve in a real world application? Domain: self.haskell, Score: 42, Comments: 55 Original: [33] http://goo.gl/dIww4i On Reddit: [34] http://goo.gl/dIww4i * ANNOUNCE: STM-Containers. A hash map and hash set for STM Domain: hackage.haskell.org, Score: 41, Comments: 13 Original: [35] http://goo.gl/6nuWAc On Reddit: [36] http://goo.gl/rAzIYr Top StackOverflow Questions * Why does flooring infinity does not throw some error? votes: 14, answers: 1 Read on SO: [37] http://goo.gl/f7gUB8 * How long can the name of a type constructor be? votes: 12, answers: 1 Read on SO: [38] http://goo.gl/mGiblp * Difference between $ and () votes: 11, answers: 5 Read on SO: [39] http://goo.gl/lTB24e * Need advice on optimising Haskell data processing votes: 11, answers: 3 Read on SO: [40] http://goo.gl/NnEqgn * Reconciling lens usage with database access votes: 11, answers: 1 Read on SO: [41] http://goo.gl/Zczjjf * Why constraints on data are a bad thing? votes: 11, answers: 3 Read on SO: [42] http://goo.gl/l0WXtP * Can I use template haskell to define missing functions? votes: 10, answers: 2 Read on SO: [43] http://goo.gl/AFFS2T * Is there a reason we can't populate types with DataKinds? votes: 10, answers: 2 Read on SO: [44] http://goo.gl/1gpZej * Why is a built-in function applied to too few arguments considered to be in weak head normal form? votes: 10, answers: 2 Read on SO: [45] http://goo.gl/6iFG8a Until next time, [46]+Daniel Santa Cruz References 1. http://haskelldata.com/ 2. http://www.reddit.com/r/haskell/comments/296l80/today_i_published_an_introductory_book_on_haskell/ 3. http://plv.mpi-sws.org/backpack/ 4. http://www.reddit.com/r/haskell/comments/28v6c9/backpack_an_mllike_module_system_for_haskell/ 5. http://awgn.github.io/cgrep/ 6. http://www.reddit.com/r/haskell/comments/28moo0/cgrep_a_contextaware_grep_for_source_code/ 7. http://twdkz.wordpress.com/2014/06/26/teenage-haskell/ 8. http://www.reddit.com/r/haskell/comments/29abyz/teenage_haskell/ 9. https://github.com/ghc/ghc/commit/1c0b5fdc9f2b6ea8166cc565383d4cd20432343c 10. http://www.reddit.com/r/haskell/comments/29b2jj/ghc_710_gains_xbinaryliterals_language_syntax/ 11. http://haskelier.tumblr.com/ 12. http://www.reddit.com/r/haskell/comments/28d7ma/haskelier_haskell_for_the_advanced_layman/ 13. http://ben.kirw.in/2014/06/24/barely-functional-1-rlp/ 14. http://www.reddit.com/r/haskell/comments/28zwoc/barely_functional_writing_a_real_program_in/ 15. https://github.com/albertoruiz/hmatrix 16. http://www.reddit.com/r/haskell/comments/28peug/hmatrix_016_now_bsd3_and_with_static_dimension/ 17. http://hackage.haskell.org/package/formatting 18. http://www.reddit.com/r/haskell/comments/291wel/formatting_typesafe_printflike_library_by/ 19. https://github.com/yallop/haskell2014-papers 20. http://www.reddit.com/r/haskell/comments/28yu1f/haskell_2014_accepted_papers_with_links_pull/ 21. http://www.reddit.com/r/haskell/comments/2938yb/real_world_haskell_outdated_parts/ 22. http://www.reddit.com/r/haskell/comments/2938yb/real_world_haskell_outdated_parts/ 23. http://www.reddit.com/r/haskell/comments/288egd/im_trying_my_hardest_to_learn_this_language_and/ 24. http://www.reddit.com/r/haskell/comments/288egd/im_trying_my_hardest_to_learn_this_language_and/ 25. http://burz.github.io/2014/06/15/feval.html 26. http://www.reddit.com/r/haskell/comments/28rbwr/using_falgebras_to_produce_a_statically_typed/ 27. http://neilmitchell.blogspot.de/2014/06/announcing-ghc-make.html 28. http://www.reddit.com/r/haskell/comments/28tttf/ghcmake_released/ 29. http://pchiusano.io/2014-06-20/simple-debruijn-alternative.html 30. http://www.reddit.com/r/haskell/comments/28vfd0/a_simple_alternative_to_de_bruijn_indexing_from/ 31. https://github.com/haskoin/haskoin 32. http://www.reddit.com/r/haskell/comments/28y454/haskoin_a_haskell_implementation_of_the_bitcoin/ 33. http://www.reddit.com/r/haskell/comments/28o7my/what_is_the_state_of_the_javascript_problem_what/ 34. http://www.reddit.com/r/haskell/comments/28o7my/what_is_the_state_of_the_javascript_problem_what/ 35. http://hackage.haskell.org/package/stm-containers 36. http://www.reddit.com/r/haskell/comments/295lbr/announce_stmcontainers_a_hash_map_and_hash_set/ 37. http://stackoverflow.com/questions/24338673/why-does-flooring-infinity-does-not-throw-some-error 38. http://stackoverflow.com/questions/24335869/how-long-can-the-name-of-a-type-constructor-be 39. http://stackoverflow.com/questions/24271129/difference-between-and 40. http://stackoverflow.com/questions/24278006/need-advice-on-optimising-haskell-data-processing 41. http://stackoverflow.com/questions/24462070/reconciling-lens-usage-with-database-access 42. http://stackoverflow.com/questions/24465586/why-constraints-on-data-are-a-bad-thing 43. http://stackoverflow.com/questions/24233346/can-i-use-template-haskell-to-define-missing-functions 44. http://stackoverflow.com/questions/24439618/is-there-a-reason-we-cant-populate-types-with-datakinds 45. http://stackoverflow.com/questions/24447324/why-is-a-built-in-function-applied-to-too-few-arguments-considered-to-be-in-weak 46. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.trstenjak at gmail.com Thu Jul 3 06:20:07 2014 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Thu, 3 Jul 2014 08:20:07 +0200 Subject: [Haskell-cafe] How to deal with dependency bounds for an application In-Reply-To: References: Message-ID: <20140703062007.GA2440@machine> Hi Alois, > Should I know what is the lowest possible combination of my dependencies who > would compile... because if I'm too strict it might be difficult for some user > to install? or maybe I should target as lowest what is in current > haskell-platform? Yes, looking at the last two haskell platforms might be a good pragmatical choice. I even like the idea that much that I might add a feature to my own dependency handling tool cabal-bounds[1]: cabal-bounds update --lower --haskel-platform=2012.4.0.0 ... I think that getting the lower dependencies "right" is more an issue for libraries, because in the case of applications a cabal sandbox can avoid most of the possible problems. Greetings, Daniel [1] https://github.com/dan-t/cabal-bounds From timur.deteam at gmail.com Thu Jul 3 06:57:32 2014 From: timur.deteam at gmail.com (Timur Amirov) Date: Thu, 3 Jul 2014 08:57:32 +0200 Subject: [Haskell-cafe] Declarative database migrations In-Reply-To: <53B31028.6030808@amitlevy.com> References: <53B31028.6030808@amitlevy.com> Message-ID: Thanks for the list! I?ll have a look. To be honest, I was trying to avoid Persist for now in favour of postgresql-simple when it comes to using db. The only concern was about migration lib. --? Timur Amirov Berlin, Germany On 1 Jul 2014 at 21:47:13, Amit Aryeh Levy (amit at amitlevy.com) wrote: postgresql-orm has a very simple DSL and migration model modeled after active record's db migrations, as well as a utility, `pg_migrate`, for running migrations, rolling back migrations and creating boiler plate code for new migrations: http://hackage.haskell.org/package/postgresql-orm-0.3.0/docs/Database-PostgreSQL-Migrations.html -Amit On 06/29/2014 06:39 AM, Timur Amirov wrote: Hello! Looking for tools to use discovered ?that I miss something like Rails database migrations in haskell. Is there a package for it (describe the whole schema and/or particular migrations)? --? Timur Amirov Berlin, Germany _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander at plaimi.net Thu Jul 3 13:33:23 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 03 Jul 2014 15:33:23 +0200 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia Message-ID: <53B55BA3.1030305@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 The proposal is simply as follows. 1. Make a list, haskell-jobs. This would be primarily for job postings and looking-for-job posts. A secondary purpose is discussing jobs. E.g. "Anyone know any jobs in the Foo area?", and meta-discussions like "How well does Haskell jobs pay in your experience?". 2. Make a list, haskell-academia. This would be primarily for studentship postings and call for papers. A secondary purpose is discussing academia. E.g. "Anyone know any unis that use Haskell extensively in the Foo area?", and meta-discussions like "How well is Haskell taught at unis in your experience?" The motivation for this is twofold. 1. We get a lot of job postings and studentship postings. Many of these will be ignored by readers, up until they suddenly find themselves looking for a job or studentship. It would be useful if they could then easily filter their email on lists -- or go to the online archives for that specific list. The latter is a big Win, because they needn't even be subscribed in the first place. 2. Job/studentship postings are effectively spam, unless you are actually looking for that kind of information. This proposal will reduce the amount of spam people get. That's always nice. Two weeks should be a satisfactory discussion period. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlO1W6MACgkQRtClrXBQc7Vu1wD/YSAY6AwqzBR74y7zF7OXjaHv 1PwRWglP/hIMOKeI5pAA/iIfvderfxrVLuVwG37ldQ3ar9Xb6+WG1zPfW3vW/PRv =zNvy -----END PGP SIGNATURE----- From hesselink at gmail.com Thu Jul 3 13:55:20 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Thu, 3 Jul 2014 15:55:20 +0200 Subject: [Haskell-cafe] Restarting doc build on hackage Message-ID: Hi cafe, Does anyone know if there is a way to restart a documentation build on hackage? We have a package where the documentation failed to build due to a dependency lacking upper bounds. That has recently been fixed (using the new in-place cabal file editing feature), and we'd like to get documentation for our package now. Is there any way to do this (apart from uploading a new version without changes)? Erik From roma at ro-che.info Thu Jul 3 14:25:24 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 3 Jul 2014 10:25:24 -0400 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <53B55BA3.1030305@plaimi.net> References: <53B55BA3.1030305@plaimi.net> Message-ID: <20140703142524.GA31796@sniper> -1. I doubt all the people who are interested will subscribe to these lists. Thus people will have to cross-post to those list and haskell-cafe, just like it's happening with haskell at haskell.org right now. I don't mind seeing occasional job and academic ads here. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From carter.schonwald at gmail.com Thu Jul 3 14:29:42 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Thu, 3 Jul 2014 10:29:42 -0400 Subject: [Haskell-cafe] Restarting doc build on hackage In-Reply-To: References: Message-ID: Use the rest API to delete the current docs. That will reschedule a doc build. On Thursday, July 3, 2014, Erik Hesselink wrote: > Hi cafe, > > Does anyone know if there is a way to restart a documentation build on > hackage? We have a package where the documentation failed to build due > to a dependency lacking upper bounds. That has recently been fixed > (using the new in-place cabal file editing feature), and we'd like to > get documentation for our package now. Is there any way to do this > (apart from uploading a new version without changes)? > > Erik > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Thu Jul 3 14:32:34 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Thu, 3 Jul 2014 16:32:34 +0200 Subject: [Haskell-cafe] Restarting doc build on hackage In-Reply-To: References: Message-ID: I tried that, but I got a 404, and gave up. I just tried again, and of course you have to do it on a specific version. For future reference: curl -X DELETE http://hackage.haskell.org/-/docs -u Thanks, it seems to have done something now! Erik On Thu, Jul 3, 2014 at 4:29 PM, Carter Schonwald wrote: > Use the rest API to delete the current docs. That will reschedule a doc > build. > > > On Thursday, July 3, 2014, Erik Hesselink wrote: >> >> Hi cafe, >> >> Does anyone know if there is a way to restart a documentation build on >> hackage? We have a package where the documentation failed to build due >> to a dependency lacking upper bounds. That has recently been fixed >> (using the new in-place cabal file editing feature), and we'd like to >> get documentation for our package now. Is there any way to do this >> (apart from uploading a new version without changes)? >> >> Erik >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe From chrisdone at gmail.com Thu Jul 3 15:03:35 2014 From: chrisdone at gmail.com (Christopher Done) Date: Thu, 3 Jul 2014 08:03:35 -0700 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo In-Reply-To: <91458495-54DB-40A9-AF49-13E5C0428593@cs.otago.ac.nz> References: <91458495-54DB-40A9-AF49-13E5C0428593@cs.otago.ac.nz> Message-ID: It seems that the hyperindexformat in haskell.ind is generated. If I edit the file as you wrote and do make clean && make, the file is modified back to using \". On 2 July 2014 18:46, Richard A. O'Keefe wrote: > > On 3/07/2014, at 8:14 AM, Christopher Done wrote: > >> (./haskell.ind (./index-intro.tex) > >> ! Argument of \OT1\" has an extra }. > >> > >> \par > >> l.61 \item |hyperindexformat{\"} > >> , 51, 73, 107, 112 > >> ? > > > > Does anyone familiar with the language of LaTeX have any idea what's > > going on? > > The \" command in TeX says "You see the next item? Put > a diaeresis over it." So it is expecting a plain character, > or possibly a command naming a character. But } is an "active" > character with a special meaning. > > The most likely explanation here is that \" should > *really* be \textquotedbl. Apparently someone thought > \" in TeX was like \" in a C string, but it never has been. > > If you can change that line from > \item |hyperindexformat{\"}.... > to \item |hyperindexformat{\textquotdbl}.... > the problem *might* go away. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brucker at spamfence.net Thu Jul 3 15:15:15 2014 From: brucker at spamfence.net (Achim D. Brucker) Date: Thu, 3 Jul 2014 17:15:15 +0200 Subject: [Haskell-cafe] Final Call for Papers: OCL 2014 Submissions Due in One Week Message-ID: <20140703151515.GA27790@fujikawa.home.brucker.ch> (Apologies for duplicates) CALL FOR PAPERS 14th International Workshop on OCL and Textual Modeling Applications and Case Studies (OCL 2014) Co-located with ACM/IEEE 17th International Conference on Model Driven Engineering Languages and Systems (MODELS 2014) September 28-30 (tbc), 2014, VALENCIA, SPAIN http://www.software.imdea.org/OCL2014/ Modeling started out with UML and its precursors as a graphical notation. Such visual representations enable direct intuitive capturing of reality, but some of their features are difficult to formalize and lack the level of precision required to create complete and unambiguous specifications. Limitations of the graphical notations encouraged the development of text-based modeling languages that either integrate with or replace graphical notations for modeling. Typical examples of such languages are OCL, textual MOF, Epsilon, and Alloy. Textual modeling languages have their roots in formal language paradigms like logic, programming and databases. The goal of this workshop is create a forum where researchers and practitioners interested in building models using OCL or other kinds of textual languages can directly interact, report advances, share results, identify tools for language development, and discuss appropriate standards. In particular, the workshop will encourage discussions for achieving synergy from different modeling language concepts and modeling language use. The close interaction will enable researchers and practitioners to identify common interests and options for potential cooperation. Topics of interest include (but are not limited to) =================================================== - Mappings between textual modeling languages and other languages/formalisms - Algorithms, evaluation strategies and optimizations in the context of textual modeling languages for -- validation, verification, and testing, -- model transformation and code generation, -- metamodeling and DSLs, and -- query and constraint specifications - Alternative graphical/textual notations for textual modeling languages - Evolution, transformation and simplification of textual modeling expressions - Libraries, templates and patterns for textual modeling languages - Complexity results for textual modeling languages - Quality models and benchmarks for comparing and evaluating textual modeling tools and algorithms - Successful applications of textual modeling languages - Case studies on industrial applications of textual modeling languages - Experience reports -- usage of textual modeling languages and tools in complex domains, -- usability of textual modeling languages and tools for end-users - Empirical studies about the benefits and drawbacks of textual modeling languages - Innovative textual modeling tools - Comparison, evaluation and integration of modeling languages - Correlation between modeling languages and modeling tasks This year, we particularly encourage submissions describing applications and case studies of textual modeling as well as test suites and benchmark collections for evaluating textual modeling tools. Venue ===== The workshop will be organized as a part of MODELS 2014 Conference in Valencia, Spain. It continues the series of OCL workshops held at UML/MODELS conferences: York (2000), Toronto (2001), San Francisco (2003), Lisbon (2004), Montego Bay (2005), Genova (2006), Nashville (2007), Toulouse (2008), Denver (2009), Oslo (2010), Zurich (2011, at the TOOLs conference), 2012 in Innsbruck, and 2013 in Miami. Similar to its predecessors, the workshop addresses both people from academia and industry. The aim is to provide a forum for addressing integration of OCL and other textual modeling languages, as well as tools for textual modeling, and for disseminating good practice and discussing the new requirements for textual modeling. Workshop Format =============== The workshop will include short (about 15 min) presentations, parallel sessions of working groups, and sum-up discussions. Submissions =========== Two types of papers will be considered: * short papers (6 pages) and * full papers (10 pages) in LNCS format. Submissions should be uploaded to EasyChair (https://www.easychair.org/conferences/?conf=ocl2014). The program committee will review the submissions (minimum 2 reviews per paper, usually 3 reviews) and select papers according to their relevance and interest for discussions that will take place at the workshop. Accepted papers will be published online in a pre-conference edition of CEUR (http://www.ceur-ws.org). Authors of selected papers will be invited to submit an extended version of their workshop paper to a special issue of the Electronic Communications of the EASST (http://journal.ub.tu-berlin.de/eceasst) Important Dates =============== Submission of papers: July 11, 2014 Notification: August 8, 2014 Workshop date: one day during September 28-30, 2014 Organizers ========== Achim D. Brucker, SAP AG, Germany Carolina Dania, IMDEA Software Institute, Madrid, Spain Geri Georg, Colorado State University, Fort Collins, Colorado, USA Martin Gogolla, University of Bremen, Germany Programme Committee (partly confirmation pending) =================== Michael Altenhofen, SAP AG, Germany Thomas Baar, University of Applied Sciences Berlin, Germany Mira Balaban, Ben-Gurion University of the Negev, Israel Tricia Balfe, Nomos Software, Ireland Fabian Buettner, Ecole des Mines de Nantes, France Achim D. Brucker, SAP AG, Germany Jordi Cabot, INRIA-Ecole des Mines de Nantes, France Yoonsik Cheon, University of Texas, USA Dan Chiorean, Babes-Bolyai University, Romania Robert Clariso, Universitat Oberta de Catalunya, Spain Tony Clark, Middlesex University, UK Manuel Clavel, IMDEA Software Institute, Madrid, Spain Carolina Dania, IMDEA Software Institute, Madrid, Spain Birgit Demuth, Technische Universitat Dresden, Germany Marina Egea, Atos Research, Madrid, Spain Geri Georg, Colorado State University, Fort Collins, Colorado, USA Martin Gogolla, University of Bremen, Germany Pieter Van Gorp, Eindhoven University of Technology, The Netherlands Heinrich Hussmann, LMU Munchen, Germany Tihamer Levendovszky, Vanderbilt University, USA Shahar Maoz, Tel Aviv University, Israel Istvan Rath, Budapest University of Technology and Economics, Hungary Bernhard Rumpe, RWTH Aachen, Germany Shane Sendall, Snowie Research SA, Switzerland Michael Wahler, ABB Switzerland Ltd Corporate Research, Switzerland Claas Wilke, Technische Universitat Dresden, Germany Edward Willink, Willink Transformations Ltd., UK Burkhart Wolff, Univ Paris-Sud, France Steffen Zschaler, King?s College, London, UK -- Dr. Achim D. Brucker, SAP AG, Vincenz-Priessnitz-Str. 1, D-76131 Karlsruhe Phone: +49 6227 7-52595, http://www.brucker.ch/ From vlatko.basic at gmail.com Thu Jul 3 16:47:31 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Thu, 03 Jul 2014 18:47:31 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: <53a84f04e23be@functionaljobs.com> References: <53a84f04e23be@functionaljobs.com> Message-ID: <53B58923.1080809@gmail.com> Hello Cafe, I have a local forked package and added its path to sandboxed project with 'cabal sandbox add-source PATH'. However, to build that package I have to specify a flag to 'cabal install'. In other words I can't install it by 'cabal install --only-dependencies', but separately with 'cabal install PACKAGE -fFLAG'. Is there a way to tell cabal sandbox (or in project.cabal) to always use some flag(s) for compiling a (particular) package in local path? GHC 7.8.2, Cabal 1.20.0 Best regards, vlatko From sean.leather at gmail.com Thu Jul 3 17:22:59 2014 From: sean.leather at gmail.com (Sean Leather) Date: Thu, 3 Jul 2014 19:22:59 +0200 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo In-Reply-To: References: Message-ID: [Sorry, Christ. I accidentally forgot to include the Caf?.] On Wed, Jul 2, 2014 at 10:14 PM, Christopher Done wrote: Finally, at the end, it says: > > > (./haskell.ind (./index-intro.tex) > > ! Argument of \OT1\" has an extra }. > > > > \par > > l.61 \item |hyperindexformat{\"} > > , 51, 73, 107, 112 > > ? > > Does anyone familiar with the language of LaTeX have any idea what's > going on? Has anyone successfully been able to build it? If so, please > state the exact steps to do so and I will be very grateful. > I really don't know why this is happening, but commenting out || from the TeX and removing it completely from the Haskell gets the build working. I haven't used LaTeX indexing before, but reading [1] tells me that the current code should work. I posted a pull request [2] demonstrating the change. [1] http://en.wikibooks.org/wiki/LaTeX/Indexing#Using_special_characters [2] https://github.com/chrisdone/haskell2010-report/pull/3 Regards, Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at seas.upenn.edu Thu Jul 3 17:24:17 2014 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Thu, 3 Jul 2014 13:24:17 -0400 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: <53B58923.1080809@gmail.com> References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> Message-ID: On Thu, Jul 3, 2014 at 12:47 PM, Vlatko Basic wrote: > Hello Cafe, > > I have a local forked package and added its path to sandboxed project with > 'cabal sandbox add-source PATH'. > > However, to build that package I have to specify a flag to 'cabal install'. > In other words I can't install it by > 'cabal install --only-dependencies', > but separately with > 'cabal install PACKAGE -fFLAG'. > > Is there a way to tell cabal sandbox (or in project.cabal) to always use > some flag(s) for compiling a (particular) package in local path? A way of side stepping this problem is to setup a sandbox in the forked project directory with "cabal sandbox init --sandbox=../MyProject/.cabal-sandbox", then you can run "cabal install --flags" in the forked project directory, and it will install to the sandbox for your downstream project. Anthony From vlatko.basic at gmail.com Thu Jul 3 17:32:03 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Thu, 03 Jul 2014 19:32:03 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> Message-ID: <53B59393.4070102@gmail.com> Hi Anthony, I can install it manually, I'm just trying to find out if a solution exist to tell cabal to use a flag for compiling an external package, i.e. to treat it as if there is no flag. Something like "add-source-flags" would do. :-) I also tried 'ghc-options: -DFLAG' in project's cabal file, but no luck. vlatko -------- Original Message -------- Subject: Re: [Haskell-cafe] Specifying cabal sandbox flag for local package From: Anthony Cowley To: vlatko.basic at gmail.com Cc: haskell-cafe Date: 03.07.2014 19:24 > On Thu, Jul 3, 2014 at 12:47 PM, Vlatko Basic wrote: >> Hello Cafe, >> >> I have a local forked package and added its path to sandboxed project with >> 'cabal sandbox add-source PATH'. >> >> However, to build that package I have to specify a flag to 'cabal install'. >> In other words I can't install it by >> 'cabal install --only-dependencies', >> but separately with >> 'cabal install PACKAGE -fFLAG'. >> >> Is there a way to tell cabal sandbox (or in project.cabal) to always use >> some flag(s) for compiling a (particular) package in local path? > > A way of side stepping this problem is to setup a sandbox in the > forked project directory with "cabal sandbox init > --sandbox=../MyProject/.cabal-sandbox", then you can run "cabal > install --flags" in the forked project directory, and it will install > to the sandbox for your downstream project. > > Anthony > From alexander at plaimi.net Thu Jul 3 17:55:22 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 03 Jul 2014 19:55:22 +0200 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <20140703142524.GA31796@sniper> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> Message-ID: <53B5990A.1080309@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 03/07/14 16:25, Roman Cheplyaka wrote: > I doubt all the people who are interested will subscribe to these > lists. I don't have data to argue for or against this. > Thus people will have to cross-post to those list and haskell-cafe, > just like it's happening with haskell at haskell.org right now. This should be considered frowned upon if this proposal goes through. > I don't mind seeing occasional job and academic ads here. For what it's worth: I don't either. I'm actually interested in seeing what's going on in these circles. But I follow quite a few lists, and I a lot of the stuff I see on those lists *is* annoying to me. So I imagine some people, who like me subscribe to a lot of lists, are annoyed by the ads here. But really, that is a minor point. The primary advantage is in my opinion the ability to filter email. And a point I forgot to make in that regard is for people who *are* looking for jobs presently. It would be good if they could efficiently filter these postings. And another related point is that *I* sure wouldn't mind being able to get ads in digests, whilst following the caf? normally. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlO1mQoACgkQRtClrXBQc7WnAwD+NfyLtpC8e0KPkNxRWLBZOjh5 Ay1Y2DmRsrqkP83gkJsA/0aaQdbFK0ivH+cT7i8lZ6USJSoZfyHXKShmN4mRYpci =ZPGC -----END PGP SIGNATURE----- From vlatko.basic at gmail.com Thu Jul 3 18:07:01 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Thu, 03 Jul 2014 20:07:01 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> <53B59393.4070102@gmail.com> Message-ID: <53B59BC5.9090702@gmail.com> An HTML attachment was scrubbed... URL: From roma at ro-che.info Thu Jul 3 18:24:30 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 3 Jul 2014 14:24:30 -0400 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <53B5990A.1080309@plaimi.net> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> Message-ID: <20140703182430.GA18069@sniper> Yeah, I know this sounds like a great idea in theory. I'm just saying that we have something very similar with haskell at haskell.org, and it's not working, for various social reasons. Roman * Alexander Berntsen [2014-07-03 19:55:22+0200] > On 03/07/14 16:25, Roman Cheplyaka wrote: > > I doubt all the people who are interested will subscribe to these > > lists. > I don't have data to argue for or against this. > > > Thus people will have to cross-post to those list and haskell-cafe, > > just like it's happening with haskell at haskell.org right now. > This should be considered frowned upon if this proposal goes through. > > > I don't mind seeing occasional job and academic ads here. > For what it's worth: I don't either. I'm actually interested in seeing > what's going on in these circles. But I follow quite a few lists, and > I a lot of the stuff I see on those lists *is* annoying to me. So I > imagine some people, who like me subscribe to a lot of lists, are > annoyed by the ads here. > > But really, that is a minor point. The primary advantage is in my > opinion the ability to filter email. > > And a point I forgot to make in that regard is for people who *are* > looking for jobs presently. It would be good if they could efficiently > filter these postings. > > And another related point is that *I* sure wouldn't mind being able to > get ads in digests, whilst following the caf? normally. > -- > Alexander > alexander at plaimi.net > https://secure.plaimi.net/~alexander -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From vlatko.basic at gmail.com Thu Jul 3 18:38:30 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Thu, 03 Jul 2014 20:38:30 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> <53B59393.4070102@gmail.com> <53B59BC5.9090702@gmail.com> Message-ID: <53B5A326.9@gmail.com> An HTML attachment was scrubbed... URL: From alexander at plaimi.net Thu Jul 3 19:23:41 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 03 Jul 2014 21:23:41 +0200 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <20140703182430.GA18069@sniper> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> Message-ID: <53B5ADBD.7090503@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 03/07/14 20:24, Roman Cheplyaka wrote: > I'm just saying that we have something very similar with > haskell at haskell.org, and it's not working, for various social > reasons. I disagree. I think the amount of cross-posting is quite low. Furthermore, if it's happening -- it's happening because we allow it, by not penalising cross-posting. This could be done. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlO1rb0ACgkQRtClrXBQc7VseQD9EfOQnaEvv74C5/RkWmAP29Q8 Cqe+b97moC3gCK5bKXABAJSHB1PrluOulfAUXH0FcMA5D1zsNWT0gdn1HixA8IPp =2JLP -----END PGP SIGNATURE----- From amit at amitlevy.com Thu Jul 3 19:32:36 2014 From: amit at amitlevy.com (Amit Aryeh Levy) Date: Thu, 03 Jul 2014 12:32:36 -0700 Subject: [Haskell-cafe] Declarative database migrations In-Reply-To: References: <53B31028.6030808@amitlevy.com> Message-ID: <53B5AFD4.1020404@amitlevy.com> postgresql-orm is built on top of postgresql-simple and the migrations will work just fine without using any of the ORM layer -- in other words, you can still just use postgresql-simple in your application. The only constraint is a table for tracking the latest applied migration. On 07/02/2014 11:57 PM, Timur Amirov wrote: > Thanks for the list! > > I?ll have a look. > > To be honest, I was trying to avoid Persist for now in favour of > postgresql-simple when it comes to using db. The only concern was > about migration lib. > > -- > Timur Amirov > Berlin, Germany > > On 1 Jul 2014 at 21:47:13, Amit Aryeh Levy (amit at amitlevy.com > ) wrote: > >> postgresql-orm has a very simple DSL and migration model modeled >> after active record's db migrations, as well as a utility, >> `pg_migrate`, for running migrations, rolling back migrations and >> creating boiler plate code for new migrations: >> >> http://hackage.haskell.org/package/postgresql-orm-0.3.0/docs/Database-PostgreSQL-Migrations.html >> >> -Amit >> >> >> On 06/29/2014 06:39 AM, Timur Amirov wrote: >>> Hello! >>> >>> Looking for tools to use discovered that I miss something like >>> Rails database migrations in haskell. >>> Is there a package for it (describe the whole schema and/or >>> particular migrations)? >>> >>> -- >>> Timur Amirov >>> Berlin, Germany >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Thu Jul 3 19:38:48 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Thu, 3 Jul 2014 15:38:48 -0400 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <53B5ADBD.7090503@plaimi.net> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> <53B5ADBD.7090503@plaimi.net> Message-ID: could you take this bikeshedding about things that aren't haskell to a different list please :) On Thu, Jul 3, 2014 at 3:23 PM, Alexander Berntsen wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 03/07/14 20:24, Roman Cheplyaka wrote: > > I'm just saying that we have something very similar with > > haskell at haskell.org, and it's not working, for various social > > reasons. > I disagree. I think the amount of cross-posting is quite low. > Furthermore, if it's happening -- it's happening because we allow it, > by not penalising cross-posting. This could be done. > - -- > Alexander > alexander at plaimi.net > https://secure.plaimi.net/~alexander > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.22 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iF4EAREIAAYFAlO1rb0ACgkQRtClrXBQc7VseQD9EfOQnaEvv74C5/RkWmAP29Q8 > Cqe+b97moC3gCK5bKXABAJSHB1PrluOulfAUXH0FcMA5D1zsNWT0gdn1HixA8IPp > =2JLP > -----END PGP SIGNATURE----- > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From felipe.lessa at gmail.com Thu Jul 3 19:42:22 2014 From: felipe.lessa at gmail.com (Felipe Lessa) Date: Thu, 03 Jul 2014 16:42:22 -0300 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <20140703182430.GA18069@sniper> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> Message-ID: <53B5B21E.7060605@gmail.com> I agree with Roman here. It'd make no sense to post a job listing to a mailing list that has 10% of the audience of the cafe. -- Felipe. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 884 bytes Desc: OpenPGP digital signature URL: From alanpog at gmail.com Thu Jul 3 19:49:32 2014 From: alanpog at gmail.com (Alan Pogrebinschi) Date: Thu, 03 Jul 2014 16:49:32 -0300 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <53B5B21E.7060605@gmail.com> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> <53B5B21E.7060605@gmail.com> Message-ID: <53B5B3CC.9060606@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 If the ability to filter is the goal, it may be accomplished within a single list, by having a rule to tag subjects with [Job] or [Academic], as appropriate. Then if you care about either of those you can quickly scan for them, and if you see those as spam you can easily set email filters to avoid ever seeing them. The default would be current state of affairs. On 07/03/2014 04:42 PM, Felipe Lessa wrote: > I agree with Roman here. It'd make no sense to post a job listing > to a mailing list that has 10% of the audience of the cafe. > > > > _______________________________________________ Haskell-Cafe > mailing list Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJTtbPMAAoJEGkgLfHytDIBWh4IAKgyDNmpgUX+2NPXufZVoopV rsRz2A9gMY/QaPEWHaQIWT1FNGOhLysmLLO3qFkGxaN2POhjhhekN8uSLfFqPIrw MpG9rZpJK3f8jRNAUAWNEqD3d+AoPEAbraKJQh2/6Yp5q4k9r3D/+kKtDNy/d+CI vmtuD53CcmSDSemEUxdlO5UeykPon0hAKogeyz0aRXHe+RPxCxsCwARrX22+XPRh fCEjbpr8JGl+M2KCzhkGKpmPvw0wXzLlDWgppPZAC0WLQ3vx7clWmHylOd0LDdAW mw9zJ+dpVM+t7wLevJAYFqxUwVlqHoPqgOlZV/rTmECDzcNNEwV9s5d1uOD8ZDk= =KXPY -----END PGP SIGNATURE----- From creswick at gmail.com Thu Jul 3 20:09:54 2014 From: creswick at gmail.com (Rogan Creswick) Date: Thu, 3 Jul 2014 13:09:54 -0700 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: <53B58923.1080809@gmail.com> References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> Message-ID: On Thu, Jul 3, 2014 at 9:47 AM, Vlatko Basic wrote: > Hello Cafe, > > I have a local forked package and added its path to sandboxed project with > 'cabal sandbox add-source PATH'. > > However, to build that package I have to specify a flag to 'cabal install'. > In other words I can't install it by > 'cabal install --only-dependencies', > but separately with > 'cabal install PACKAGE -fFLAG'. > I believe you can use constraints to resolve this. eg: $ cabal install --only-dep --constraint="snap-server +openssl" to install snap-server (a dependency) with the openssl flag set. (Credit to Adam Foltzer for pointing this out to me yesterday, coincidentally.) --Rogan > > Is there a way to tell cabal sandbox (or in project.cabal) to always use > some flag(s) for compiling a (particular) package in local path? > > > GHC 7.8.2, Cabal 1.20.0 > > > Best regards, > > vlatko > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander at plaimi.net Thu Jul 3 20:18:41 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 03 Jul 2014 22:18:41 +0200 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <53B5B3CC.9060606@gmail.com> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> <53B5B21E.7060605@gmail.com> <53B5B3CC.9060606@gmail.com> Message-ID: <53B5BAA1.5020101@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 03/07/14 21:49, Alan Pogrebinschi wrote: > If the ability to filter is the goal, it may be accomplished within > a single list, by having a rule to tag subjects with [Job] or > [Academic], as appropriate. If nobody likes the proposal, this would be a nice middle-road. So +1 from me. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlO1uqEACgkQRtClrXBQc7VGbwEAlwtx0n0L7FGpqeNjBTksftFq SEFA9OSSI1w4jNcFuoQA/0KM04E/0NRZMNSgyHrTNAAERASCAn1nuc83Ly2ifqky =237V -----END PGP SIGNATURE----- From alexander at plaimi.net Thu Jul 3 20:19:35 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 03 Jul 2014 22:19:35 +0200 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> <53B5ADBD.7090503@plaimi.net> Message-ID: <53B5BAD7.8050700@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 03/07/14 21:38, Carter Schonwald wrote: > could you take this bikeshedding about things that aren't haskell > to a different list please :) If it is inappropriate to discuss this here, where is this best discussed then? - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlO1utcACgkQRtClrXBQc7VwPQD/RS3sbvpK0XewzqSChK/2b+6T Y1cUelfikucaPvyRs9EA/ioWdWeDIVhM985+XGUy7x4PitDi4fa0CiI8DqRntiz+ =73EF -----END PGP SIGNATURE----- From gautier.difolco at gmail.com Thu Jul 3 21:03:18 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Thu, 3 Jul 2014 23:03:18 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer Message-ID: Hi all, I'm trying to change type-level Nat to Integer as following: {-# LANGUAGE DataKinds, KindSignatures, GADTs, PolyKinds #-} data Nat = Z | S Nat class NatToInt n where natToInt :: n -> Int instance NatToInt Z where natToInt _ = 0 instance NatToInt (S n) where natToInt = 1 + natToInt (undefined :: n) I understand why it fails (Z and S have not the right kind). How to specify that NatToInt is Nat-specific? Moreover, if you have any advanced explanations/links which could give me a deeper understanding on what going on, I'll take them. Thanks in advance for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andres at well-typed.com Thu Jul 3 21:39:26 2014 From: andres at well-typed.com (=?UTF-8?Q?Andres_L=C3=B6h?=) Date: Thu, 3 Jul 2014 23:39:26 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: Hi. In > class NatToInt n where > natToInt :: n -> Int the class parameter is of kind "Nat", but a function argument has to be of kind "*". However, you only want the "n" argument in order to "guide" the instance resolution mechanism. For this, you can use a "Proxy". A Proxy is a datatype that is parameterized by an arbitrary argument (of arbitrary kind), but has only one value, also called "Proxy", so it's perfect for an argument that has no computational meaning and is just there to make the type checker happy: > {-# LANGUAGE DataKinds, KindSignatures, GADTs, PolyKinds, ScopedTypeVariables #-} > > import Data.Proxy > > data Nat = Z | S Nat > > class NatToInt n where > natToInt :: Proxy n -> Int > > instance NatToInt Z where > natToInt _ = 0 > > instance NatToInt n => NatToInt (S n) where > natToInt _ = 1 + natToInt (Proxy :: Proxy n) Cheers, Andres -- Andres L?h, Haskell Consultant Well-Typed LLP, http://www.well-typed.com Registered in England & Wales, OC335890 250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England From 0slemi0 at gmail.com Thu Jul 3 22:04:23 2014 From: 0slemi0 at gmail.com (Andras Slemmer) Date: Thu, 3 Jul 2014 15:04:23 -0700 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: Also, check out the singletons library, it handles type promotion/demotion pretty well. In particular the https://hackage.haskell.org/package/singletons-1.0/docs/Data-Singletons.html#t:SingKind typeclass handles demotion with fromSing On 3 July 2014 14:39, Andres L?h wrote: > Hi. > > In > > > class NatToInt n where > > natToInt :: n -> Int > > the class parameter is of kind "Nat", but a function argument has to > be of kind "*". However, you only want the "n" argument in order to > "guide" the instance resolution mechanism. For this, you can use a > "Proxy". A Proxy is a datatype that is parameterized by an arbitrary > argument (of arbitrary kind), but has only one value, also called > "Proxy", so it's perfect for an argument that has no computational > meaning and is just there to make the type checker happy: > > > {-# LANGUAGE DataKinds, KindSignatures, GADTs, PolyKinds, > ScopedTypeVariables #-} > > > > import Data.Proxy > > > > data Nat = Z | S Nat > > > > class NatToInt n where > > natToInt :: Proxy n -> Int > > > > instance NatToInt Z where > > natToInt _ = 0 > > > > instance NatToInt n => NatToInt (S n) where > > natToInt _ = 1 + natToInt (Proxy :: Proxy n) > > Cheers, > Andres > > -- > Andres L?h, Haskell Consultant > Well-Typed LLP, http://www.well-typed.com > > Registered in England & Wales, OC335890 > 250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Thu Jul 3 22:31:54 2014 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 4 Jul 2014 10:31:54 +1200 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo In-Reply-To: References: <91458495-54DB-40A9-AF49-13E5C0428593@cs.otago.ac.nz> Message-ID: On 4/07/2014, at 3:03 AM, Christopher Done wrote: > It seems that the hyperindexformat in haskell.ind is generated. Well, yes. That much was obvious. > If I edit the file as you wrote and do make clean && make, the file is modified back to using \". When I said 'change that line', I didn't have manual editing in mind. I meant to insert a step in the Makefile that runs ed(1) to patch the output of the indexing program. It would be better to trace back and find out _why_ this is being generated. There would appear to be four pages where the corresponding TeX input asks for " to be indexed; changing that to index double quote instead would be another short term fix. From ok at cs.otago.ac.nz Thu Jul 3 22:43:47 2014 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 4 Jul 2014 10:43:47 +1200 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <53B55BA3.1030305@plaimi.net> References: <53B55BA3.1030305@plaimi.net> Message-ID: On 4/07/2014, at 1:33 AM, Alexander Berntsen wrote: [proposing two additional lists] -1 from me. The number of postings that would be in those lists is a small fraction of the number of spam messages I get despite the University's filtering. This is a heavy- handed solution to a non-problem. From mark.lentczner at gmail.com Thu Jul 3 22:50:25 2014 From: mark.lentczner at gmail.com (Mark Lentczner) Date: Thu, 3 Jul 2014 15:50:25 -0700 Subject: [Haskell-cafe] Fwd: pair hacking on the Platform this weekend? In-Reply-To: References: Message-ID: Okay - My mind is rattling around like a cage against this codebase... I'm rattling around too many design decisions and feeling blue 'cause I'm writing shell scripts! I'm looking for another hacker in the SF Bay area this weekend to work with me on the Mac installation in particular, and the Platform build in general. A few hours any day would be much appreciated. Any takers? - Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From gautier.difolco at gmail.com Fri Jul 4 06:57:13 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Fri, 4 Jul 2014 08:57:13 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: 2014-07-04 0:04 GMT+02:00 Andras Slemmer <0slemi0 at gmail.com>: > Also, check out the singletons library, it handles type promotion/demotion > pretty well. In particular the > https://hackage.haskell.org/package/singletons-1.0/docs/Data-Singletons.html#t:SingKind > typeclass handles demotion with fromSing > It's a little bit complicated for me at the time, but I'll have a look. > > > On 3 July 2014 14:39, Andres L?h wrote: > >> Hi. >> >> In >> >> > class NatToInt n where >> > natToInt :: n -> Int >> >> the class parameter is of kind "Nat", but a function argument has to >> be of kind "*". However, you only want the "n" argument in order to >> "guide" the instance resolution mechanism. For this, you can use a >> "Proxy". A Proxy is a datatype that is parameterized by an arbitrary >> argument (of arbitrary kind), but has only one value, also called >> "Proxy", so it's perfect for an argument that has no computational >> meaning and is just there to make the type checker happy: >> >> > {-# LANGUAGE DataKinds, KindSignatures, GADTs, PolyKinds, >> ScopedTypeVariables #-} >> > >> > import Data.Proxy >> > >> > data Nat = Z | S Nat >> > >> > class NatToInt n where >> > natToInt :: Proxy n -> Int >> > >> > instance NatToInt Z where >> > natToInt _ = 0 >> > >> > instance NatToInt n => NatToInt (S n) where >> > natToInt _ = 1 + natToInt (Proxy :: Proxy n) >> >> Cheers, >> Andres >> >> -- >> Andres L?h, Haskell Consultant >> Well-Typed LLP, http://www.well-typed.com >> >> Registered in England & Wales, OC335890 >> 250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > Thanks (I finally understand the usefulness of Proxy). -------------- next part -------------- An HTML attachment was scrubbed... URL: From andres.loeh at gmail.com Fri Jul 4 07:06:21 2014 From: andres.loeh at gmail.com (=?UTF-8?Q?Andres_L=C3=B6h?=) Date: Fri, 4 Jul 2014 09:06:21 +0200 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo In-Reply-To: References: <91458495-54DB-40A9-AF49-13E5C0428593@cs.otago.ac.nz> Message-ID: Hi. It seems that there's a bad interaction between hyperref and makeidx. The | character is used by makeidx and hyperref for something that's called "encapsulation", which means applying a formatting directive to the page number. The makeidx program seems to support escaping the | by using "|, but hyperref seems to get confused by this. Therefore, the indexing of the logical or operator fails. I haven't quickly been able to find a fix. One option could be to change the encapsulation character from | to something unused. A quick fix is to disable hyperref's attempts to link the index, by saying \usepackage[hyperindex=false]{hyperref}. That should make the report compile. Cheers, Andres From gautier.difolco at gmail.com Fri Jul 4 07:24:40 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Fri, 4 Jul 2014 09:24:40 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: 2014-07-04 8:57 GMT+02:00 Gautier DI FOLCO : > 2014-07-04 0:04 GMT+02:00 Andras Slemmer <0slemi0 at gmail.com>: > > Also, check out the singletons library, it handles type promotion/demotion >> pretty well. In particular the >> https://hackage.haskell.org/package/singletons-1.0/docs/Data-Singletons.html#t:SingKind >> typeclass handles demotion with fromSing >> > > It's a little bit complicated for me at the time, but I'll have a look. > > >> >> >> On 3 July 2014 14:39, Andres L?h wrote: >> >>> Hi. >>> >>> In >>> >>> > class NatToInt n where >>> > natToInt :: n -> Int >>> >>> the class parameter is of kind "Nat", but a function argument has to >>> be of kind "*". However, you only want the "n" argument in order to >>> "guide" the instance resolution mechanism. For this, you can use a >>> "Proxy". A Proxy is a datatype that is parameterized by an arbitrary >>> argument (of arbitrary kind), but has only one value, also called >>> "Proxy", so it's perfect for an argument that has no computational >>> meaning and is just there to make the type checker happy: >>> >>> > {-# LANGUAGE DataKinds, KindSignatures, GADTs, PolyKinds, >>> ScopedTypeVariables #-} >>> > >>> > import Data.Proxy >>> > >>> > data Nat = Z | S Nat >>> > >>> > class NatToInt n where >>> > natToInt :: Proxy n -> Int >>> > >>> > instance NatToInt Z where >>> > natToInt _ = 0 >>> > >>> > instance NatToInt n => NatToInt (S n) where >>> > natToInt _ = 1 + natToInt (Proxy :: Proxy n) >>> >>> Cheers, >>> Andres >>> >>> -- >>> Andres L?h, Haskell Consultant >>> Well-Typed LLP, http://www.well-typed.com >>> >>> Registered in England & Wales, OC335890 >>> 250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> >> > Thanks (I finally understand the usefulness of Proxy). > I have an additional question: How can I "extract" a type variable? I want to do something like this: data Vector :: Nat -> * -> * where Nil :: Vector Z a El :: a -> Vector n a -> Vector (S n) a lengthV :: NatToInt l => Vector l a -> Int lengthV _ = natToInt (Proxy :: Proxy l) Thanks in advance for your answers. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tikhon at jelv.is Fri Jul 4 07:30:47 2014 From: tikhon at jelv.is (Tikhon Jelvis) Date: Fri, 4 Jul 2014 00:30:47 -0700 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: You probably want the ScopedTypeVariables extension. You'll also have to qualify the relevant variable with an explicit forall: forall l. NatToInt l => ... Then you can use l in your expression and it will be in scope. On Jul 4, 2014 12:25 AM, "Gautier DI FOLCO" wrote: > 2014-07-04 8:57 GMT+02:00 Gautier DI FOLCO : > >> 2014-07-04 0:04 GMT+02:00 Andras Slemmer <0slemi0 at gmail.com>: >> >> Also, check out the singletons library, it handles type >>> promotion/demotion pretty well. In particular the >>> https://hackage.haskell.org/package/singletons-1.0/docs/Data-Singletons.html#t:SingKind >>> typeclass handles demotion with fromSing >>> >> >> It's a little bit complicated for me at the time, but I'll have a look. >> >> >>> >>> >>> On 3 July 2014 14:39, Andres L?h wrote: >>> >>>> Hi. >>>> >>>> In >>>> >>>> > class NatToInt n where >>>> > natToInt :: n -> Int >>>> >>>> the class parameter is of kind "Nat", but a function argument has to >>>> be of kind "*". However, you only want the "n" argument in order to >>>> "guide" the instance resolution mechanism. For this, you can use a >>>> "Proxy". A Proxy is a datatype that is parameterized by an arbitrary >>>> argument (of arbitrary kind), but has only one value, also called >>>> "Proxy", so it's perfect for an argument that has no computational >>>> meaning and is just there to make the type checker happy: >>>> >>>> > {-# LANGUAGE DataKinds, KindSignatures, GADTs, PolyKinds, >>>> ScopedTypeVariables #-} >>>> > >>>> > import Data.Proxy >>>> > >>>> > data Nat = Z | S Nat >>>> > >>>> > class NatToInt n where >>>> > natToInt :: Proxy n -> Int >>>> > >>>> > instance NatToInt Z where >>>> > natToInt _ = 0 >>>> > >>>> > instance NatToInt n => NatToInt (S n) where >>>> > natToInt _ = 1 + natToInt (Proxy :: Proxy n) >>>> >>>> Cheers, >>>> Andres >>>> >>>> -- >>>> Andres L?h, Haskell Consultant >>>> Well-Typed LLP, http://www.well-typed.com >>>> >>>> Registered in England & Wales, OC335890 >>>> 250 Ice Wharf, 17 New Wharf Road, London N1 9RF, England >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>>> >>> >>> >> Thanks (I finally understand the usefulness of Proxy). >> > > I have an additional question: How can I "extract" a type variable? > I want to do something like this: > > data Vector :: Nat -> * -> * where > Nil :: Vector Z a > El :: a -> Vector n a -> Vector (S n) a > > lengthV :: NatToInt l => Vector l a -> Int > lengthV _ = natToInt (Proxy :: Proxy l) > > > Thanks in advance for your answers. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gautier.difolco at gmail.com Fri Jul 4 07:39:09 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Fri, 4 Jul 2014 09:39:09 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: 2014-07-04 9:30 GMT+02:00 Tikhon Jelvis : > You probably want the ScopedTypeVariables extension. You'll also have to > qualify the relevant variable with an explicit forall: > > forall l. NatToInt l => ... > > Then you can use l in your expression and it will be in scope. > Interesting, what it's the semantic which force me to add an explicit forall? -------------- next part -------------- An HTML attachment was scrubbed... URL: From christiaan.baaij at gmail.com Fri Jul 4 07:51:30 2014 From: christiaan.baaij at gmail.com (Christiaan Baaij) Date: Fri, 4 Jul 2014 09:51:30 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: <19FF6C52-056F-4688-A4D8-1490EECF81E8@gmail.com> On Jul 4, 2014, at 9:39 AM, Gautier DI FOLCO wrote: > 2014-07-04 9:30 GMT+02:00 Tikhon Jelvis : > You probably want the ScopedTypeVariables extension. You'll also have to qualify the relevant variable with an explicit forall: > > forall l. NatToInt l => ... > > Then you can use l in your expression and it will be in scope. > > > Interesting, what it's the semantic which force me to add an explicit for all? In the case you want to be _less_ general. That is, in you original code: > lengthV :: NatToInt l => Vector l a -> Int > lengthV _ = natToInt (Proxy :: Proxy l) the two 'l' variables are not necessarily the same, that is, the compiler sees your code as: > lengthV :: NatToInt l => Vector l a -> Int > lengthV _ = natToInt (Proxy :: Proxy l1) Notice that there are now two type variables, 'l' and 'l1', which is a more general function. In you case however, you want the 'l' in the where clause to be the same as the 'l' in your top-level type signature. So then you write: > lengthV :: forall l . NatToInt l => Vector l a -> Int > lengthV _ = natToInt (Proxy :: Proxy l) Which is less general, but exactly what you want. -- Christiaan From gautier.difolco at gmail.com Fri Jul 4 07:59:14 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Fri, 4 Jul 2014 09:59:14 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: <19FF6C52-056F-4688-A4D8-1490EECF81E8@gmail.com> References: <19FF6C52-056F-4688-A4D8-1490EECF81E8@gmail.com> Message-ID: 2014-07-04 9:51 GMT+02:00 Christiaan Baaij : > > On Jul 4, 2014, at 9:39 AM, Gautier DI FOLCO > wrote: > > > 2014-07-04 9:30 GMT+02:00 Tikhon Jelvis : > > You probably want the ScopedTypeVariables extension. You'll also have to > qualify the relevant variable with an explicit forall: > > > > forall l. NatToInt l => ... > > > > Then you can use l in your expression and it will be in scope. > > > > > > Interesting, what it's the semantic which force me to add an explicit > for all? > > In the case you want to be _less_ general. > That is, in you original code: > > > lengthV :: NatToInt l => Vector l a -> Int > > lengthV _ = natToInt (Proxy :: Proxy l) > > the two 'l' variables are not necessarily the same, that is, the compiler > sees your code as: > > > lengthV :: NatToInt l => Vector l a -> Int > > lengthV _ = natToInt (Proxy :: Proxy l1) > > Notice that there are now two type variables, 'l' and 'l1', which is a > more general function. > In you case however, you want the 'l' in the where clause to be the same > as the 'l' in your top-level type signature. > So then you write: > > > lengthV :: forall l . NatToInt l => Vector l a -> Int > > lengthV _ = natToInt (Proxy :: Proxy l) > > Which is less general, but exactly what you want. > > -- Christiaan > > ok, so forall add some constraints in this case. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at nand.wakku.to Fri Jul 4 08:00:41 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Fri, 4 Jul 2014 10:00:41 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: References: Message-ID: <20140704100041.GB482@nanodesu.localdomain> On Fri, 4 Jul 2014 09:24:40 +0200, Gautier DI FOLCO wrote: > data Vector :: Nat -> * -> * where > Nil :: Vector Z a > El :: a -> Vector n a -> Vector (S n) a > > lengthV :: NatToInt l => Vector l a -> Int > lengthV _ = natToInt (Proxy :: Proxy l) You can do this without ScopedTypeVariables using a small helper function: lengthV :: NatToInt l => Vector l a -> Int lengthV = natToInt . (const Proxy :: Vector l' a' -> Proxy l') Note that this function is again polymorphic, hence no ScopedTypeVariables required. From chrisdone at gmail.com Fri Jul 4 08:06:45 2014 From: chrisdone at gmail.com (Christopher Done) Date: Fri, 4 Jul 2014 01:06:45 -0700 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo In-Reply-To: References: <91458495-54DB-40A9-AF49-13E5C0428593@cs.otago.ac.nz> Message-ID: On 3 July 2014 15:31, Richard A. O'Keefe wrote: > > On 4/07/2014, at 3:03 AM, Christopher Done wrote: > > > It seems that the hyperindexformat in haskell.ind is generated. > > Well, yes. That much was obvious. > Perhaps, if you are familiar with LaTeX (which I have explicitly stated I am not). The reason I ask the mailing list is so that I don't have to invest the time which you all have already invested in learning the tool, just so that I can generate our venerable Haskell report. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Fri Jul 4 08:08:58 2014 From: chrisdone at gmail.com (Christopher Done) Date: Fri, 4 Jul 2014 01:08:58 -0700 Subject: [Haskell-cafe] Making the Haskell 2010 report latex repo In-Reply-To: References: <91458495-54DB-40A9-AF49-13E5C0428593@cs.otago.ac.nz> Message-ID: On 4 July 2014 00:06, Andres L?h wrote: > Hi. > > It seems that there's a bad interaction between hyperref and makeidx. > The | character is used by makeidx and hyperref for something that's > called "encapsulation", which means applying a formatting directive to > the page number. The makeidx program seems to support escaping the | > by using "|, but hyperref seems to get confused by this. Therefore, > the indexing of the logical or operator fails. > > I haven't quickly been able to find a fix. One option could be to > change the encapsulation character from | to something unused. > > A quick fix is to disable hyperref's attempts to link the index, by > saying \usepackage[hyperindex=false]{hyperref}. That should make the > report compile. > Thanks, let me try that. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gautier.difolco at gmail.com Fri Jul 4 08:09:24 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Fri, 4 Jul 2014 10:09:24 +0200 Subject: [Haskell-cafe] Type-level Nat to Integer In-Reply-To: <20140704100041.GB482@nanodesu.localdomain> References: <20140704100041.GB482@nanodesu.localdomain> Message-ID: 2014-07-04 10:00 GMT+02:00 Niklas Haas : > On Fri, 4 Jul 2014 09:24:40 +0200, Gautier DI FOLCO < > gautier.difolco at gmail.com> wrote: > > data Vector :: Nat -> * -> * where > > Nil :: Vector Z a > > El :: a -> Vector n a -> Vector (S n) a > > > > lengthV :: NatToInt l => Vector l a -> Int > > lengthV _ = natToInt (Proxy :: Proxy l) > > You can do this without ScopedTypeVariables using a small helper > function: > > lengthV :: NatToInt l => Vector l a -> Int > lengthV = natToInt . (const Proxy :: Vector l' a' -> Proxy l') > > Note that this function is again polymorphic, hence no > ScopedTypeVariables required. > Interesting, thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Fri Jul 4 08:49:58 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Fri, 4 Jul 2014 10:49:58 +0200 Subject: [Haskell-cafe] Restarting doc build on hackage In-Reply-To: References: Message-ID: I did this yesterday, and there has not been a rebuild yet, so I'm guessing something is still wrong. The package in question is [1]. As you can see [2] there is only one build report, from the initial upload. Here's the curl command I did: $ curl -X DELETE http://hackage.haskell.org/package/rest-core-0.31.1/docs -u ErikHesselink -v Enter host password for user 'ErikHesselink': * Adding handle: conn: 0x7fb14180aa00 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x7fb14180aa00) send_pipe: 1, recv_pipe: 0 * About to connect() to hackage.haskell.org port 80 (#0) * Trying 88.198.224.242... * Connected to hackage.haskell.org (88.198.224.242) port 80 (#0) * Server auth using Basic with user 'ErikHesselink' > DELETE /package/rest-core-0.31.1/docs HTTP/1.1 > Authorization: Basic blah > User-Agent: curl/7.30.0 > Host: hackage.haskell.org > Accept: */* > < HTTP/1.1 204 No Content * Server nginx/1.6.0 is not blacklisted < Server: nginx/1.6.0 < Date: Thu, 03 Jul 2014 17:51:14 GMT < Content-Type: text/plain < Connection: keep-alive < * Connection #0 to host hackage.haskell.org left intact Any ideas? Erik [1] http://hackage.haskell.org/package/rest-core-0.31.1 [2] http://hackage.haskell.org/package/rest-core-0.31.1/reports/ On Thu, Jul 3, 2014 at 4:32 PM, Erik Hesselink wrote: > I tried that, but I got a 404, and gave up. I just tried again, and of > course you have to do it on a specific version. For future reference: > > curl -X DELETE http://hackage.haskell.org/-/docs -u > > > Thanks, it seems to have done something now! > > Erik > > On Thu, Jul 3, 2014 at 4:29 PM, Carter Schonwald > wrote: >> Use the rest API to delete the current docs. That will reschedule a doc >> build. >> >> >> On Thursday, July 3, 2014, Erik Hesselink wrote: >>> >>> Hi cafe, >>> >>> Does anyone know if there is a way to restart a documentation build on >>> hackage? We have a package where the documentation failed to build due >>> to a dependency lacking upper bounds. That has recently been fixed >>> (using the new in-place cabal file editing feature), and we'd like to >>> get documentation for our package now. Is there any way to do this >>> (apart from uploading a new version without changes)? >>> >>> Erik >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe From lambda.fairy at gmail.com Fri Jul 4 09:00:32 2014 From: lambda.fairy at gmail.com (Chris Wong) Date: Fri, 4 Jul 2014 21:00:32 +1200 Subject: [Haskell-cafe] Restarting doc build on hackage In-Reply-To: References: Message-ID: Hi Erik, I'm not sure how hackage.haskell.org is set up, but I do know the doc builder keeps a private blacklist of failed packages. If the docs don't appear within a few days, that might be the reason. Chris On Fri, Jul 4, 2014 at 8:49 PM, Erik Hesselink wrote: > I did this yesterday, and there has not been a rebuild yet, so I'm > guessing something is still wrong. The package in question is [1]. As > you can see [2] there is only one build report, from the initial > upload. Here's the curl command I did: > > $ curl -X DELETE > http://hackage.haskell.org/package/rest-core-0.31.1/docs -u > ErikHesselink -v > Enter host password for user 'ErikHesselink': > * Adding handle: conn: 0x7fb14180aa00 > * Adding handle: send: 0 > * Adding handle: recv: 0 > * Curl_addHandleToPipeline: length: 1 > * - Conn 0 (0x7fb14180aa00) send_pipe: 1, recv_pipe: 0 > * About to connect() to hackage.haskell.org port 80 (#0) > * Trying 88.198.224.242... > * Connected to hackage.haskell.org (88.198.224.242) port 80 (#0) > * Server auth using Basic with user 'ErikHesselink' >> DELETE /package/rest-core-0.31.1/docs HTTP/1.1 >> Authorization: Basic blah >> User-Agent: curl/7.30.0 >> Host: hackage.haskell.org >> Accept: */* >> > < HTTP/1.1 204 No Content > * Server nginx/1.6.0 is not blacklisted > < Server: nginx/1.6.0 > < Date: Thu, 03 Jul 2014 17:51:14 GMT > < Content-Type: text/plain > < Connection: keep-alive > < > * Connection #0 to host hackage.haskell.org left intact > > Any ideas? > > Erik > > [1] http://hackage.haskell.org/package/rest-core-0.31.1 > [2] http://hackage.haskell.org/package/rest-core-0.31.1/reports/ > > On Thu, Jul 3, 2014 at 4:32 PM, Erik Hesselink wrote: >> I tried that, but I got a 404, and gave up. I just tried again, and of >> course you have to do it on a specific version. For future reference: >> >> curl -X DELETE http://hackage.haskell.org/-/docs -u >> >> >> Thanks, it seems to have done something now! >> >> Erik >> >> On Thu, Jul 3, 2014 at 4:29 PM, Carter Schonwald >> wrote: >>> Use the rest API to delete the current docs. That will reschedule a doc >>> build. >>> >>> >>> On Thursday, July 3, 2014, Erik Hesselink wrote: >>>> >>>> Hi cafe, >>>> >>>> Does anyone know if there is a way to restart a documentation build on >>>> hackage? We have a package where the documentation failed to build due >>>> to a dependency lacking upper bounds. That has recently been fixed >>>> (using the new in-place cabal file editing feature), and we'd like to >>>> get documentation for our package now. Is there any way to do this >>>> (apart from uploading a new version without changes)? >>>> >>>> Erik >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From christiaan.baaij at gmail.com Fri Jul 4 09:33:31 2014 From: christiaan.baaij at gmail.com (Christiaan Baaij) Date: Fri, 4 Jul 2014 11:33:31 +0200 Subject: [Haskell-cafe] Restarting doc build on hackage In-Reply-To: References: Message-ID: You can also upload the documentation yourself, see: http://fuuzetsu.co.uk/blog/posts/2014-01-06-Fix-your-Hackage-documentation.html and http://fuuzetsu.co.uk/blog/posts/2014-01-06-Hackage-documentation-v2.html TL;DR: use this script: http://fuuzetsu.co.uk/misc/hackagedocs > hackagedocs Christiaan On Jul 3, 2014, at 3:55 PM, Erik Hesselink wrote: > Hi cafe, > > Does anyone know if there is a way to restart a documentation build on > hackage? We have a package where the documentation failed to build due > to a dependency lacking upper bounds. That has recently been fixed > (using the new in-place cabal file editing feature), and we'd like to > get documentation for our package now. Is there any way to do this > (apart from uploading a new version without changes)? > > Erik > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From ben at smart-cactus.org Fri Jul 4 12:43:54 2014 From: ben at smart-cactus.org (Ben Gamari) Date: Fri, 04 Jul 2014 08:43:54 -0400 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: <53B5BAD7.8050700@plaimi.net> References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> <53B5ADBD.7090503@plaimi.net> <53B5BAD7.8050700@plaimi.net> Message-ID: On July 3, 2014 4:19:35 PM EDT, Alexander Berntsen wrote: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA256 > >On 03/07/14 21:38, Carter Schonwald wrote: >> could you take this bikeshedding about things that aren't haskell >> to a different list please :) >If it is inappropriate to discuss this here, where is this best >discussed then? I believe Carter was just making a joke although it can be tough to tell over such a lossy medium. With respect to the proposal, I agree with others that while splitting the list looks good on paper, in practice people will likely just continue posting where they can get the largest audience unless there are significant disincentives to doing so. Frankly, I don't find the traffic generated by any of the Haskell lists to be onerous so enforcing such disincentives doesn't seem worth the friction they might give rise to. -1 from me. Cheers, - Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From jabolopes at google.com Fri Jul 4 12:55:03 2014 From: jabolopes at google.com (Jose A. Lopes) Date: Fri, 4 Jul 2014 14:55:03 +0200 Subject: [Haskell-cafe] Proposal: New mailing lists -- haskell-jobs & haskell-academia In-Reply-To: References: <53B55BA3.1030305@plaimi.net> <20140703142524.GA31796@sniper> <53B5990A.1080309@plaimi.net> <20140703182430.GA18069@sniper> <53B5ADBD.7090503@plaimi.net> <53B5BAD7.8050700@plaimi.net> Message-ID: I agree with Ben. People will just keep posting where they get the most audience. It won't make a difference. Besides, the mail subject for a job posting is in most cases enough to simply skip the email, in case you are not interested in job postings (or studentships). -1 On Fri, Jul 4, 2014 at 2:43 PM, Ben Gamari wrote: > On July 3, 2014 4:19:35 PM EDT, Alexander Berntsen > wrote: > >-----BEGIN PGP SIGNED MESSAGE----- > >Hash: SHA256 > > > >On 03/07/14 21:38, Carter Schonwald wrote: > >> could you take this bikeshedding about things that aren't haskell > >> to a different list please :) > >If it is inappropriate to discuss this here, where is this best > >discussed then? > > I believe Carter was just making a joke although it can be tough to tell > over such a lossy medium. > > With respect to the proposal, I agree with others that while splitting the > list looks good on paper, in practice people will likely just continue > posting where they can get the largest audience unless there are > significant disincentives to doing so. Frankly, I don't find the traffic > generated by any of the Haskell lists to be onerous so enforcing such > disincentives doesn't seem worth the friction they might give rise to. -1 > from me. > > Cheers, > > - Ben > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Jose Antonio Lopes Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, M?nchen Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Gesch?ftsf?hrer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370 -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Fri Jul 4 13:01:52 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Fri, 4 Jul 2014 14:01:52 +0100 Subject: [Haskell-cafe] How to deal with dependency bounds for an application In-Reply-To: <20140703062007.GA2440@machine> References: <20140703062007.GA2440@machine> Message-ID: Hi Daniel, Thanks for your feedback! I'll give it a try to match last two Haskell platforms, that sound reasonable. How one should deal with such thing, I suppose having some docker container template for each platform version would be helpful? (specially when having to do that for multiple lib) Cheers Alois On 3 July 2014 07:20, Daniel Trstenjak wrote: > > Hi Alois, > > > Should I know what is the lowest possible combination of my dependencies > who > > would compile... because if I'm too strict it might be difficult for > some user > > to install? or maybe I should target as lowest what is in current > > haskell-platform? > > Yes, looking at the last two haskell platforms might be a good pragmatical > choice. > > I even like the idea that much that I might add a feature to my own > dependency > handling tool cabal-bounds[1]: > > cabal-bounds update --lower --haskel-platform=2012.4.0.0 ... > > > I think that getting the lower dependencies "right" is more an issue for > libraries, because in the case of applications a cabal sandbox can avoid > most of the possible problems. > > > Greetings, > Daniel > > [1] https://github.com/dan-t/cabal-bounds > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From vlatko.basic at gmail.com Fri Jul 4 13:07:22 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Fri, 04 Jul 2014 15:07:22 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> Message-ID: <53B6A70A.7000104@gmail.com> An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Fri Jul 4 13:15:21 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Fri, 4 Jul 2014 14:15:21 +0100 Subject: [Haskell-cafe] How to deal with dependency bounds for an application In-Reply-To: References: <20140703062007.GA2440@machine> Message-ID: Acutally... nevermind. It looks like I'll be able to do everything I need using your awesome tool Daniel! Thanks :-) On 4 July 2014 14:01, Alois Cochard wrote: > Hi Daniel, > > Thanks for your feedback! > > I'll give it a try to match last two Haskell platforms, that sound > reasonable. > > How one should deal with such thing, I suppose having some docker > container template for each platform version would be helpful? (specially > when having to do that for multiple lib) > > Cheers > > Alois > > > > > > On 3 July 2014 07:20, Daniel Trstenjak wrote: > >> >> Hi Alois, >> >> > Should I know what is the lowest possible combination of my >> dependencies who >> > would compile... because if I'm too strict it might be difficult for >> some user >> > to install? or maybe I should target as lowest what is in current >> > haskell-platform? >> >> Yes, looking at the last two haskell platforms might be a good >> pragmatical choice. >> >> I even like the idea that much that I might add a feature to my own >> dependency >> handling tool cabal-bounds[1]: >> >> cabal-bounds update --lower --haskel-platform=2012.4.0.0 ... >> >> >> I think that getting the lower dependencies "right" is more an issue for >> libraries, because in the case of applications a cabal sandbox can avoid >> most of the possible problems. >> >> >> Greetings, >> Daniel >> >> [1] https://github.com/dan-t/cabal-bounds >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > > -- > *A\ois* > http://twitter.com/aloiscochard > http://github.com/aloiscochard > -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Fri Jul 4 13:16:02 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Fri, 4 Jul 2014 15:16:02 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: <53B6A70A.7000104@gmail.com> References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> <53B6A70A.7000104@gmail.com> Message-ID: You could try adding that constraint with the flag to the cabal.config in the sandbox. Something like: Constraint: snap-server +openssl I've put constraints there before, but I'm not sure if the flag syntax works in that spot. Erik On Fri, Jul 4, 2014 at 3:07 PM, Vlatko Basic wrote: > Hi Rogan, > > Thanks for the tip. It works as you said. Good to know. > > However, this the same as manually installing the package with 'cabal > install'. > I'm trying to find a solution to bind the flag with the source permanently, > so when you specify it once, no need to mention it again. > > vlatko > > -------- Original Message -------- > Subject: Re: [Haskell-cafe] Specifying cabal sandbox flag for local package > From: Rogan Creswick > To: vlatko.basic at gmail.com > Cc: haskell-cafe > Date: 03.07.2014 22:09 > > > On Thu, Jul 3, 2014 at 9:47 AM, Vlatko Basic wrote: >> >> Hello Cafe, >> >> I have a local forked package and added its path to sandboxed project with >> 'cabal sandbox add-source PATH'. >> >> However, to build that package I have to specify a flag to 'cabal >> install'. >> In other words I can't install it by >> 'cabal install --only-dependencies', >> but separately with >> 'cabal install PACKAGE -fFLAG'. > > > I believe you can use constraints to resolve this. > > eg: > > $ cabal install --only-dep --constraint="snap-server +openssl" > > to install snap-server (a dependency) with the openssl flag set. > > (Credit to Adam Foltzer for pointing this out to me yesterday, > coincidentally.) > > --Rogan > > >> >> >> Is there a way to tell cabal sandbox (or in project.cabal) to always use >> some flag(s) for compiling a (particular) package in local path? >> >> >> GHC 7.8.2, Cabal 1.20.0 >> >> >> Best regards, >> >> vlatko >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From vlatko.basic at gmail.com Fri Jul 4 13:19:09 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Fri, 04 Jul 2014 15:19:09 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> Message-ID: <53B6A9CD.6060303@gmail.com> An HTML attachment was scrubbed... URL: From vlatko.basic at gmail.com Fri Jul 4 13:22:27 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Fri, 04 Jul 2014 15:22:27 +0200 Subject: [Haskell-cafe] Specifying cabal sandbox flag for local package In-Reply-To: References: <53a84f04e23be@functionaljobs.com> <53B58923.1080809@gmail.com> <53B6A70A.7000104@gmail.com> Message-ID: <53B6AA93.2020702@gmail.com> Hi Erik, Just received the same solution a few minutes ago. It works. vlatko -------- Original Message -------- Subject: Re: [Haskell-cafe] Specifying cabal sandbox flag for local package From: Erik Hesselink To: vlatko.basic at gmail.com Cc: Rogan Creswick , haskell-cafe Date: 04.07.2014 15:16 > You could try adding that constraint with the flag to the cabal.config > in the sandbox. Something like: > > Constraint: snap-server +openssl > > I've put constraints there before, but I'm not sure if the flag syntax > works in that spot. > > Erik > > On Fri, Jul 4, 2014 at 3:07 PM, Vlatko Basic wrote: >> Hi Rogan, >> >> Thanks for the tip. It works as you said. Good to know. >> >> However, this the same as manually installing the package with 'cabal >> install'. >> I'm trying to find a solution to bind the flag with the source permanently, >> so when you specify it once, no need to mention it again. >> >> vlatko >> >> -------- Original Message -------- >> Subject: Re: [Haskell-cafe] Specifying cabal sandbox flag for local package >> From: Rogan Creswick >> To: vlatko.basic at gmail.com >> Cc: haskell-cafe >> Date: 03.07.2014 22:09 >> >> >> On Thu, Jul 3, 2014 at 9:47 AM, Vlatko Basic wrote: >>> >>> Hello Cafe, >>> >>> I have a local forked package and added its path to sandboxed project with >>> 'cabal sandbox add-source PATH'. >>> >>> However, to build that package I have to specify a flag to 'cabal >>> install'. >>> In other words I can't install it by >>> 'cabal install --only-dependencies', >>> but separately with >>> 'cabal install PACKAGE -fFLAG'. >> >> >> I believe you can use constraints to resolve this. >> >> eg: >> >> $ cabal install --only-dep --constraint="snap-server +openssl" >> >> to install snap-server (a dependency) with the openssl flag set. >> >> (Credit to Adam Foltzer for pointing this out to me yesterday, >> coincidentally.) >> >> --Rogan >> >> >>> >>> >>> Is there a way to tell cabal sandbox (or in project.cabal) to always use >>> some flag(s) for compiling a (particular) package in local path? >>> >>> >>> GHC 7.8.2, Cabal 1.20.0 >>> >>> >>> Best regards, >>> >>> vlatko >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> From jeremy at codestrokes.com Fri Jul 4 17:19:51 2014 From: jeremy at codestrokes.com (Jeremy Wright) Date: Fri, 4 Jul 2014 10:19:51 -0700 Subject: [Haskell-cafe] Signal Processing Library Message-ID: Hello: I'm working on my Master's Thesis, and I need a signal processing library that can compute FFTs and autocorrelation on discrete data. Doesn't anyone have experience with such a package in Haskell? I appreciate your time. Sincerely, Jeremy Wright -------------- next part -------------- An HTML attachment was scrubbed... URL: From leza.ml at fecrd.cujae.edu.cu Fri Jul 4 18:24:55 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Fri, 04 Jul 2014 14:24:55 -0400 Subject: [Haskell-cafe] Signal Processing Library In-Reply-To: References: Message-ID: <53B6F177.2020200@fecrd.cujae.edu.cu> Hi, These are the libraries I know: Fft [1] Matrix [2] Statistics [3] [4] [5] DSP [6] In wich I recomend [1], [2] and [3]. [1] http://hackage.haskell.org/package/fft [2] http://hackage.haskell.org/package/hmatrix [3] http://hackage.haskell.org/package/hstatistics [4] http://hackage.haskell.org/package/statistics [5] http://hackage.haskell.org/package/hmatrix-gsl-stats [6] http://hackage.haskell.org/package/dsp On 04/07/14 13:19, Jeremy Wright wrote: > Hello: > > I'm working on my Master's Thesis, and I need a signal processing > library that can compute FFTs and autocorrelation on discrete data. > Doesn't anyone have experience with such a package in Haskell? I > appreciate your time. > > Sincerely, > Jeremy Wright > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- *Leza Morais Lutonda, Lemol-C* /Electronic and Telecomunicaction Eng./ /Software Development and Architecture Entusiast/ http://lemol.github.io @lemolsoft in twitter 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu -------------- next part -------------- An HTML attachment was scrubbed... URL: From hans at hanshoglund.se Fri Jul 4 23:49:34 2014 From: hans at hanshoglund.se (=?iso-8859-1?Q?Hans_H=F6glund?=) Date: Sat, 5 Jul 2014 01:49:34 +0200 Subject: [Haskell-cafe] How to state semantics in denotational design? Message-ID: Dear all, This may seem a strange question due to my unfamiliarity with formal semantics, but bear with me. I am trying to apply denotational design principles to my library music-score, and often find myself writing down semantics of data structures in pseudo-Haskell such as > type Duration = Double > type Time = Point Duration > type Span = Time^2 > type Note a = (Span, a) The actual implementation of the data structures may or may not be identical to the semantics. For example, it makes sense to implement Span as (Time^2) or (Time x Duration), as these types are isomorphic. My question is basically: 1) Is my approach (using pseudo-Haskell) a sound way to state denotational semantics? 2) How can I state semantics (in code and/or documentation), and be sure that my implementation follow the semantics? I understand that the correctness of the implementation w.r.t. to the semantics can be verified using manual proofs, which worries me as I want to be able to refactor the semantics and be make sure that the implementation is still correct without having to repeat all the proofs. Is there a "trick" to encode the semantics in actual Haskell and have the type system and/or QuickCheck do the verification for me? Or am I misunderstanding the concept of denotational design? Sincerly, Hans - Hans H?glund Composer, conductor and developer hans [at] hanshoglund.se hanshoglund.com https://twitter.com/hanshogl https://soundcloud.com/hanshoglund http://github.com/hanshoglund -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbwey9 at gmail.com Sat Jul 5 00:58:13 2014 From: gbwey9 at gmail.com (grant weyburne) Date: Fri, 4 Jul 2014 20:58:13 -0400 Subject: [Haskell-cafe] async simplify code Message-ID: Hi Cafe, Is there any way to simplify this async code to somehow merge the withAsync code into the STM code? Looking at the code for tstABorCD it is not easy to see that it is really just (A&&B)||(C&&D). Here is the code: http://lpaste.net/106945 Thanks for any pointers, Grant -------------- next part -------------- An HTML attachment was scrubbed... URL: From conal at conal.net Sat Jul 5 13:46:43 2014 From: conal at conal.net (Conal Elliott) Date: Sat, 5 Jul 2014 06:46:43 -0700 Subject: [Haskell-cafe] How to state semantics in denotational design? In-Reply-To: References: Message-ID: Hi Hans. I assume you have more data types, such as scores. Defining semantics/models for those types would be the heart of a denotational design, along with the meanings of every element of your API in terms of these models/semantics. For any type class instances you have, the principle of type class morphisms will usually determine the meanings of those instances, and often one can derive/calculate implementations from those determined meanings. If you haven't already, see *Denotational design with type class morphisms * for principles and examples. I don't know how to keep the calculations & proofs in sync with changes to the specification, using Haskell. Maybe you could use a proof assistant environment, but I'm guessing. As you suggested, QuickCheck could also help, especially since using denotational design means that you have a precise specification. Good luck! -- Conal On Fri, Jul 4, 2014 at 4:49 PM, Hans H?glund wrote: > Dear all, > > This may seem a strange question due to my unfamiliarity with formal > semantics, but bear with me. > > I am trying to apply denotational design principles to my > library music-score, and often find myself writing down semantics of data > structures in pseudo-Haskell such as > > > type Duration = Double > > type Time = Point Duration > > type Span = Time^2 > > type Note a = (Span, a) > > The actual implementation of the data structures may or may not be > identical to the semantics. For example, it makes sense to implement Span > as (Time^2) or (Time x Duration), as these types are isomorphic. > > My question is basically: > > 1) Is my approach (using pseudo-Haskell) a sound way to state denotational > semantics? > 2) How can I state semantics (in code and/or documentation), and be sure > that my implementation follow the semantics? > > I understand that the correctness of the implementation w.r.t. to the > semantics can be verified using manual proofs, which worries me as I want > to be able to refactor the semantics and be make sure that the > implementation is still correct without having to repeat all the proofs. Is > there a "trick" to encode the semantics in actual Haskell and have the type > system and/or QuickCheck do the verification for me? Or am I > misunderstanding the concept of denotational design? > > Sincerly, > Hans > > - > > Hans H?glund > *Composer, conductor and developer* > > hans [at] hanshoglund.se > hanshoglund.com > https://twitter.com/hanshogl > https://soundcloud.com/hanshoglund > http://github.com/hanshoglund > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Sat Jul 5 15:52:30 2014 From: spam at scientician.net (Bardur Arantsson) Date: Sat, 05 Jul 2014 17:52:30 +0200 Subject: [Haskell-cafe] withFile variant which takes a ByteString? Message-ID: Hi all, Is there a variant of withFile which takes a ByteString? (I'm aware that I could use the lower-level System.Posix FD-based functions, but if someone already has a package out there, I'd rather not.) Regards, From omari at smileystation.com Sat Jul 5 19:37:14 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 5 Jul 2014 15:37:14 -0400 Subject: [Haskell-cafe] Checking minimum package bounds Message-ID: Often a topic of discussion is making sure that the upper bounds on one's packages are up to date, or even whether upper bounds are a good idea at all. I don't see much discussion on lower bounds. Lower bounds that are needlessly restrictive can get in the way too. For instance, I could just slap "text >= 1.1 && < 1.2" on my package, but this makes things needlessly hard for someone trying to make my package work in conjunction with an older one, especially if all I use are basic functions like "pack" that have been around at least since, say. text-0.11. Does anyone have a best practice for testing and verifying lower bounds? Testing the lower bounds and the upper ones is a challenge. Does anybody bother? I have my sunlight package at http://hackage.haskell.org/package/sunlight but it is really a nasty hack. I am considering cleaning it up so it is less of a nasty hack but before I do that I wondered if anyone else has ever thought about this problem. Thanks. Omari -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Sat Jul 5 19:51:54 2014 From: mwm at mired.org (Mike Meyer) Date: Sat, 5 Jul 2014 14:51:54 -0500 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: References: Message-ID: On Sat, Jul 5, 2014 at 2:37 PM, Omari Norman wrote: > I don't see much discussion on lower bounds. Lower bounds that are needlessly restrictive can get in the way too. For instance, I could just slap "text >= 1.1 && < 1.2" on my package, but this makes things needlessly hard for someone trying to make my package work in conjunction with an older one, especially if all I use are basic functions like "pack" that have been around at least since, say. text-0.11. That's because those bounds are basically "wrong". But you've highlighted the problem right here: > Does anyone have a best practice for testing and verifying lower bounds? Testing the lower bounds and the upper ones is a challenge. Upper bounds, of course, can only be tested to the most recent version. Lower bounds can be tested, but - well, it's not easy. I have a suspicion (could well be wrong) the debate about upper bounds comes down to how the bounds are interpreted: are they "known to work" or "known to not work"? "cabal build" treats them as "known to not work", as it refuses to try to build things when there are dependencies that are "out of bounds". But "cabal init" and most developers seem to treat them as "known to work". Maybe cabal needs two sets of bounds: One for "known to work" and one for "known to not work". If every dependency is "known to work", it builds as now. If some dependency is in the "known to not work" set, then it refuses to build with an error. If some dependency is not "known to work" but no dependency is "known to not work", then maybe it issues warnings for those not "known to work", or maybe it errors out like now but there's a flag to force it to build anyway, or maybe it builds if it was configured with tests enabled but not otherwise. From ezyang at mit.edu Sat Jul 5 19:59:59 2014 From: ezyang at mit.edu (Edward Z. Yang) Date: Sat, 05 Jul 2014 20:59:59 +0100 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: References: Message-ID: <1404589983-sup-7584@sabre> Hello Omari, This problem is among several that I am hoping to address with the module system work that I am doing this summer at MSR. The basic algorithm we are planning on implementing calculates a minimal library signature which a package would correctly type-check against, and then checks whether or not versions of the library implement this signature. A simple version of this check is not hard to do if you hook in to GHC after the renaming pass (but considerably more difficult if you have to implement it from scratch: renaming is fairly nontrivial). Our approach is efficient: once the signature is computed, it is no longer necessary to typecheck the package to test for compatibility. There are a few things our approach won't handle: for example, if a signature is made more polymorphic, in a way that the program still compiles, we will flag it as a mismatch (the plan is to simply require the types be the same.) Cheers, Edward Excerpts from Omari Norman's message of 2014-07-05 20:37:14 +0100: > Often a topic of discussion is making sure that the upper bounds on one's > packages are up to date, or even whether upper bounds are a good idea at > all. > > I don't see much discussion on lower bounds. Lower bounds that are > needlessly restrictive can get in the way too. For instance, I could just > slap "text >= 1.1 && < 1.2" on my package, but this makes things needlessly > hard for someone trying to make my package work in conjunction with an > older one, especially if all I use are basic functions like "pack" that > have been around at least since, say. text-0.11. > > Does anyone have a best practice for testing and verifying lower bounds? > Testing the lower bounds and the upper ones is a challenge. Does anybody > bother? I have my sunlight package at > > http://hackage.haskell.org/package/sunlight > > but it is really a nasty hack. I am considering cleaning it up so it is > less of a nasty hack but before I do that I wondered if anyone else has > ever thought about this problem. > > Thanks. > Omari From haskell.vivian.mcphail at gmail.com Sat Jul 5 22:03:11 2014 From: haskell.vivian.mcphail at gmail.com (Vivian McPhail) Date: Sun, 6 Jul 2014 10:03:11 +1200 Subject: [Haskell-cafe] Signal Processing Library Message-ID: Hi, There is also a signal processing package on Hackage [1] which performs auto_correlation. FFT is has been moved from hmatrix to hmatrix-gsl [2]. Hope this helps. Cheers, Vivian [1] http://hackage.haskell.org/package/hsignal [2] http://hackage.haskell.org/package/hmatrix-gsl Date: Fri, 4 Jul 2014 10:19:51 -0700 > From: Jeremy Wright > To: "haskell-cafe at haskell.org" > Subject: [Haskell-cafe] Signal Processing Library > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > Hello: > > I'm working on my Master's Thesis, and I need a signal processing library > that can compute FFTs and autocorrelation on discrete data. Doesn't anyone > have experience with such a package in Haskell? I appreciate your time. > > Sincerely, > Jeremy Wright > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://www.haskell.org/pipermail/haskell-cafe/attachments/20140704/9ee99112/attachment-0001.html > > > > ------------------------------ > > Message: 10 > Date: Fri, 04 Jul 2014 14:24:55 -0400 > From: Leza Morais Lutonda > To: haskell-cafe at haskell.org > Subject: Re: [Haskell-cafe] Signal Processing Library > Message-ID: <53B6F177.2020200 at fecrd.cujae.edu.cu> > Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" > > > Hi, > > These are the libraries I know: > > Fft [1] > Matrix [2] > Statistics [3] [4] [5] > DSP [6] > > In wich I recomend [1], [2] and [3]. > > > [1] http://hackage.haskell.org/package/fft > [2] http://hackage.haskell.org/package/hmatrix > [3] http://hackage.haskell.org/package/hstatistics > [4] http://hackage.haskell.org/package/statistics > [5] http://hackage.haskell.org/package/hmatrix-gsl-stats > [6] http://hackage.haskell.org/package/dsp > > > - > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Sat Jul 5 23:35:27 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Sun, 6 Jul 2014 01:35:27 +0200 Subject: [Haskell-cafe] Restarting doc build on hackage In-Reply-To: References: Message-ID: Thanks Crhistiaan, the script works! For future reference I had to change -Hustar to --format=ustar for it to work with bsdtar. - Adam On Fri, Jul 4, 2014 at 11:33 AM, Christiaan Baaij < christiaan.baaij at gmail.com> wrote: > You can also upload the documentation yourself, see: > > > http://fuuzetsu.co.uk/blog/posts/2014-01-06-Fix-your-Hackage-documentation.html > and > http://fuuzetsu.co.uk/blog/posts/2014-01-06-Hackage-documentation-v2.html > > TL;DR: use this script: http://fuuzetsu.co.uk/misc/hackagedocs > > hackagedocs > > Christiaan > > On Jul 3, 2014, at 3:55 PM, Erik Hesselink wrote: > > > Hi cafe, > > > > Does anyone know if there is a way to restart a documentation build on > > hackage? We have a package where the documentation failed to build due > > to a dependency lacking upper bounds. That has recently been fixed > > (using the new in-place cabal file editing feature), and we'd like to > > get documentation for our package now. Is there any way to do this > > (apart from uploading a new version without changes)? > > > > Erik > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Sun Jul 6 00:11:49 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Sun, 6 Jul 2014 02:11:49 +0200 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: <1404589983-sup-7584@sabre> References: <1404589983-sup-7584@sabre> Message-ID: The only time people seem to get into trouble with too restrictive lower bounds is if they are using a global/user package db along with the haskell platform where the versions of some packages are pegged. Common best practice seems to be to support the last two haskell platform releases, and that's pretty easy to test against. As a user it very seldom causes problems when a package is missing lower bounds. One of the strengths of having upper bounds is that you have an easier time installing old versions of packages if you need to. When doing that Cabal (as always) picks the latest versions of dependencies so the lower bound doesn't matter. That said I always add some arbitrary (but tested) lower bound for my packages nowadays. I've never gotten asked to relax it so it doesn't seem to be a problem in practice. On Sat, Jul 5, 2014 at 9:59 PM, Edward Z. Yang wrote: > Hello Omari, > > This problem is among several that I am hoping to address with > the module system work that I am doing this summer at MSR. > > The basic algorithm we are planning on implementing calculates a minimal > library signature which a package would correctly type-check against, > and then checks whether or not versions of the library implement this > signature. A simple version of this check is not hard to do if > you hook in to GHC after the renaming pass (but considerably more > difficult if you have to implement it from scratch: renaming is fairly > nontrivial). Our approach is efficient: once the signature is computed, > it is no longer necessary to typecheck the package to test for > compatibility. > > There are a few things our approach won't handle: for example, > if a signature is made more polymorphic, in a way that the program > still compiles, we will flag it as a mismatch (the plan is to simply > require the types be the same.) > > Cheers, > Edward > > Excerpts from Omari Norman's message of 2014-07-05 20:37:14 +0100: > > Often a topic of discussion is making sure that the upper bounds on one's > > packages are up to date, or even whether upper bounds are a good idea at > > all. > > > > I don't see much discussion on lower bounds. Lower bounds that are > > needlessly restrictive can get in the way too. For instance, I could > just > > slap "text >= 1.1 && < 1.2" on my package, but this makes things > needlessly > > hard for someone trying to make my package work in conjunction with an > > older one, especially if all I use are basic functions like "pack" that > > have been around at least since, say. text-0.11. > > > > Does anyone have a best practice for testing and verifying lower bounds? > > Testing the lower bounds and the upper ones is a challenge. Does anybody > > bother? I have my sunlight package at > > > > http://hackage.haskell.org/package/sunlight > > > > but it is really a nasty hack. I am considering cleaning it up so it is > > less of a nasty hack but before I do that I wondered if anyone else has > > ever thought about this problem. > > > > Thanks. > > Omari > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Sun Jul 6 04:17:58 2014 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 6 Jul 2014 07:17:58 +0300 Subject: [Haskell-cafe] async simplify code In-Reply-To: References: Message-ID: On Sat, Jul 5, 2014 at 3:58 AM, grant weyburne wrote: > Hi Cafe, > > Is there any way to simplify this async code to somehow merge the > withAsync code > into the STM code? Looking at the code for tstABorCD it is not easy to > see that > it is really just (A&&B)||(C&&D). Here is the code: > > http://lpaste.net/106945 > > Thanks for any pointers, > Grant > > > The code as-is doesn't actually look too bad to me. But it *might* be a bit easier to read if instead of withAsync, waitSTM, and registerDelay, you used race, concurrently, and timeout. That might look something like this (untested): let toList (x, y) = [x, y] ab = toList <$> concurrently (doStuff 6) (doStuff 12) cd = toList <$> concurrently (doStuff 8) (doStuff 10) res <- timeout (1000000 * 20) $ race ab cd return $ maybe [] (either id id) res Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From sjoerd at w3future.com Sun Jul 6 09:54:24 2014 From: sjoerd at w3future.com (Sjoerd Visscher) Date: Sun, 6 Jul 2014 11:54:24 +0200 Subject: [Haskell-cafe] async simplify code In-Reply-To: References: Message-ID: <26751718-88A8-4270-9260-E2B8FD533A59@w3future.com> You can use the Concurrently newtype wrapper for this, then you can use the Applicative and Alternative type classes. dostuff :: Int -> Concurrently (String, Int) dostuff n = Concurrently $ do .. let aborcd = (\x y -> [x, y]) <$> dostuff 6 <*> dostuff 12 <|> (\x y -> [x, y]) <$> dostuff 8 <*> dostuff 10 fromMaybe [] <$> timeout (1000000 * 20) (runConcurrently aborcd) or even let aborcd = traverse dostuff [6, 12] <|> traverse dostuff [8, 10] Sjoerd On 06 Jul 2014, at 06:17, Michael Snoyman wrote: > > > > On Sat, Jul 5, 2014 at 3:58 AM, grant weyburne wrote: > Hi Cafe, > > Is there any way to simplify this async code to somehow merge the withAsync code > into the STM code? Looking at the code for tstABorCD it is not easy to see that > it is really just (A&&B)||(C&&D). Here is the code: > > http://lpaste.net/106945 > > Thanks for any pointers, > Grant > > > > The code as-is doesn't actually look too bad to me. But it *might* be a bit easier to read if instead of withAsync, waitSTM, and registerDelay, you used race, concurrently, and timeout. That might look something like this (untested): > > let toList (x, y) = [x, y] > ab = toList <$> concurrently (doStuff 6) (doStuff 12) > cd = toList <$> concurrently (doStuff 8) (doStuff 10) > res <- timeout (1000000 * 20) $ race ab cd > return $ maybe [] (either id id) res > > Michael > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From shumovichy at gmail.com Sun Jul 6 13:15:38 2014 From: shumovichy at gmail.com (Yuras Shumovich) Date: Sun, 06 Jul 2014 16:15:38 +0300 Subject: [Haskell-cafe] Control.Exception.bracket is broken(?) Message-ID: <1404652538.4965.26.camel@shum-lt> Hello, >From docs: "If an exception is raised, then bracket will re-raise the exception (after performing the release)." But what if the release action will throw an exception? There are 3 options: 1) suppress the exception from release action and rethrow the original one 2) shutdown the program 3) suppress the original exception and throw the exception from release action. Current behavior is #3 -- suppress the original exception. I think it the worse choice. What other languages do: - java has try-with-resources statement which is the nearest equivalent of haskell's "bracket". It uses the option #1 (rethrow the original exception) - in c++ it is common to use RAII for resource management, so someone's destructor performs resource cleanup. But if destructor throws exception during stack unrolling, the program is terminated (option #2) I prefer #2 because suppressing exception is a really bad idea. What is your choice? And the related thing. Release action should not use any interruptible action. Otherwise async exception can occur while processing other exception, so one of them will be suppressed. Is it correct? Control.Exception module contains a list of uninterruptible actions (see "Interruptible operations" section), and e.g. "hClose" is not there. Is "hClose" interruptible or not? If async exception interrupts "hClose", the file descriptor will leak. So, should we use uninterruptibleMask in release action for "bracket"? Thanks, Yuras From mwm at mired.org Sun Jul 6 13:37:29 2014 From: mwm at mired.org (Mike Meyer) Date: Sun, 6 Jul 2014 08:37:29 -0500 Subject: [Haskell-cafe] Control.Exception.bracket is broken(?) In-Reply-To: <1404652538.4965.26.camel@shum-lt> References: <1404652538.4965.26.camel@shum-lt> Message-ID: On Jul 6, 2014 8:15 AM, "Yuras Shumovich" wrote: > > Hello, > > From docs: "If an exception is raised, then bracket will re-raise the > exception (after performing the release)." > > But what if the release action will throw an exception? There are 3 > options: > 1) suppress the exception from release action and rethrow the original > one > 2) shutdown the program > 3) suppress the original exception and throw the exception from release > action. > > Current behavior is #3 -- suppress the original exception. I think it > the worse choice. > > What other languages do: > > - java has try-with-resources statement which is the nearest equivalent > of haskell's "bracket". It uses the option #1 (rethrow the original > exception) > > - in c++ it is common to use RAII for resource management, so someone's > destructor performs resource cleanup. But if destructor throws exception > during stack unrolling, the program is terminated (option #2) You left off what I think is the best behavior, from Python 3: 4) Throw the exception for the release action, chaining the original exception to it. The default exception handler reports the them both. > I prefer #2 because suppressing exception is a really bad idea. What is > your choice? #4. -------------- next part -------------- An HTML attachment was scrubbed... URL: From shumovichy at gmail.com Sun Jul 6 14:16:28 2014 From: shumovichy at gmail.com (Yuras Shumovich) Date: Sun, 06 Jul 2014 17:16:28 +0300 Subject: [Haskell-cafe] Control.Exception.bracket is broken(?) In-Reply-To: References: <1404652538.4965.26.camel@shum-lt> Message-ID: <1404656188.4965.32.camel@shum-lt> On Sun, 2014-07-06 at 08:37 -0500, Mike Meyer wrote: > You left off what I think is the best behavior, from Python 3: > > 4) Throw the exception for the release action, chaining the original > exception to it. The default exception handler reports the them both. You mean the "__context__" attribute of the exception? Java also allows one to get the suppressed exception via "Throwable.getSuppressed" method. But python3 suppresses the original exception, while java does the opposite, so I'm ok to count it as a separate option (#4). Thanks. > > > I prefer #2 because suppressing exception is a really bad idea. What is > > your choice? > > #4. Is it common for python3 code to be prepared to handle __context__? I guess most developers just ignore it. So probably #1 is better? From gbwey9 at gmail.com Sun Jul 6 15:38:16 2014 From: gbwey9 at gmail.com (gbwey9) Date: Sun, 6 Jul 2014 11:38:16 -0400 Subject: [Haskell-cafe] async simplify code In-Reply-To: <26751718-88A8-4270-9260-E2B8FD533A59@w3future.com> References: <26751718-88A8-4270-9260-E2B8FD533A59@w3future.com> Message-ID: Thanks! That is exactly what I was looking for. Grant On Sun, Jul 6, 2014 at 5:54 AM, Sjoerd Visscher wrote: > You can use the Concurrently newtype wrapper for this, then you can use > the Applicative and Alternative type classes. > > dostuff :: Int -> Concurrently (String, Int) > dostuff n = Concurrently $ do > .. > > let aborcd = (\x y -> [x, y]) <$> dostuff 6 <*> dostuff 12 > <|> (\x y -> [x, y]) <$> dostuff 8 <*> dostuff 10 > fromMaybe [] <$> timeout (1000000 * 20) (runConcurrently aborcd) > > or even > > let aborcd = traverse dostuff [6, 12] <|> traverse dostuff [8, 10] > > Sjoerd > > On 06 Jul 2014, at 06:17, Michael Snoyman wrote: > > > > > > > > > On Sat, Jul 5, 2014 at 3:58 AM, grant weyburne wrote: > > Hi Cafe, > > > > Is there any way to simplify this async code to somehow merge the > withAsync code > > into the STM code? Looking at the code for tstABorCD it is not easy to > see that > > it is really just (A&&B)||(C&&D). Here is the code: > > > > http://lpaste.net/106945 > > > > Thanks for any pointers, > > Grant > > > > > > > > The code as-is doesn't actually look too bad to me. But it *might* be a > bit easier to read if instead of withAsync, waitSTM, and registerDelay, you > used race, concurrently, and timeout. That might look something like this > (untested): > > > > let toList (x, y) = [x, y] > > ab = toList <$> concurrently (doStuff 6) (doStuff 12) > > cd = toList <$> concurrently (doStuff 8) (doStuff 10) > > res <- timeout (1000000 * 20) $ race ab cd > > return $ maybe [] (either id id) res > > > > Michael > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Sun Jul 6 16:00:29 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Sun, 6 Jul 2014 17:00:29 +0100 Subject: [Haskell-cafe] [ANN] codex 0.1.0 - generate tags file from dependencies Message-ID: Hi, Just to let you know that I released a new version of `codex` (a tool which generate a tags[1] file for a given cabal project using the sources of all the dependencies of that project). This release include some bug fixes as well as two new features: - Support modules added using `cabal sandbox add-source` as workspace dependencies - Support `emacs` format by disabling sorting on merge of tags files Thanks to everyone who reported bugs or submitted patch! [1]Those tags file basically contain references to functions/types definition in source code and allow "jump to definition" like functionality in text editors. source: http://github.com/aloiscochard/codex hackage: http://hackage.haskell.org/package/codex -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.g.larson at gmail.com Sun Jul 6 16:53:05 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Sun, 6 Jul 2014 12:53:05 -0400 Subject: [Haskell-cafe] how to turn on RTS options? Message-ID: I need to change some runtime options. I updated the options line in my cabal file: ghc-options: -Wall -fno-warn-orphans -O2 -rtsopts But when I rebuild and run, it's as though runtime options are still disabled. C:\johan\Haskell\projects\bio-acai>cabal build .\bio-acai.cabal has been changed. Re-configuring with most recently used options. If this fails, please run configure manually. Resolving dependencies... Configuring bio-acai-0.1.0.0... Building bio-acai-0.1.0.0... Preprocessing executable 'acai' for bio-acai-0.1.0.0... Preprocessing test suite 'tests' for bio-acai-0.1.0.0... C:\johan\Haskell\projects\bio-acai>dist\build\acai\acai.exe +RTS -H128m -K64m *acai.exe: Most RTS options are disabled. Link with -rtsopts to enable them.* My best guess is that the "ghc-options" line is the wrong place to try to turn on RTS option handling. But what's the right one? -- Johan Larson -- Toronto, Canada -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sun Jul 6 16:54:44 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 6 Jul 2014 12:54:44 -0400 Subject: [Haskell-cafe] how to turn on RTS options? In-Reply-To: References: Message-ID: Try doing a cabal clean? Also are you setting that for an executable or a library? Only makes sense on an executable On Sunday, July 6, 2014, Johan Larson wrote: > I need to change some runtime options. > > I updated the options line in my cabal file: > ghc-options: -Wall -fno-warn-orphans -O2 -rtsopts > > But when I rebuild and run, it's as though runtime options are still > disabled. > > C:\johan\Haskell\projects\bio-acai>cabal build > .\bio-acai.cabal has been changed. Re-configuring with most recently used > options. If this fails, please run configure manually. > Resolving dependencies... > Configuring bio-acai-0.1.0.0... > Building bio-acai-0.1.0.0... > Preprocessing executable 'acai' for bio-acai-0.1.0.0... > Preprocessing test suite 'tests' for bio-acai-0.1.0.0... > > C:\johan\Haskell\projects\bio-acai>dist\build\acai\acai.exe +RTS -H128m > -K64m > *acai.exe: Most RTS options are disabled. Link with -rtsopts to enable > them.* > > My best guess is that the "ghc-options" line is the wrong place to try to > turn on RTS option handling. But what's the right one? > -- > Johan Larson -- Toronto, Canada > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.g.larson at gmail.com Sun Jul 6 16:57:01 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Sun, 6 Jul 2014 12:57:01 -0400 Subject: [Haskell-cafe] how to turn on RTS options? In-Reply-To: References: Message-ID: "cabal clean" did the trick. Thanks. On Sun, Jul 6, 2014 at 12:54 PM, Carter Schonwald < carter.schonwald at gmail.com> wrote: > Try doing a cabal clean? Also are you setting that for an executable or a > library? Only makes sense on an executable > > > On Sunday, July 6, 2014, Johan Larson wrote: > >> I need to change some runtime options. >> >> I updated the options line in my cabal file: >> ghc-options: -Wall -fno-warn-orphans -O2 -rtsopts >> >> But when I rebuild and run, it's as though runtime options are still >> disabled. >> >> C:\johan\Haskell\projects\bio-acai>cabal build >> .\bio-acai.cabal has been changed. Re-configuring with most recently used >> options. If this fails, please run configure manually. >> Resolving dependencies... >> Configuring bio-acai-0.1.0.0... >> Building bio-acai-0.1.0.0... >> Preprocessing executable 'acai' for bio-acai-0.1.0.0... >> Preprocessing test suite 'tests' for bio-acai-0.1.0.0... >> >> C:\johan\Haskell\projects\bio-acai>dist\build\acai\acai.exe +RTS -H128m >> -K64m >> *acai.exe: Most RTS options are disabled. Link with -rtsopts to enable >> them.* >> >> My best guess is that the "ghc-options" line is the wrong place to try to >> turn on RTS option handling. But what's the right one? >> -- >> Johan Larson -- Toronto, Canada >> > -- Johan Larson -- Toronto, Canada -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Sun Jul 6 21:45:49 2014 From: mwm at mired.org (Mike Meyer) Date: Sun, 6 Jul 2014 16:45:49 -0500 Subject: [Haskell-cafe] Control.Exception.bracket is broken(?) In-Reply-To: <1404656188.4965.32.camel@shum-lt> References: <1404652538.4965.26.camel@shum-lt> <1404656188.4965.32.camel@shum-lt> Message-ID: On Sun, Jul 6, 2014 at 9:16 AM, Yuras Shumovich wrote: > On Sun, 2014-07-06 at 08:37 -0500, Mike Meyer wrote: > > You left off what I think is the best behavior, from Python 3: > > > > 4) Throw the exception for the release action, chaining the original > > exception to it. The default exception handler reports the them both. > > You mean the "__context__" attribute of the exception? Java also allows > one to get the suppressed exception via "Throwable.getSuppressed" > method. But python3 suppresses the original exception, while java does > the opposite, so I'm ok to count it as a separate option (#4). Thanks. > > > > > > I prefer #2 because suppressing exception is a really bad idea. What is > > > your choice? > > > > #4. > > Is it common for python3 code to be prepared to handle __context__? I > guess most developers just ignore it. So probably #1 is better? > There are two types of exception handles in most Python applications. Ones that handle specific exceptions should catch as few exceptions as possible. These are narrowed to include as little code as possible, and only catch the exceptions they know how to deal with. They normally won't deal with __context__ unless they expect to catch such exceptions. The other type is a catchall handler that usually tries to report the exception and return the application to a known state. It should handle __context__. Personally, I think that #2 is a really bad option, because it makes it impossible to properly write exception handlers of the second type. While I understand the urge - my usual such handler for long-running programs is to exec itself to create a clean instance - you should still make that option available to the programmer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at nh2.me Mon Jul 7 00:18:34 2014 From: mail at nh2.me (=?ISO-8859-1?Q?Niklas_Hamb=FCchen?=) Date: Mon, 07 Jul 2014 01:18:34 +0100 Subject: [Haskell-cafe] Control.Exception.bracket is broken(?) In-Reply-To: <1404652538.4965.26.camel@shum-lt> References: <1404652538.4965.26.camel@shum-lt> Message-ID: <53B9E75A.2090500@nh2.me> On 06/07/14 14:15, Yuras Shumovich wrote: > And the related thing. Release action should not use any interruptible > action. Otherwise async exception can occur while processing other > exception, so one of them will be suppressed. Is it correct? > Control.Exception module contains a list of uninterruptible actions (see > "Interruptible operations" section), and e.g. "hClose" is not there. Is > "hClose" interruptible or not? If async exception interrupts "hClose", > the file descriptor will leak. So, should we use uninterruptibleMask in > release action for "bracket"? Does anybody know the answer to these questions, especially the first one? From oleg at okmij.org Mon Jul 7 01:41:32 2014 From: oleg at okmij.org (oleg at okmij.org) Date: Sun, 6 Jul 2014 21:41:32 -0400 (EDT) Subject: [Haskell-cafe] ML Family workshop: First Call for Participation Message-ID: <20140707014132.6DF62C3878@www1.g3.pair.com> Higher-order, Typed, Inferred, Strict: ACM SIGPLAN ML Family Workshop Thursday September 4, 2014, Gothenburg, Sweden Call For Participation http://okmij.org/ftp/ML/ML14.html Early registration deadline is August 3. Please register at https://regmaster4.com/2014conf/ICFP14/register.php This workshop specifically aims to recognize the entire extended ML family and to provide the forum to present and discuss common issues, both practical (compilation techniques, implementations of concurrency and parallelism, programming for the Web) and theoretical (fancy types, module systems, metaprogramming). We also encourage presentations from related languages (such as Scala, Rust, Nemerle, ATS, etc.), to exchange experience of further developing ML ideas. The workshop is conducted in close cooperation with the OCaml Users and Developers Workshop http://ocaml.org/meetings/ocaml/2014/ taking place on September 5. Program * Andreas Rossberg 1ML -- core and modules as one (Or: F-ing first-class modules) * Jacques Garrigue and Leo White Type-level module aliases: independent and equal * Felix Klock and Nicholas Matsakis Demo: The Rust Language and Type System * Tomas Petricek and Don Syme Doing web-based data analytics with F# * Thomas Braibant, Jonathan Protzenko and Gabriel Scherer Well-typed generic smart-fuzzing for APIs * Ramana Kumar, Magnus O. Myreen, Michael Norrish and Scott Owens Improving the CakeML Verified ML Compiler * Leo White and Frederic Bour Modular implicits * Nada Amin and Tiark Rompf Implicits in Practice * Anil Madhavapeddy, Thomas Gazagnaire, David Scott and Richard Mortier Metaprogramming with ML modules in the MirageOS * Katsuhiro Ueno and Atsushi Ohori Compiling SML# with LLVM: a Challenge of Implementing ML on a Common Compiler Infrastructure * Akinori Abe and Eijiro Sumii A Simple and Practical Linear Algebra Library Interface with Static Size Checking * John Reppy SML3d: 3D Graphics for Standard ML In addition, the joint poster session with the OCaml workshop will take place in the afternoon on September 5. The session will include posters: * Nicolas Oury Core.Sequence: a unified interface for sequences * Thomas Gazagnaire, Amir Chaudhry, Anil Madhavapeddy, Richard Mortier, David Scott, David Sheets, Gregory Tsipenyuk, Jon Crowcroft Irminsule: a branch-consistent distributed library database * Michel Mauny and Benoit Vaugon Nullable Type Inference * Edwin Toeroek LibreS3: design, challenges, and steps toward reusable libraries * Fabrice Le Fessant A Case for Multi-Switch Constraints in OPAM Program Committee Kenichi Asai Ochanomizu University, Japan Matthew Fluet Rochester Institute of Technology, USA Jacques Garrigue Nagoya University, Japan Dave Herman Mozilla, USA Stefan Holdermans Vector Fabrics, Netherlands Oleg Kiselyov (Chair) University of Tsukuba, Japan Keiko Nakata Tallinn University of Technology, Estonia Didier Remy INRIA Paris-Rocquencourt, France Zhong Shao Yale University, USA Hongwei Xi Boston University, USA From magicloud.magiclouds at gmail.com Mon Jul 7 02:23:12 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Mon, 7 Jul 2014 10:23:12 +0800 Subject: [Haskell-cafe] How to have a managed window unfocusable? Message-ID: Hi, I'd like to have a transparent clock floating on my desktop. If I made it ignored (unmanaged), it would not be above and would be blocked by other windows. If I made it managed and float, when I floated up and down, it would be focused and I needed to press hotkey again to move focus to correct window. Anyway I could manage it, but not focusing on it? -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Jul 7 02:52:43 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 6 Jul 2014 22:52:43 -0400 Subject: [Haskell-cafe] How to have a managed window unfocusable? In-Reply-To: References: Message-ID: On Sun, Jul 6, 2014 at 10:23 PM, Magicloud Magiclouds < magicloud.magiclouds at gmail.com> wrote: > I'd like to have a transparent clock floating on my desktop. > > If I made it ignored (unmanaged), it would not be above and would be > blocked by other windows. > > If I made it managed and float, when I floated up and down, it would be > focused and I needed to press hotkey again to move focus to correct window. > > Anyway I could manage it, but not focusing on it? > This is difficult, because X11 expects that the way you do this is to unmanage it *and* that a window that is unmanaged knows how to manage itself. In particular, the X server may well send focus to a managed window *itself* via its window focus inheritance policy. The best xmonad could do would be to use a handleEventHook to detect the window being given focus (this might be rather difficult because focusIn and focusOut events are not currently delivered by the Haskell X11 bindings, sigh) and send focus elsewhere --- but in that case the window would still briefly receive focus. You probably need to find a clock program that knows how to operate as an unmanaged window. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Mon Jul 7 02:57:25 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Mon, 7 Jul 2014 10:57:25 +0800 Subject: [Haskell-cafe] How to have a managed window unfocusable? In-Reply-To: References: Message-ID: Thank you for the explanation. I always thought "focus" was managed by WM. Is "above" also controlled by X instead of WM? I tried to patch the code of the clock to manage itself (keep itself topmost), but did not seem to work. On Mon, Jul 7, 2014 at 10:52 AM, Brandon Allbery wrote: > On Sun, Jul 6, 2014 at 10:23 PM, Magicloud Magiclouds < > magicloud.magiclouds at gmail.com> wrote: > >> I'd like to have a transparent clock floating on my desktop. >> >> If I made it ignored (unmanaged), it would not be above and would be >> blocked by other windows. >> >> If I made it managed and float, when I floated up and down, it would be >> focused and I needed to press hotkey again to move focus to correct window. >> >> Anyway I could manage it, but not focusing on it? >> > > This is difficult, because X11 expects that the way you do this is to > unmanage it *and* that a window that is unmanaged knows how to manage > itself. In particular, the X server may well send focus to a managed window > *itself* via its window focus inheritance policy. The best xmonad could do > would be to use a handleEventHook to detect the window being given focus > (this might be rather difficult because focusIn and focusOut events are not > currently delivered by the Haskell X11 bindings, sigh) and send focus > elsewhere --- but in that case the window would still briefly receive focus. > > You probably need to find a clock program that knows how to operate as an > unmanaged window. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Jul 7 03:17:24 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 6 Jul 2014 23:17:24 -0400 Subject: [Haskell-cafe] How to have a managed window unfocusable? In-Reply-To: References: Message-ID: On Sun, Jul 6, 2014 at 10:57 PM, Magicloud Magiclouds < magicloud.magiclouds at gmail.com> wrote: > Thank you for the explanation. I always thought "focus" was managed by WM. > Explicit focus is managed by the WM. But you don't explicitly choose a window to receive focus when the focused window goes away. The window manager is not invoked then, instead the server checks the focus inheritance policy *of the window that just closed*. And the default is to give focus to (the X server's idea of) the "previous window". It doesn't ask the window manager which that is, or ask the window manager to change the focused window; it determines that and assigns focus itself, and the window manager finds out about it from the subsequent FocusIn event. > Is "above" also controlled by X instead of WM? I tried to patch the code > of the clock to manage itself (keep itself topmost), but did not seem to > work. > Older programs do it themselves; modern programs tend to expect the window manager to do it based on EWMH hints, but xmonad does not implement the window layers part of the spec --- and it's not clear *how* to implement it in xmonad's model, as it runs into the same problems as Bug 4 (all the horrible problems with floating windows in xmonad's model). More or less, the way you'd have to do it is to call XRaiseWindow() regularly, possibly in response to any X11 event other than Expose (sending it on that event risks an infinite loop since the server will generate an Expose event if any part of your window was covered). (This kind of thing is why EWMH moved it into the window manager. Now if only we could do it right given how the StackSet works....) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From kazu at iij.ad.jp Mon Jul 7 03:18:29 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Mon, 07 Jul 2014 12:18:29 +0900 (JST) Subject: [Haskell-cafe] strange behavior of GHC 7.8.2 Message-ID: <20140707.121829.1158644803172417292.kazu@iij.ad.jp> Hi cafe, I noticed that strange behavior of GHC 7.8.2. Consider the following example which requires the "ghc" package: ---- {-# LANGUAGE GeneralizedNewtypeDeriving #-} module A where import GHC import MonadUtils import Control.Monad.Trans.RWS.Lazy (RWST(..)) newtype M a = M (RWST () () () IO a) deriving (Functor,Applicative,Monad,MonadIO) ---- The "ghc" library depends on "transformers" 0.3.0.0. If "transformers" *0.4.1.0* is NOT installed, GHCi can handle the code above well: ---- % ghci -package ghc A.hs ... Loading package transformers-0.3.0.0 ... linking ... done. ... Ok, modules loaded: A. [*A] > ---- However, if "transformers" *0.4.1.0* is installed, an error happens: ---- % cabal install transformers % ghci -package ghc A.hs ... Loading package transformers-0.3.0.0 ... linking ... done. ... [1 of 1] Compiling A ( A.hs, interpreted ) A.hs:10:49: No instance for (MonadIO (RWST () () () IO)) arising from the 'deriving' clause of a data type declaration Possible fix: use a standalone 'deriving instance' declaration, so you can specify the instance context yourself When deriving the instance for (MonadIO M) Failed, modules loaded: none. [Prelude] > ---- A you can see, "transformers" 0.3.0.0 is certainly linked. How can I interpret this behavior? If this is a bug of GHC 7.8.2, I will file this to GHC's trac. P.S. We noticed this because "doctest" of ghc-mod fails only for GHC 7.8.2. --Kazu From shumovichy at gmail.com Mon Jul 7 07:43:32 2014 From: shumovichy at gmail.com (Yuras Shumovich) Date: Mon, 7 Jul 2014 10:43:32 +0300 Subject: [Haskell-cafe] strange behavior of GHC 7.8.2 In-Reply-To: <20140707.121829.1158644803172417292.kazu@iij.ad.jp> References: <20140707.121829.1158644803172417292.kazu@iij.ad.jp> Message-ID: I'm 90% sure you have MonadIO and RWST imported from different versions of transformers. Try to load the code into ghci and check ':i MonadIO' and ':i RWST'. If you'll see fully qualified (including package name and version) names somewhere, then that is the issue. See also http://stackoverflow.com/questions/11068272/acid-state-monadstate-instance-for-update 07.07.2014 6:19 ???????????? "Kazu Yamamoto" ???????: > Hi cafe, > > I noticed that strange behavior of GHC 7.8.2. Consider the following > example which requires the "ghc" package: > > ---- > {-# LANGUAGE GeneralizedNewtypeDeriving #-} > > module A where > > import GHC > import MonadUtils > import Control.Monad.Trans.RWS.Lazy (RWST(..)) > > newtype M a = M (RWST () () () IO a) > deriving (Functor,Applicative,Monad,MonadIO) > ---- > > The "ghc" library depends on "transformers" 0.3.0.0. If "transformers" > *0.4.1.0* is NOT installed, GHCi can handle the code above well: > > ---- > % ghci -package ghc A.hs > ... > Loading package transformers-0.3.0.0 ... linking ... done. > ... > Ok, modules loaded: A. > [*A] > > > ---- > > However, if "transformers" *0.4.1.0* is installed, an error happens: > > ---- > % cabal install transformers > % ghci -package ghc A.hs > ... > Loading package transformers-0.3.0.0 ... linking ... done. > ... > [1 of 1] Compiling A ( A.hs, interpreted ) > > A.hs:10:49: > No instance for (MonadIO (RWST () () () IO)) > arising from the 'deriving' clause of a data type declaration > Possible fix: > use a standalone 'deriving instance' declaration, > so you can specify the instance context yourself > When deriving the instance for (MonadIO M) > Failed, modules loaded: none. > [Prelude] > > > ---- > > A you can see, "transformers" 0.3.0.0 is certainly linked. > How can I interpret this behavior? > > If this is a bug of GHC 7.8.2, I will file this to GHC's trac. > > P.S. > > We noticed this because "doctest" of ghc-mod fails only for GHC 7.8.2. > > --Kazu > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kazu at iij.ad.jp Mon Jul 7 07:58:31 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Mon, 07 Jul 2014 16:58:31 +0900 (JST) Subject: [Haskell-cafe] strange behavior of GHC 7.8.2 In-Reply-To: References: <20140707.121829.1158644803172417292.kazu@iij.ad.jp> Message-ID: <20140707.165831.1070122805373756413.kazu@iij.ad.jp> Hi Yuras, Thank you for your reply. > I'm 90% sure you have MonadIO and RWST imported from different versions of > transformers. Try to load the code into ghci and check ':i MonadIO' and ':i > RWST'. If you'll see fully qualified (including package name and version) > names somewhere, then that is the issue. > See also > http://stackoverflow.com/questions/11068272/acid-state-monadstate-instance-for-update Yes. Probably MonadIO belongs to transformers 0.3.0.0 while RWST does to transformers 0.4.1.0. My question is why this happens. I think that GHCi should use RWST provided by transformers 0.3.0.0. --Kazu From christiaan.baaij at gmail.com Mon Jul 7 09:59:51 2014 From: christiaan.baaij at gmail.com (Christiaan Baaij) Date: Mon, 7 Jul 2014 11:59:51 +0200 Subject: [Haskell-cafe] strange behavior of GHC 7.8.2 In-Reply-To: <20140707.165831.1070122805373756413.kazu@iij.ad.jp> References: <20140707.121829.1158644803172417292.kazu@iij.ad.jp> <20140707.165831.1070122805373756413.kazu@iij.ad.jp> Message-ID: On Jul 7, 2014, at 9:58 AM, Kazu Yamamoto (????) wrote: > Hi Yuras, > > Thank you for your reply. > >> I'm 90% sure you have MonadIO and RWST imported from different versions of >> transformers. Try to load the code into ghci and check ':i MonadIO' and ':i >> RWST'. If you'll see fully qualified (including package name and version) >> names somewhere, then that is the issue. >> See also >> http://stackoverflow.com/questions/11068272/acid-state-monadstate-instance-for-update > > Yes. Probably MonadIO belongs to transformers 0.3.0.0 while RWST does > to transformers 0.4.1.0. > > My question is why this happens. I think that GHCi should use RWST > provided by transformers 0.3.0.0. I think GHC always picks the package with the highest version number, and does _not_ resolve to the package that gives the least amount of type errors. The "Loading package transformers-0.3.0.0" is not there due to your own use of transformers. It's being loaded because it is a dependency of 'ghc-7.8.2'. Also note that this behaviour is not specific to 7.8.*, it is also present in 7.6.3. The only thing you can to with both version of transformers installed is to just do: > ghci -package ghc -hide-package transformers-0.4.1.0 A.hs -- Christiaan From christiaan.baaij at gmail.com Mon Jul 7 10:04:56 2014 From: christiaan.baaij at gmail.com (Christiaan Baaij) Date: Mon, 7 Jul 2014 12:04:56 +0200 Subject: [Haskell-cafe] strange behavior of GHC 7.8.2 In-Reply-To: References: <20140707.121829.1158644803172417292.kazu@iij.ad.jp> <20140707.165831.1070122805373756413.kazu@iij.ad.jp> Message-ID: > > Also note that this behaviour is not specific to 7.8.*, it is also present in 7.6.3. > The only thing you can to with both version of transformers installed is to just do: >> ghci -package ghc -hide-package transformers-0.4.1.0 A.hs Or, perhaps better: > ghci -package ghc -package transformer-0.3.0.0 A.hs Which works for ghc 7.8.2, but for some reason not for ghc 7.6.3. Maybe because in 7.8.2, transformers-0.3.0.0 is in the global package database (bundled with GHC), while that is not the case for 7.6.3? -- Christiaan From alois.cochard at gmail.com Mon Jul 7 14:50:42 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Mon, 7 Jul 2014 15:50:42 +0100 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: References: <1404589983-sup-7584@sabre> Message-ID: On 6 July 2014 01:11, Adam Bergmark wrote: > Common best practice seems to be to support the last two haskell platform > releases, and that's pretty easy to test against. > Actually, how do you do that? It's a shame that the platform is not a 'hackage' package, otherwise I could simply install it in a sandbox... But how can I test my app for a specific platform without reinstalling my local/global DB? For now I'm going on the platform github repo to get the versions, I put them as lower bound and then I use Omari's sunlight. -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Mon Jul 7 14:52:53 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Mon, 7 Jul 2014 10:52:53 -0400 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: References: <1404589983-sup-7584@sabre> Message-ID: Herbert's wonderful multi ghci Travis let's you test on all the configs https://github.com/hvr/multi-ghc-travis On Monday, July 7, 2014, Alois Cochard wrote: > On 6 July 2014 01:11, Adam Bergmark > wrote: > >> Common best practice seems to be to support the last two haskell platform >> releases, and that's pretty easy to test against. >> > > Actually, how do you do that? > > It's a shame that the platform is not a 'hackage' package, otherwise I > could simply install it in a sandbox... > But how can I test my app for a specific platform without reinstalling my > local/global DB? > > For now I'm going on the platform github repo to get the versions, I put > them as lower bound and then I use Omari's sunlight. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Mon Jul 7 14:55:53 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Mon, 7 Jul 2014 15:55:53 +0100 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: References: <1404589983-sup-7584@sabre> Message-ID: That is neat! But I would rather have a solution that don't involve The Cloud, which I can run locally without setting up a local travis. Seems like the time to learn docker have now come :-) On 7 July 2014 15:52, Carter Schonwald wrote: > Herbert's wonderful multi ghci Travis let's you test on all the configs > https://github.com/hvr/multi-ghc-travis > > > On Monday, July 7, 2014, Alois Cochard wrote: > >> On 6 July 2014 01:11, Adam Bergmark wrote: >> >>> Common best practice seems to be to support the last two haskell >>> platform releases, and that's pretty easy to test against. >>> >> >> Actually, how do you do that? >> >> It's a shame that the platform is not a 'hackage' package, otherwise I >> could simply install it in a sandbox... >> But how can I test my app for a specific platform without reinstalling my >> local/global DB? >> >> For now I'm going on the platform github repo to get the versions, I put >> them as lower bound and then I use Omari's sunlight. >> >> -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Mon Jul 7 14:59:55 2014 From: michael at snoyman.com (Michael Snoyman) Date: Mon, 7 Jul 2014 17:59:55 +0300 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: References: <1404589983-sup-7584@sabre> Message-ID: I actually use Herbert's other wonderful tool: the Ubuntu PPAs for GHC. Then I just switch by PATH to point to whichever version of GHC I want to test at at that time. Before I switched to the PPAs, I simply installed multiple versions of GHC in their own directories under /opt. On Mon, Jul 7, 2014 at 5:55 PM, Alois Cochard wrote: > That is neat! > > But I would rather have a solution that don't involve The Cloud, which I > can run locally without setting up a local travis. > > Seems like the time to learn docker have now come :-) > > > On 7 July 2014 15:52, Carter Schonwald wrote: > >> Herbert's wonderful multi ghci Travis let's you test on all the configs >> https://github.com/hvr/multi-ghc-travis >> >> >> On Monday, July 7, 2014, Alois Cochard wrote: >> >>> On 6 July 2014 01:11, Adam Bergmark wrote: >>> >>>> Common best practice seems to be to support the last two haskell >>>> platform releases, and that's pretty easy to test against. >>>> >>> >>> Actually, how do you do that? >>> >>> It's a shame that the platform is not a 'hackage' package, otherwise I >>> could simply install it in a sandbox... >>> But how can I test my app for a specific platform without reinstalling >>> my local/global DB? >>> >>> For now I'm going on the platform github repo to get the versions, I put >>> them as lower bound and then I use Omari's sunlight. >>> >>> > > > -- > *A\ois* > http://twitter.com/aloiscochard > http://github.com/aloiscochard > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Mon Jul 7 17:05:45 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Mon, 7 Jul 2014 19:05:45 +0200 Subject: [Haskell-cafe] Checking minimum package bounds In-Reply-To: References: <1404589983-sup-7584@sabre> Message-ID: I also just switch the PATH. On Mon, Jul 7, 2014 at 4:59 PM, Michael Snoyman wrote: > I actually use Herbert's other wonderful tool: the Ubuntu PPAs for GHC. > Then I just switch by PATH to point to whichever version of GHC I want to > test at at that time. > > Before I switched to the PPAs, I simply installed multiple versions of GHC > in their own directories under /opt. > > > On Mon, Jul 7, 2014 at 5:55 PM, Alois Cochard > wrote: > >> That is neat! >> >> But I would rather have a solution that don't involve The Cloud, which I >> can run locally without setting up a local travis. >> >> Seems like the time to learn docker have now come :-) >> >> >> On 7 July 2014 15:52, Carter Schonwald >> wrote: >> >>> Herbert's wonderful multi ghci Travis let's you test on all the configs >>> https://github.com/hvr/multi-ghc-travis >>> >>> >>> On Monday, July 7, 2014, Alois Cochard wrote: >>> >>>> On 6 July 2014 01:11, Adam Bergmark wrote: >>>> >>>>> Common best practice seems to be to support the last two haskell >>>>> platform releases, and that's pretty easy to test against. >>>>> >>>> >>>> Actually, how do you do that? >>>> >>>> It's a shame that the platform is not a 'hackage' package, otherwise I >>>> could simply install it in a sandbox... >>>> But how can I test my app for a specific platform without reinstalling >>>> my local/global DB? >>>> >>>> For now I'm going on the platform github repo to get the versions, I >>>> put them as lower bound and then I use Omari's sunlight. >>>> >>>> >> >> >> -- >> *A\ois* >> http://twitter.com/aloiscochard >> http://github.com/aloiscochard >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From qdunkan at gmail.com Mon Jul 7 21:25:30 2014 From: qdunkan at gmail.com (Evan Laforge) Date: Mon, 7 Jul 2014 14:25:30 -0700 Subject: [Haskell-cafe] how to get ghci to load compiled modules in 7.8? Message-ID: I recently upgraded to 7.8.2 and I have a silly question. How do you get ghci to load compiled modules? When I try this: % cat >T.hs module T where x :: Int x = 42 % ghc -c -dynamic-too T.hs % s T.dyn_hi T.dyn_o T.hi T.hs T.o % ghci GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package filepath-1.3.0.2 ... linking ... done. Prelude> :l T [1 of 1] Compiling T ( T.hs, interpreted ) Ok, modules loaded: T. *T> It still loads the file interpreted, even though there is a .dyn_o present. What am I doing wrong? This is on x86-64 OS X. From magnus at therning.org Mon Jul 7 23:50:57 2014 From: magnus at therning.org (Magnus Therning) Date: Tue, 8 Jul 2014 01:50:57 +0200 Subject: [Haskell-cafe] withFile variant which takes a ByteString? In-Reply-To: References: Message-ID: <20140707235057.GC15906@tatooine.lan> On Sat, Jul 05, 2014 at 05:52:30PM +0200, Bardur Arantsson wrote: > Hi all, > > Is there a variant of withFile which takes a ByteString? > > (I'm aware that I could use the lower-level System.Posix FD-based > functions, but if someone already has a package out there, I'd rather > not.) You might want to have a look at the Filesystem module, in system-fileio[^1]. It's not exactly what you ask for, but it seems to be a rather good way of dealing with filesystem paths. /M [^1]: http://hackage.haskell.org/package/system-fileio -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus Heuristic is an algorithm in a clown suit. It?s less predictable, it?s more fun, and it comes without a 30-day, money-back guarantee. -- Steve McConnell, Code Complete -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From jwlato at gmail.com Tue Jul 8 00:52:53 2014 From: jwlato at gmail.com (John Lato) Date: Tue, 8 Jul 2014 08:52:53 +0800 Subject: [Haskell-cafe] withFile variant which takes a ByteString? In-Reply-To: <20140707235057.GC15906@tatooine.lan> References: <20140707235057.GC15906@tatooine.lan> Message-ID: On Tue, Jul 8, 2014 at 7:50 AM, Magnus Therning wrote: > On Sat, Jul 05, 2014 at 05:52:30PM +0200, Bardur Arantsson wrote: > > Hi all, > > > > Is there a variant of withFile which takes a ByteString? > > > > (I'm aware that I could use the lower-level System.Posix FD-based > > functions, but if someone already has a package out there, I'd rather > > not.) > > You might want to have a look at the Filesystem module, in > system-fileio[^1]. It's not exactly what you ask for, but it seems to > be a rather good way of dealing with filesystem paths. > Nothing against system-fileio, but it's pretty much the opposite of what Bardur was asking for. It doesn't use ByteStrings and adds even more abstraction over the basic System.IO functions. IMO there are exceedingly few overlapping target cases between RawFilePath and system-fileio. John L. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kazu at iij.ad.jp Tue Jul 8 01:41:03 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Tue, 08 Jul 2014 10:41:03 +0900 (JST) Subject: [Haskell-cafe] strange behavior of GHC 7.8.2 In-Reply-To: References: <20140707.165831.1070122805373756413.kazu@iij.ad.jp> Message-ID: <20140708.104103.855093565032584777.kazu@iij.ad.jp> Christiaan, Thank you for your reply. > I think GHC always picks the package with the highest version > number, and does _not_ resolve to the package that gives the least > amount of type errors. The "Loading package transformers-0.3.0.0" > is not there due to your own use of transformers. It's being loaded > because it is a dependency of 'ghc-7.8.2'. I have reached the same conclusion. "-v" reveals this: ---- % ghci -v A.hs -package ghc ... hiding package transformers-0.3.0.0 to avoid conflict with later version transformers-0.4.1.0 ... ---- > Also note that this behaviour is not specific to 7.8.*, it is also > present in 7.6.3. The only thing you can to with both version of > transformers installed is to just do: >> ghci -package ghc -hide-package transformers-0.4.1.0 A.hs Thanks. "ghci A.hs -package ghc -package transformers-0.3.0.0" works for me. --Kazu From djsamperi at gmail.com Tue Jul 8 04:21:34 2014 From: djsamperi at gmail.com (Dominick Samperi) Date: Tue, 8 Jul 2014 00:21:34 -0400 Subject: [Haskell-cafe] Haskell Platform release schedule? Message-ID: The Haskell Platform wiki page says the platform follows a 6-month release schedule, yet the last release occurred more than one year ago, and I couldn't find information about future plans. Are there plans to update the platform with ghc 7.8.2? Thanks, Dominick From andrew at operationaldynamics.com Tue Jul 8 06:21:18 2014 From: andrew at operationaldynamics.com (Andrew Cowie) Date: Tue, 08 Jul 2014 16:21:18 +1000 Subject: [Haskell-cafe] Job opening: further Haskell Developers at Anchor Message-ID: <1404800478.31055.4.camel@nervous-energy.bridge.anchor.net.au> Openings for additional Haskell developers... About Anchor ------------ Anchor Systems, based in Sydney Australia, has successfully been providing managed hosting and infrastructure to clients around the world for almost 15 years. The critical difference in the service we offer our customers often boils down to providing operations expertise and infrastructure configuration balancing the short term needs to get a new installation running with the long term imperatives of security, scalability, and flexibility. The engineering department is building the analytics capabilities, internal systems, cloud infrastructure, deployment tooling, and operations practices that will be needed to take the company to the next level. We have every intention of changing the hosting industry to make developing applications ? and operating them at scale ? easier for people facing massive growth. Haskell is the working language for all internal development, and we're exploring it for web facing code too. The benefits of type safety, resilience when refactoring, and stability over time added to the power of functional programming has already paid dividends. We have a significant programme of work ahead, and we're looking to add further capability as we face these challenges. Interested in helping? Requirements ------------ You'll need to have demonstrable experience programming in Haskell, familiarity with open source development practices, and the ability to tolerate other people refactoring your code. Exposure to the harsh realities of IT operations and experience of the thrill of Linux systems administration will stand you in good stead. Knowledge of the history, progress, and problems in configuration management will be helpful. A history of contributing to libraries on Hackage would be relevant. More relevant would be a track record of working well in the open (regardless of language or project). Good documentation is as important as good code (a type signature is not sufficient), and command of written English is necessary both to collaborate with your peers and to describe and promote your results. A Bachelor's in science, engineering, or xenobiology will be well thought of. Your specific field of study certainly doesn't matter, but how you use computing to solve problems in your chosen field does. A degree in engineering will be a distinct asset. An undergraduate degree in computer science will not be held against you. Applying -------- If you're interested, send a PDF copy of your CV to , along with the URL to your GitHub account. We also invite you to include a pointer to something that shows you in a good light: a mailing list thread where you argued a contentious position, a piece of particularly thorny code in which you found an elegant solution to a problem, or even an essay or article you've written. We don't do international relocations (sorry everyone who wants to work remotely from Hawaii; I want to work remotely from Hawaii too), but we readily sponsor work visas for new hires should they need one. So whether you've just moved to Australia or have been here for generations, give us a shout next time you're in Sydney. AfC Sydney -- Andrew Frederick Cowie Head of Engineering Anchor Systems 201 Elizabeth Street Level 11, Sydney NSW 2000, Australia http://www.anchor.com.au | afcowie at anchor.com.au | +61 2 8296 5133 From bob at redivi.com Tue Jul 8 07:46:38 2014 From: bob at redivi.com (Bob Ippolito) Date: Tue, 8 Jul 2014 00:46:38 -0700 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: As far as I know, there are plans to release Haskell Platform shortly (no more than a few weeks) after GHC v7.8.3 is released. GHC v7.8.2 has a few showstopper bugs for some use cases that made it unsuitable for a platform release. The infrastructure for maintaining Haskell Platform was all rewritten since the last release with the goal that it should be much easier to keep it on schedule in the future. Alpha builds should be available very shortly after GHC v7.8.3 is released. On Mon, Jul 7, 2014 at 9:21 PM, Dominick Samperi wrote: > The Haskell Platform wiki page says the platform follows a 6-month > release schedule, yet the last release occurred more than one year > ago, and I couldn't find information about future plans. > > Are there plans to update the platform with ghc 7.8.2? > > Thanks, > Dominick > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Jul 8 13:00:21 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 8 Jul 2014 09:00:21 -0400 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: On Tue, Jul 8, 2014 at 12:21 AM, Dominick Samperi wrote: > The Haskell Platform wiki page says the platform follows a 6-month > release schedule, yet the last release occurred more than one year > ago, and I couldn't find information about future plans. > > Are there plans to update the platform with ghc 7.8.2? > The Platform keeps getting stuck waiting for GHC. The skipped release was because ghc 7.8 took some 6 months after "we plan to release just before ICFP 2013"(!); now it's waiting on ghc 7.8.3 bug fixes, which were "should be released by the end of the week" a couple of weeks ago. :( 7.8.3's bug fixes are significant enough that it would be bad to release a platform without them. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Tue Jul 8 13:18:40 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Tue, 8 Jul 2014 15:18:40 +0200 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: On Tue, Jul 8, 2014 at 3:00 PM, Brandon Allbery wrote: > > On Tue, Jul 8, 2014 at 12:21 AM, Dominick Samperi > wrote: > >> The Haskell Platform wiki page says the platform follows a 6-month >> release schedule, yet the last release occurred more than one year >> ago, and I couldn't find information about future plans. >> >> Are there plans to update the platform with ghc 7.8.2? >> > > The Platform keeps getting stuck waiting for GHC. The skipped release was > because ghc 7.8 took some 6 months after "we plan to release just before > ICFP 2013"(!); now it's waiting on ghc 7.8.3 bug fixes, which were "should > be released by the end of the week" a couple of weeks ago. :( 7.8.3's bug > fixes are significant enough that it would be bad to release a platform > without them. > And we couldn't go with 7.6 because of some problems on newer OS X:es right? -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Jul 8 13:21:44 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 8 Jul 2014 09:21:44 -0400 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: On Tue, Jul 8, 2014 at 9:18 AM, Johan Tibell wrote: > On Tue, Jul 8, 2014 at 3:00 PM, Brandon Allbery > wrote: >> >> The Platform keeps getting stuck waiting for GHC. The skipped release was >> because ghc 7.8 took some 6 months after "we plan to release just before >> ICFP 2013"(!); now it's waiting on ghc 7.8.3 bug fixes, which were "should >> be released by the end of the week" a couple of weeks ago. :( 7.8.3's bug >> fixes are significant enough that it would be bad to release a platform >> without them. >> > > And we couldn't go with 7.6 because of some problems on newer OS X:es > right? > Among other things, yes (ghc 7.6 needs to be patched to work with Xcode 5). 7.8 is supposed to improve some things on Windows as well; plus it'd be nice to have 7.8's improvements in general. But the OS X issues are the biggest user-facing ones, and come up pretty much every time someone tries to install the current Platform on OS X. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From Graham.Hutton at nottingham.ac.uk Tue Jul 8 14:08:40 2014 From: Graham.Hutton at nottingham.ac.uk (Graham Hutton) Date: Tue, 8 Jul 2014 15:08:40 +0100 Subject: [Haskell-cafe] Nottingham Research Fellowships Message-ID: <65538BE9-C545-4498-8595-034E6FDFFB40@exmail.nottingham.ac.uk> Dear all, The University of Nottingham is seeking applications for a number of Nottingham Research Fellowships: http://tinyurl.com/notts-fellows These are highly prestigious three-year fellowships, which are normally expected to lead into permenant academic positions. Candidates should have no more than 8 years postdoctoral experience, and fellowships normally start in October 2015. The deadline for submission of initial Expressions of Interest is ** 20th October 2014 **. Applicants in the area of the Functional Programming (FP) lab would be most welcome. The FP lab is keen to receive applications from outstanding candidates with an excellent publication record, experience in combining theory with practice, and the ability to secure external funding to support their research. Further information about the FP lab is available from http://fp.cs.nott.ac.uk As an approximate guideline, candidates in the area of the FP lab would normally be expected to have at least 3 years postdoc experience, and a number of strong publications in leading international venues such as ICFP, POPL, LICS, JFP, Haskell Symposium, etc. Best wishes, Graham Hutton -- Prof Graham Hutton Functional Programming Lab School of Computer Science University of Nottingham, UK http://www.cs.nott.ac.uk/~gmh This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From carter.schonwald at gmail.com Tue Jul 8 14:42:52 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 8 Jul 2014 10:42:52 -0400 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: Yup! Heck, one of the patches merged into 7.8.3 also makes it easy for a single ghc build to work on the full range of 10.7-10.10, which is pretty darn awesome. On Tuesday, July 8, 2014, Brandon Allbery wrote: > On Tue, Jul 8, 2014 at 9:18 AM, Johan Tibell > wrote: > >> On Tue, Jul 8, 2014 at 3:00 PM, Brandon Allbery > > wrote: >>> >>> The Platform keeps getting stuck waiting for GHC. The skipped release >>> was because ghc 7.8 took some 6 months after "we plan to release just >>> before ICFP 2013"(!); now it's waiting on ghc 7.8.3 bug fixes, which were >>> "should be released by the end of the week" a couple of weeks ago. :( >>> 7.8.3's bug fixes are significant enough that it would be bad to release a >>> platform without them. >>> >> >> And we couldn't go with 7.6 because of some problems on newer OS X:es >> right? >> > > Among other things, yes (ghc 7.6 needs to be patched to work with Xcode > 5). 7.8 is supposed to improve some things on Windows as well; plus it'd be > nice to have 7.8's improvements in general. But the OS X issues are the > biggest user-facing ones, and come up pretty much every time someone tries > to install the current Platform on OS X. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlists at pmade.com Tue Jul 8 14:50:00 2014 From: mlists at pmade.com (Peter Jones) Date: Tue, 08 Jul 2014 08:50:00 -0600 Subject: [Haskell-cafe] How to have a managed window unfocusable? References: Message-ID: <87fvibucpz.fsf@pmade.com> Magicloud Magiclouds writes: > I'd like to have a transparent clock floating on my desktop. > > If I made it ignored (unmanaged), it would not be above and would be > blocked by other windows. > > If I made it managed and float, when I floated up and down, it would be > focused and I needed to press hotkey again to move focus to correct window. > > Anyway I could manage it, but not focusing on it? If you're willing to keep the window in the tiling layer I highly recommend XMonad.Layout.BoringWindows: http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Layout-BoringWindows.html Marking a window as boring and using the focusing functions from that module allow your focus key bindings to skip over the window. -- Peter Jones, Founder, Devalot.com Defending the honor of good code From bob at redivi.com Tue Jul 8 15:02:46 2014 From: bob at redivi.com (Bob Ippolito) Date: Tue, 8 Jul 2014 08:02:46 -0700 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: On Tuesday, July 8, 2014, Johan Tibell wrote: > On Tue, Jul 8, 2014 at 3:00 PM, Brandon Allbery > wrote: > >> >> On Tue, Jul 8, 2014 at 12:21 AM, Dominick Samperi > > wrote: >> >>> The Haskell Platform wiki page says the platform follows a 6-month >>> release schedule, yet the last release occurred more than one year >>> ago, and I couldn't find information about future plans. >>> >>> Are there plans to update the platform with ghc 7.8.2? >>> >> >> The Platform keeps getting stuck waiting for GHC. The skipped release was >> because ghc 7.8 took some 6 months after "we plan to release just before >> ICFP 2013"(!); now it's waiting on ghc 7.8.3 bug fixes, which were "should >> be released by the end of the week" a couple of weeks ago. :( 7.8.3's bug >> fixes are significant enough that it would be bad to release a platform >> without them. >> > > And we couldn't go with 7.6 because of some problems on newer OS X:es > right? > Releasing two platforms with the same GHC version is a recipe for disaster as well. It's currently designed to cohabitate with other versions of the platform and that is dependent on each platform release having a unique GHC release. -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Tue Jul 8 15:12:44 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Tue, 8 Jul 2014 17:12:44 +0200 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: On Tue, Jul 8, 2014 at 5:02 PM, Bob Ippolito wrote: > > Releasing two platforms with the same GHC version is a recipe for disaster > as well. It's currently designed to cohabitate with other versions of the > platform and that is dependent on each platform release having a unique GHC > release. > This sounds like something we need to fix, or we can't make HP releases more often than GHC releases, which could mean >1 year between HP releases (i.e. which is the case with 7.8 I think). -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Tue Jul 8 15:18:10 2014 From: bob at redivi.com (Bob Ippolito) Date: Tue, 8 Jul 2014 08:18:10 -0700 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: On Tuesday, July 8, 2014, Johan Tibell wrote: > On Tue, Jul 8, 2014 at 5:02 PM, Bob Ippolito > wrote: >> >> Releasing two platforms with the same GHC version is a recipe for >> disaster as well. It's currently designed to cohabitate with other versions >> of the platform and that is dependent on each platform release having a >> unique GHC release. >> > > This sounds like something we need to fix, or we can't make HP releases > more often than GHC releases, which could mean >1 year between HP releases > (i.e. which is the case with 7.8 I think). > Probably not going to happen any time soon, cabal would need to know what version of the platform is installed, if any, to get the ~/.ghc stuff correct to prevent them from trying to use the same package database. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpmoresmau at gmail.com Tue Jul 8 19:15:48 2014 From: jpmoresmau at gmail.com (JP Moresmau) Date: Tue, 8 Jul 2014 21:15:48 +0200 Subject: [Haskell-cafe] Designing widgets in Reactive style Message-ID: Hello, I'm a bit confused on how to design graphical widgets to take advantage of FRP design. I'm trying to do things in threepenny-gui but I suppose the same question applies to any framework. Suppose I want to create a "file selection widget". Currently I have a function that takes a (FilePath -> UI()) function as a parameter: what to do when a file is selected; my function returns the "widget", so that the calling code can incorporate it in its UI. This works fine, but is not FRP, right? Should my function take no arguments and return a (Widget,Event FilePath) tuple, and let the calling code decide what to do with that event? Should it be a Behavior (the currently selected file of the widget)? I *think* I understand the principles of FRP, but I'm not getting what it means in terms of design. What are the advantages of returning an Event and letting the calling code do "on myEvent myWidget $ \file -> ..." instead of just passing the handler function as a parameter? I don't know if I make much sense. In any case, any pointer to non trivial FRP GUI code would be good! Thanks a million all, -- JP Moresmau http://jpmoresmau.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From apfelmus at quantentunnel.de Tue Jul 8 20:04:24 2014 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Tue, 08 Jul 2014 22:04:24 +0200 Subject: [Haskell-cafe] Designing widgets in Reactive style In-Reply-To: References: Message-ID: JP Moresmau wrote: > Hello, I'm a bit confused on how to design graphical widgets to take > advantage of FRP design. I'm trying to do things in threepenny-gui but I > suppose the same question applies to any framework. > > Suppose I want to create a "file selection widget". Currently I have a > function that takes a (FilePath -> UI()) function as a parameter: what to > do when a file is selected; my function returns the "widget", so that the > calling code can incorporate it in its UI. This works fine, but is not FRP, > right? > > Should my function take no arguments and return a (Widget,Event FilePath) > tuple, and let the calling code decide what to do with that event? Should > it be a Behavior (the currently selected file of the widget)? I *think* I > understand the principles of FRP, but I'm not getting what it means in > terms of design. What are the advantages of returning an Event and letting > the calling code do "on myEvent myWidget $ \file -> ..." instead of just > passing the handler function as a parameter? > > I don't know if I make much sense. In any case, any pointer to non trivial > FRP GUI code would be good! I have distilled some principles for FRP widget design and wrote them down here: https://github.com/HeinrichApfelmus/threepenny-gui/blob/master/doc/design-widgets.md They are not quite complete, though, in particular the section on implementation details is lacking, mainly because I'm not entirely sure on this myself. In your particular example, I would use an `Event FilePath` and make it part of the `Widget` type, so that you have a function chosePath :: Widget -> Event FilePath The advantage of using first-class events, or FRP, in the first place is also briefly explained in the aforementioned document. From a pragmatic point of view, you could say that you certainly don't lose anything by offering an Event instead of registering a callback function. :) Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From codygman.consulting at gmail.com Tue Jul 8 22:52:44 2014 From: codygman.consulting at gmail.com (Cody Goodman) Date: Tue, 8 Jul 2014 17:52:44 -0500 Subject: [Haskell-cafe] Webdriver: Couldn't match type `Element' with `WD Element' Message-ID: I received some help/guidance in #haskell, but I still can't get this to work. I'm basically trying to find all the text elemnts in a webpage with the webdriver package. Here is my code and errors: {-# LANGUAGE OverloadedStrings #-} import Control.Monad import Control.Monad.IO.Class import Test.WebDriver import Test.WebDriver.Classes (WebDriver (..)) import Test.WebDriver.Commands import Test.WebDriver.Commands.Wait main = do runSession defaultSession capabilities $ do openPage "http://www.appnitro.com/demo/view.php?id=1" inputs <- findElems $ ByTag "input" textElems <- filterM (liftM $ ((==) "text" . (`attr` "type"))) inputs -- wait 20 seconds waitUntil 20 (getText <=< findElem $ ByCSS ".doesnotexist") `onTimeout` return "" liftIO $ putStrLn "done" where capabilities = allCaps { browser=firefox } -- [1 of 1] Compiling Main ( src/Main.hs, interpreted ) -- src/Main.hs:168:70: -- Couldn't match type `Element' with `WD Element' -- Expected type: [WD Element] -- Actual type: [Element] -- In the second argument of `filterM', namely `inputs' -- In a stmt of a 'do' block: -- textElems <- filterM -- (liftM $ ((==) "text" . (`attr` "type"))) inputs -- In the second argument of `($)', namely -- `do { openPage "http://www.appnitro.com/demo/view.php?id=1"; -- inputs <- findElems $ ByTag "input"; -- textElems <- filterM -- (liftM $ ((==) "text" . (`attr` "type"))) inputs; -- waitUntil 20 (getText <=< findElem $ ByCSS ".doesnotexist") -- `onTimeout` return "" }' -- Failed, modules loaded: none. From allbery.b at gmail.com Tue Jul 8 23:02:22 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 8 Jul 2014 19:02:22 -0400 Subject: [Haskell-cafe] Webdriver: Couldn't match type `Element' with `WD Element' In-Reply-To: References: Message-ID: On Tue, Jul 8, 2014 at 6:52 PM, Cody Goodman wrote: > textElems <- filterM (liftM $ ((==) "text" . (`attr` "type"))) inputs > Are you sure this shouldn't be: let textElems = filter ((==) "text" . `attr` "type") inputs ? The type in the error suggests this is more appropriate. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From codygman.consulting at gmail.com Tue Jul 8 23:16:23 2014 From: codygman.consulting at gmail.com (Cody Goodman) Date: Tue, 8 Jul 2014 18:16:23 -0500 Subject: [Haskell-cafe] Webdriver: Couldn't match type `Element' with `WD Element' In-Reply-To: References: Message-ID: That gave a syntax error, however this was valid: let textElems = filter ((==) "text" . (`attr` "type")) inputs It then gave me some ambiguous type errors: {-# LANGUAGE OverloadedStrings #-} import Control.Monad import Control.Monad.IO.Class import qualified Data.Text as T import Test.WebDriver import Test.WebDriver.Classes (WebDriver (..)) import Test.WebDriver.Commands import Test.WebDriver.Commands.Wait main = do runSession defaultSession capabilities $ do openPage "http://www.appnitro.com/demo/view.php?id=1" inputs <- findElems $ ByTag "input" let textElems = filter ((==) ("text") . (`attr` "type")) inputs :: [Element] -- wait 20 seconds waitUntil 20 (getText <=< findElem $ ByCSS ".doesnotexist") `onTimeout` return "" liftIO $ putStrLn "done" where capabilities = allCaps { browser=firefox } -- Prelude Control.Monad Control.Monad.IO.Class Control.Monad.Trans.Class> :r -- [1 of 1] Compiling Main ( src/Main.hs, interpreted ) -- src/Main.hs:15:31: -- No instance for (Eq (wd0 (Maybe T.Text))) -- arising from a use of ?==? -- The type variable ?wd0? is ambiguous -- Note: there are several potential instances: -- instance Eq a => Eq (GHC.Real.Ratio a) -- Defined in ?GHC.Real? -- instance Eq (Test.WebDriver.Common.Profile.PreparedProfile b) -- -- Defined in ?Test.WebDriver.Common.Profile? -- instance Eq (Test.WebDriver.Common.Profile.Profile b) -- -- Defined in ?Test.WebDriver.Common.Profile? -- ...plus 27 others -- In the first argument of ?(.)?, namely ?(==) ("text")? -- In the first argument of ?filter?, namely -- ?((==) ("text") . (`attr` "type"))? -- In the expression: -- filter ((==) ("text") . (`attr` "type")) inputs :: [Element] -- src/Main.hs:15:37: -- No instance for (Data.String.IsString (wd0 (Maybe T.Text))) -- arising from the literal ?"text"? -- The type variable ?wd0? is ambiguous -- Note: there is a potential instance available: -- instance a ~ Data.ByteString.Internal.ByteString => -- Data.String.IsString -- (attoparsec-0.12.1.0:Data.Attoparsec.ByteString.Internal.Parser a) -- -- Defined in ?attoparsec-0.12.1.0:Data.Attoparsec.ByteString.Char8? -- In the first argument of ?(==)?, namely ?("text")? -- In the first argument of ?(.)?, namely ?(==) ("text")? -- In the first argument of ?filter?, namely -- ?((==) ("text") . (`attr` "type"))? I then remembered that the type of attr is WebDriver wd => Element -> Text -> wd (Maybe Text) and made this change: - let textElems = filter ((==) ("text") . (`attr` "type")) inputs :: [Element] + let textElems = filter ((==) (Just "text" :: Maybe T.Text) . (`attr` "type")) inputs :: [Element] and got what I believe to be a monadic error: Prelude Control.Monad Control.Monad.IO.Class Control.Monad.Trans.Class> :r [1 of 1] Compiling Main ( src/Main.hs, interpreted ) src/Main.hs:15:69: Couldn't match type ?Maybe T.Text? with ?T.Text? Expected type: Element -> Maybe T.Text Actual type: Element -> Maybe (Maybe T.Text) In the second argument of ?(.)?, namely ?(`attr` "type")? In the first argument of ?filter?, namely ?((==) (Just "text" :: Maybe T.Text) . (`attr` "type"))? In the expression: filter ((==) (Just "text" :: Maybe T.Text) . (`attr` "type")) inputs :: [Element] Failed, modules loaded: none. This led me to make this change: -let textElems = filter ((==) (Just "text" :: Maybe T.Text) . (`attr` "type")) inputs :: [Element] +let textElems = filter ((==) (return $ Just "text" :: Maybe T.Text) . (`attr` "type")) inputs :: [Element] and I got the following error: src/Main.hs:15:78: Couldn't match type ?Maybe T.Text? with ?T.Text? Expected type: Element -> Maybe T.Text Actual type: Element -> Maybe (Maybe T.Text) In the second argument of ?(.)?, namely ?(`attr` "type")? In the first argument of ?filter?, namely ?((==) (return $ Just "text" :: Maybe T.Text) . (`attr` "type"))? In the expression: filter ((==) (return $ Just "text" :: Maybe T.Text) . (`attr` "type")) inputs :: [Element] Failed, modules loaded: none. On Tue, Jul 8, 2014 at 6:02 PM, Brandon Allbery wrote: > > On Tue, Jul 8, 2014 at 6:52 PM, Cody Goodman > wrote: >> >> textElems <- filterM (liftM $ ((==) "text" . (`attr` "type"))) >> inputs > > > Are you sure this shouldn't be: > > let textElems = filter ((==) "text" . `attr` "type") inputs > > ? The type in the error suggests this is more appropriate. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net From kazu at iij.ad.jp Wed Jul 9 01:10:33 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Wed, 09 Jul 2014 10:10:33 +0900 (JST) Subject: [Haskell-cafe] Travis CI Message-ID: <20140709.101033.409813220405960716.kazu@iij.ad.jp> Hi, This is just FYI. As you may know, Travis CI itself provides multiple versions of GHC now: http://docs.travis-ci.com/user/languages/haskell/ But I was suffering from test failures indicated by: ghc_find: command not found I heard that this problem is fixed today. https://github.com/travis-ci/travis-ci/issues/2364 --Kazu From mwotton at gmail.com Wed Jul 9 01:47:02 2014 From: mwotton at gmail.com (Mark Wotton) Date: Wed, 9 Jul 2014 08:47:02 +0700 Subject: [Haskell-cafe] security update practice? Message-ID: Hi all, there was a security update to the underlying library to one of my bindings last night (lz4) and it got me thinking - how do we handle security updates as a community? I typically find out from IRC or twitter now, which isn't particularly reliable. Might it be possible to mark an update on Hackage as a security update rather than feature update? cheers Mark -- A UNIX signature isn't a return address, it's the ASCII equivalent of a black velvet clown painting. It's a rectangle of carets surrounding a quote from a literary giant of weeniedom like Heinlein or Dr. Who. -- Chris Maeda From carter.schonwald at gmail.com Wed Jul 9 03:23:59 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Tue, 8 Jul 2014 23:23:59 -0400 Subject: [Haskell-cafe] security update practice? In-Reply-To: References: Message-ID: You can actually mark specific package releases deprecated on hackage. Which prevents cabal from picking it as part of a build plan. This of course doesn't handle the dissemination issue of course. On Tuesday, July 8, 2014, Mark Wotton wrote: > Hi all, > > there was a security update to the underlying library to one of my > bindings last night (lz4) and it got me thinking - how do we handle > security updates as a community? I typically find out from IRC or > twitter now, which isn't particularly reliable. Might it be possible > to mark an update on Hackage as a security update rather than feature > update? > > cheers > Mark > > -- > A UNIX signature isn't a return address, it's the ASCII equivalent of a > black velvet clown painting. It's a rectangle of carets surrounding a > quote from a literary giant of weeniedom like Heinlein or Dr. Who. > -- Chris Maeda > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rasfar at gmail.com Wed Jul 9 03:31:54 2014 From: rasfar at gmail.com (Andrew Seniuk) Date: Tue, 8 Jul 2014 21:31:54 -0600 Subject: [Haskell-cafe] ANNOUNCE: sai-shape-syb Generic mapping to homogeneous types (etc.) Message-ID: This package provides some support for dealing with polytypic data. It lets you escape from the generics world and work with a homogeneous rose tree, which can sometimes be convenient. I realise a more experienced programmer would probably do this differently, but anyhow it was useful to me and I've uploaded it. http://hackage.haskell.org/package/sai-shape-syb There are some examples at http://fremissant.net/shape-syb In particular, it supports GHC staged traversals, so for those trying to work with the GHC AST this might be a helpful tool for filtering, debugging, and suchlike. Kind Regards, Andrew Seniuk rasfar on #haskell -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus at therning.org Wed Jul 9 06:10:05 2014 From: magnus at therning.org (Magnus Therning) Date: Wed, 9 Jul 2014 08:10:05 +0200 Subject: [Haskell-cafe] Turning a message parser into a protocol handler Message-ID: <20140709061005.GB1743@tatooine> The last few days I've been playing around with the combination of attoparsec/blaze/conduit to build a parser and a generator of messages in a small proprietary protocol used at work. The goal is to easily build small clients of the protocol, and possibly, if time permits, build a server in Haskell which mimics the C implementation of the server. I've come so far that the message parsing and generating is working. I've also put together a couple of tiny clients to verify that my Haskell code can communicate with the production implementation of the server. I've done this by manually tying the toy example behaviour into my conduit process. However, I recognise that as the required behaviour becomes more and more complex my thinking about the behaviour more and more resembles a finite automaton (or FSM). This led me to look around for an FSM generator tool or library for Haskell, but found none. Did I miss something in my search? Or maybe Haskell already IS the FSM generator tool I need. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: From jpmoresmau at gmail.com Wed Jul 9 07:01:17 2014 From: jpmoresmau at gmail.com (JP Moresmau) Date: Wed, 9 Jul 2014 09:01:17 +0200 Subject: [Haskell-cafe] Designing widgets in Reactive style In-Reply-To: References: Message-ID: OK thank you very much, I hadn't seen that page!! JP On Tue, Jul 8, 2014 at 10:04 PM, Heinrich Apfelmus < apfelmus at quantentunnel.de> wrote: > JP Moresmau wrote: > >> Hello, I'm a bit confused on how to design graphical widgets to take >> advantage of FRP design. I'm trying to do things in threepenny-gui but I >> suppose the same question applies to any framework. >> >> Suppose I want to create a "file selection widget". Currently I have a >> function that takes a (FilePath -> UI()) function as a parameter: what to >> do when a file is selected; my function returns the "widget", so that the >> calling code can incorporate it in its UI. This works fine, but is not >> FRP, >> right? >> >> Should my function take no arguments and return a (Widget,Event FilePath) >> tuple, and let the calling code decide what to do with that event? Should >> it be a Behavior (the currently selected file of the widget)? I *think* I >> understand the principles of FRP, but I'm not getting what it means in >> terms of design. What are the advantages of returning an Event and letting >> the calling code do "on myEvent myWidget $ \file -> ..." instead of just >> passing the handler function as a parameter? >> >> I don't know if I make much sense. In any case, any pointer to non trivial >> FRP GUI code would be good! >> > > I have distilled some principles for FRP widget design and wrote them down > here: > > https://github.com/HeinrichApfelmus/threepenny-gui/blob/master/doc/design- > widgets.md > > They are not quite complete, though, in particular the section on > implementation details is lacking, mainly because I'm not entirely sure on > this myself. > > > In your particular example, I would use an `Event FilePath` and make it > part of the `Widget` type, so that you have a function > > chosePath :: Widget -> Event FilePath > > The advantage of using first-class events, or FRP, in the first place is > also briefly explained in the aforementioned document. > > From a pragmatic point of view, you could say that you certainly don't > lose anything by offering an Event instead of registering a callback > function. :) > > > Best regards, > Heinrich Apfelmus > > -- > http://apfelmus.nfshost.com > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- JP Moresmau http://jpmoresmau.blogspot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From codygman.consulting at gmail.com Wed Jul 9 10:37:43 2014 From: codygman.consulting at gmail.com (Cody Goodman) Date: Wed, 9 Jul 2014 05:37:43 -0500 Subject: [Haskell-cafe] Webdriver: Couldn't match type `Element' with `WD Element' In-Reply-To: References: Message-ID: I've posted this question to stackoverflow: https://stackoverflow.com/questions/24650813/find-all-text-inputs-on-webpage-with-haskell-webdriver-package On Tue, Jul 8, 2014 at 6:16 PM, Cody Goodman wrote: > That gave a syntax error, however this was valid: > > let textElems = filter ((==) "text" . (`attr` "type")) inputs > > It then gave me some ambiguous type errors: > > {-# LANGUAGE OverloadedStrings #-} > > import Control.Monad > import Control.Monad.IO.Class > import qualified Data.Text as T > import Test.WebDriver > import Test.WebDriver.Classes (WebDriver (..)) > import Test.WebDriver.Commands > import Test.WebDriver.Commands.Wait > > main = do > runSession defaultSession capabilities $ do > openPage "http://www.appnitro.com/demo/view.php?id=1" > inputs <- findElems $ ByTag "input" > let textElems = filter ((==) ("text") . (`attr` "type")) > inputs :: [Element] > -- wait 20 seconds > waitUntil 20 (getText <=< findElem $ ByCSS ".doesnotexist") > `onTimeout` return "" > liftIO $ putStrLn "done" > where > capabilities = allCaps { browser=firefox } > > > -- Prelude Control.Monad Control.Monad.IO.Class > Control.Monad.Trans.Class> :r > -- [1 of 1] Compiling Main ( src/Main.hs, interpreted ) > > -- src/Main.hs:15:31: > -- No instance for (Eq (wd0 (Maybe T.Text))) > -- arising from a use of ?==? > -- The type variable ?wd0? is ambiguous > -- Note: there are several potential instances: > -- instance Eq a => Eq (GHC.Real.Ratio a) -- Defined in ?GHC.Real? > -- instance Eq (Test.WebDriver.Common.Profile.PreparedProfile b) > -- -- Defined in ?Test.WebDriver.Common.Profile? > -- instance Eq (Test.WebDriver.Common.Profile.Profile b) > -- -- Defined in ?Test.WebDriver.Common.Profile? > -- ...plus 27 others > -- In the first argument of ?(.)?, namely ?(==) ("text")? > -- In the first argument of ?filter?, namely > -- ?((==) ("text") . (`attr` "type"))? > -- In the expression: > -- filter ((==) ("text") . (`attr` "type")) inputs :: [Element] > > -- src/Main.hs:15:37: > -- No instance for (Data.String.IsString (wd0 (Maybe T.Text))) > -- arising from the literal ?"text"? > -- The type variable ?wd0? is ambiguous > -- Note: there is a potential instance available: > -- instance a ~ Data.ByteString.Internal.ByteString => > -- Data.String.IsString > -- > (attoparsec-0.12.1.0:Data.Attoparsec.ByteString.Internal.Parser a) > -- -- Defined in > ?attoparsec-0.12.1.0:Data.Attoparsec.ByteString.Char8? > -- In the first argument of ?(==)?, namely ?("text")? > -- In the first argument of ?(.)?, namely ?(==) ("text")? > -- In the first argument of ?filter?, namely > -- ?((==) ("text") . (`attr` "type"))? > > I then remembered that the type of attr is WebDriver wd => Element -> > Text -> wd (Maybe Text) and made this change: > > - let textElems = filter ((==) ("text") . (`attr` "type")) inputs > :: [Element] > + let textElems = filter ((==) (Just "text" :: Maybe T.Text) . > (`attr` "type")) inputs :: [Element] > > and got what I believe to be a monadic error: > > Prelude Control.Monad Control.Monad.IO.Class Control.Monad.Trans.Class> :r > [1 of 1] Compiling Main ( src/Main.hs, interpreted ) > > src/Main.hs:15:69: > Couldn't match type ?Maybe T.Text? with ?T.Text? > Expected type: Element -> Maybe T.Text > Actual type: Element -> Maybe (Maybe T.Text) > In the second argument of ?(.)?, namely ?(`attr` "type")? > In the first argument of ?filter?, namely > ?((==) (Just "text" :: Maybe T.Text) . (`attr` "type"))? > In the expression: > filter > ((==) (Just "text" :: Maybe T.Text) . (`attr` "type")) inputs :: > [Element] > Failed, modules loaded: none. > > This led me to make this change: > > -let textElems = filter ((==) (Just "text" :: Maybe T.Text) . > (`attr` "type")) inputs :: [Element] > +let textElems = filter ((==) (return $ Just "text" :: Maybe > T.Text) . (`attr` "type")) inputs :: [Element] > > and I got the following error: > > src/Main.hs:15:78: > Couldn't match type ?Maybe T.Text? with ?T.Text? > Expected type: Element -> Maybe T.Text > Actual type: Element -> Maybe (Maybe T.Text) > In the second argument of ?(.)?, namely ?(`attr` "type")? > In the first argument of ?filter?, namely > ?((==) (return $ Just "text" :: Maybe T.Text) . (`attr` "type"))? > In the expression: > filter > ((==) (return $ Just "text" :: Maybe T.Text) . (`attr` "type")) > inputs :: > [Element] > Failed, modules loaded: none. > > On Tue, Jul 8, 2014 at 6:02 PM, Brandon Allbery wrote: >> >> On Tue, Jul 8, 2014 at 6:52 PM, Cody Goodman >> wrote: >>> >>> textElems <- filterM (liftM $ ((==) "text" . (`attr` "type"))) >>> inputs >> >> >> Are you sure this shouldn't be: >> >> let textElems = filter ((==) "text" . `attr` "type") inputs >> >> ? The type in the error suggests this is more appropriate. >> >> -- >> brandon s allbery kf8nh sine nomine associates >> allbery.b at gmail.com ballbery at sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net From alois.cochard at gmail.com Wed Jul 9 11:29:27 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Wed, 9 Jul 2014 12:29:27 +0100 Subject: [Haskell-cafe] security update practice? In-Reply-To: References: Message-ID: I think it's an issue since I learnt that the platform can not be update on his own (need a new GHC version)... How can we integrate security fix in the platform?... We can't... On Jul 9, 2014 2:47 AM, "Mark Wotton" wrote: > Hi all, > > there was a security update to the underlying library to one of my > bindings last night (lz4) and it got me thinking - how do we handle > security updates as a community? I typically find out from IRC or > twitter now, which isn't particularly reliable. Might it be possible > to mark an update on Hackage as a security update rather than feature > update? > > cheers > Mark > > -- > A UNIX signature isn't a return address, it's the ASCII equivalent of a > black velvet clown painting. It's a rectangle of carets surrounding a > quote from a literary giant of weeniedom like Heinlein or Dr. Who. > -- Chris Maeda > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Wed Jul 9 14:52:29 2014 From: bob at redivi.com (Bob Ippolito) Date: Wed, 9 Jul 2014 07:52:29 -0700 Subject: [Haskell-cafe] security update practice? In-Reply-To: References: Message-ID: Adding a security fix in general is going to be tough since you'd have to rebuild all of the packages that the user has that depend on that package or else it would be instant cabal hell (which is basically why platform releases work best with different compiler versions). One alternative would be for the platform to add some artificial stuff to the GHC version so that its package db doesn't clash with anything else? On Wednesday, July 9, 2014, Alois Cochard wrote: > I think it's an issue since I learnt that the platform can not be update > on his own (need a new GHC version)... > > How can we integrate security fix in the platform?... We can't... > On Jul 9, 2014 2:47 AM, "Mark Wotton" > wrote: > >> Hi all, >> >> there was a security update to the underlying library to one of my >> bindings last night (lz4) and it got me thinking - how do we handle >> security updates as a community? I typically find out from IRC or >> twitter now, which isn't particularly reliable. Might it be possible >> to mark an update on Hackage as a security update rather than feature >> update? >> >> cheers >> Mark >> >> -- >> A UNIX signature isn't a return address, it's the ASCII equivalent of a >> black velvet clown painting. It's a rectangle of carets surrounding a >> quote from a literary giant of weeniedom like Heinlein or Dr. Who. >> -- Chris Maeda >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From isak.hansen at gmail.com Wed Jul 9 17:40:24 2014 From: isak.hansen at gmail.com (Isak Hansen) Date: Wed, 9 Jul 2014 19:40:24 +0200 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients Message-ID: Let's just imagine there aren't enough poker sites out there already and that it makes sense to build another one. Basically, there will be players connecting to one or more tables, most likely talking some kind of JSON based protocol with the server(s). #1 - What's a good way to set up and maintain compressed and encrypted connections from the clients to my cluster? I've been wanting to try out websockets, think that'll do? #2 - I'm new to Haskell and would appreciate thoughts on how to store and process game state. Imagine a plain application managing 1000 tables of poker, responding to player input (that magically appears) and timer events (e.g. folding players that fail to take action). What data structures and libraries should I be looking at here? Thoughts on concurrency and how I organize program flow? #3 - I'm thinking of ZMQ to wire components together. Would I be better off basing my cluster on Cloud Haskell or some other library for distributed work? Would love some quick pointers and feedback here, thanks in advance, Isak -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.gibiansky at gmail.com Wed Jul 9 18:01:44 2014 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Wed, 9 Jul 2014 11:01:44 -0700 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients In-Reply-To: References: Message-ID: I don't have any comments on the specifics of your application, but I've used zeromq4-haskell [0] for IHaskell and it's a solid library that works well. There's also zeromq-haskell (instead of zeromq4-haskell) if you want older ZeroMQ. I was using it for local communication, not networked though, so not sure if that changes anything. It is fairly low-level, though, so I imagine Cloud Haskell can give you a higher level of abstraction when dealing with networking stuff. [0] https://hackage.haskell.org/package/zeromq4-haskell On Wed, Jul 9, 2014 at 10:40 AM, Isak Hansen wrote: > Let's just imagine there aren't enough poker sites out there already and > that it makes sense to build another one. Basically, there will be players > connecting to one or more tables, most likely talking some kind of JSON > based protocol with the server(s). > > #1 - What's a good way to set up and maintain compressed and encrypted > connections from the clients to my cluster? I've been wanting to try out > websockets, think that'll do? > > #2 - I'm new to Haskell and would appreciate thoughts on how to store and > process game state. Imagine a plain application managing 1000 tables of > poker, responding to player input (that magically appears) and timer events > (e.g. folding players that fail to take action). What data structures and > libraries should I be looking at here? Thoughts on concurrency and how I > organize program flow? > > #3 - I'm thinking of ZMQ to wire components together. Would I be better > off basing my cluster on Cloud Haskell or some other library for > distributed work? > > > Would love some quick pointers and feedback here, thanks in advance, > Isak > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wojtek at power.com.pl Wed Jul 9 18:52:05 2014 From: wojtek at power.com.pl (=?UTF-8?B?V29qdGVrIE5hcmN6ecWEc2tp?=) Date: Wed, 09 Jul 2014 20:52:05 +0200 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients In-Reply-To: References: Message-ID: <53BD8F55.9080409@power.com.pl> On 09.07.2014 19:40, Isak Hansen wrote: Thousands of connections, your smartphone wouldn't handle, not to mention a server. > #1 - What's a good way to set up and maintain compressed and encrypted > connections from the clients to my cluster? I've been wanting to try > out websockets, think that'll do? > http://caniuse.com/websockets - WebSockets browser compatibility, caveat emptor > #2 - I'm new to Haskell and would appreciate thoughts on how to store > and process game state. Imagine a plain application managing 1000 > tables of poker, responding to player input (that magically appears) > and timer events (e.g. folding players that fail to take action). What > data structures and libraries should I be looking at here? Thoughts on > concurrency and how I organize program flow? > I would spawn a process for each game, and a process for each player. > #3 - I'm thinking of ZMQ to wire components together. Would I be > better off basing my cluster on Cloud Haskell or some other library > for distributed work? > Erlang/OTP is great, but I have a feeling that something was 'lost in translation' to Haskell, and that thing is simplicity. For example, I do not understand why such a small cabal package has been split into multiple tiny cabal packages. This is the fuel that cabal hell fire burns on. Despite this, I would give Cloud Haskell a try. If you don't you, will have to rediscover things like supervision hierarchy, not to mention timeouts as the first line of defense againtst all kinds of concurrency problems. Erlang/OTP really does get certain things right. -- Kind regards, Wojtek N. From alois.cochard at gmail.com Wed Jul 9 18:53:35 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Wed, 9 Jul 2014 19:53:35 +0100 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients In-Reply-To: References: Message-ID: Hi Isak, On 9 July 2014 18:40, Isak Hansen wrote: > > #2 - I'm new to Haskell and would appreciate thoughts on how to store and > process game state. Imagine a plain application managing 1000 tables of > poker, responding to player input (that magically appears) and timer events > (e.g. folding players that fail to take action). What data structures and > libraries should I be looking at here? Thoughts on concurrency and how I > organize program flow? > If I had to build an system like this, the main design principle I would adopt is to not try to share the state of games among nodes, but instead redirect players of the same game on the same node (where you basically have a thread processing the event of the game and updating the state in memory). Then I would probably use some form of event sourcing to record game action which could be use in case of node crash to recreate a game state by replaying events. The event source could then be used as well to generate stats/views in near real-time. -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.kjeldaas at gmail.com Wed Jul 9 20:48:42 2014 From: alexander.kjeldaas at gmail.com (Alexander Kjeldaas) Date: Wed, 9 Jul 2014 22:48:42 +0200 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients In-Reply-To: References: Message-ID: I'd have user state serviced by a thread per user. Then have separate game state serviced by another thread. Then use zmq or cloud Haskell for interconnect between the two states. Scalability games then boils down to what cross sectional bandwidth you can get by optimizing the interconnect and the placement/locality of the state. Scaling the number of client connections can be done independently. Alexander On Jul 9, 2014 7:40 PM, "Isak Hansen" wrote: > Let's just imagine there aren't enough poker sites out there already and > that it makes sense to build another one. Basically, there will be players > connecting to one or more tables, most likely talking some kind of JSON > based protocol with the server(s). > > #1 - What's a good way to set up and maintain compressed and encrypted > connections from the clients to my cluster? I've been wanting to try out > websockets, think that'll do? > > #2 - I'm new to Haskell and would appreciate thoughts on how to store and > process game state. Imagine a plain application managing 1000 tables of > poker, responding to player input (that magically appears) and timer events > (e.g. folding players that fail to take action). What data structures and > libraries should I be looking at here? Thoughts on concurrency and how I > organize program flow? > > #3 - I'm thinking of ZMQ to wire components together. Would I be better > off basing my cluster on Cloud Haskell or some other library for > distributed work? > > > Would love some quick pointers and feedback here, thanks in advance, > Isak > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sven.bartscher at weltraumschlangen.de Wed Jul 9 21:33:35 2014 From: sven.bartscher at weltraumschlangen.de (Sven Bartscher) Date: Wed, 9 Jul 2014 23:33:35 +0200 Subject: [Haskell-cafe] Taking over setlocale Message-ID: <20140709233335.1d65dffb@sven.bartscher> Greetings, I would like to take over the setlocale package. Following the steps described on http://www.haskell.org/haskellwiki/Taking_over_a_package I need to state my intention on a public forum. The original author (Lukas Mai) published his package in the Public Domain. This would be fine, but the Author seems to be living in Germany. The problem with that is that in Germany an author is not allowed to give up his copyright in this way. This means the licensing of the package defaults to "All rights reserved", making the package undistributable. I already tried to contact the author about this problem, but he didn't respond in a week. This isn't a very long time, but I didn't get an answer on past attempts to contact him (this was at least a month, but probably more, ago). To solve this problem, I rewrote the setlocale binding with the same API under the BSD3-clause. PS: Please keep the CC to Lukas Mai and the debian-haskell list intact. Regards Sven -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: not available URL: From carter.schonwald at gmail.com Wed Jul 9 21:39:30 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 9 Jul 2014 17:39:30 -0400 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients In-Reply-To: <53BD8F55.9080409@power.com.pl> References: <53BD8F55.9080409@power.com.pl> Message-ID: the courier package on hackage seems to strike a better balance vs CH https://hackage.haskell.org/package/courier On Wed, Jul 9, 2014 at 2:52 PM, Wojtek Narczy?ski wrote: > On 09.07.2014 19:40, Isak Hansen wrote: > > Thousands of connections, your smartphone wouldn't handle, not to mention > a server. > > > #1 - What's a good way to set up and maintain compressed and encrypted >> connections from the clients to my cluster? I've been wanting to try out >> websockets, think that'll do? >> >> > http://caniuse.com/websockets - WebSockets browser compatibility, caveat > emptor > > > #2 - I'm new to Haskell and would appreciate thoughts on how to store and >> process game state. Imagine a plain application managing 1000 tables of >> poker, responding to player input (that magically appears) and timer events >> (e.g. folding players that fail to take action). What data structures and >> libraries should I be looking at here? Thoughts on concurrency and how I >> organize program flow? >> >> > I would spawn a process for each game, and a process for each player. > > > #3 - I'm thinking of ZMQ to wire components together. Would I be better >> off basing my cluster on Cloud Haskell or some other library for >> distributed work? >> >> Erlang/OTP is great, but I have a feeling that something was 'lost in > translation' to Haskell, and that thing is simplicity. For example, I do > not understand why such a small cabal package has been split into multiple > tiny cabal packages. This is the fuel that cabal hell fire burns on. > Despite this, I would give Cloud Haskell a try. If you don't you, will have > to rediscover things like supervision hierarchy, not to mention timeouts as > the first line of defense againtst all kinds of concurrency problems. > Erlang/OTP really does get certain things right. > > -- > Kind regards, > Wojtek N. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Wed Jul 9 21:56:39 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 9 Jul 2014 17:56:39 -0400 Subject: [Haskell-cafe] Taking over setlocale In-Reply-To: <20140709233335.1d65dffb@sven.bartscher> References: <20140709233335.1d65dffb@sven.bartscher> Message-ID: a) thats not how taking over maintainer ship works b) http://www.haskell.org/haskellwiki/Taking_over_a_package taking over a package without the maintainers permission requires the maintainer being unreachable for 6-12 months (or longer) On Wed, Jul 9, 2014 at 5:33 PM, Sven Bartscher < sven.bartscher at weltraumschlangen.de> wrote: > Greetings, > > I would like to take over the setlocale package. Following the steps > described on http://www.haskell.org/haskellwiki/Taking_over_a_package I > need to state my intention on a public forum. > > The original author (Lukas Mai) published his package in the Public > Domain. This would be fine, but the Author seems to be living in > Germany. The problem with that is that in Germany an author is not > allowed to give up his copyright in this way. This means the licensing > of the package defaults to "All rights reserved", making the package > undistributable. > > I already tried to contact the author about this problem, but he didn't > respond in a week. This isn't a very long time, but I didn't get an > answer on past attempts to contact him (this was at least a month, but > probably more, ago). > > To solve this problem, I rewrote the setlocale binding with the same API > under the BSD3-clause. > > PS: Please keep the CC to Lukas Mai and the debian-haskell list > intact. > > Regards > Sven > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wojtek at power.com.pl Wed Jul 9 22:05:57 2014 From: wojtek at power.com.pl (=?UTF-8?B?V29qdGVrIE5hcmN6ecWEc2tp?=) Date: Thu, 10 Jul 2014 00:05:57 +0200 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients In-Reply-To: References: <53BD8F55.9080409@power.com.pl> Message-ID: <53BDBCC5.8060506@power.com.pl> On 09.07.2014 23:39, Carter Schonwald wrote: > the courier package on hackage seems to strike a better balance vs CH > https://hackage.haskell.org/package/courier > Well, no. There really is great value in the OTP part of Erlang/OTP, while this package only provides Erlang (messaging). -- Wojtek From clint at debian.org Wed Jul 9 22:42:26 2014 From: clint at debian.org (Clint Adams) Date: Wed, 9 Jul 2014 22:42:26 +0000 Subject: [Haskell-cafe] Taking over setlocale In-Reply-To: <20140708154100.4436ba68@sven.bartscher> References: <20140708154100.4436ba68@sven.bartscher> Message-ID: <20140709224226.GA9316@scru.org> On Tue, Jul 08, 2014 at 03:41:00PM +0200, Sven Bartscher wrote: > To solve this problem, I rewrote the setlocale binding with the same API > under the BSD3-clause. Have you considered submitting this as a patch to the unix package, since setlocale() is POSIX? From adam at bergmark.nl Wed Jul 9 23:01:12 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Thu, 10 Jul 2014 01:01:12 +0200 Subject: [Haskell-cafe] security update practice? In-Reply-To: References: Message-ID: On Wed, Jul 9, 2014 at 5:23 AM, Carter Schonwald wrote: > You can actually mark specific package releases deprecated on hackage. > Which prevents cabal from picking it as part of a build plan. This of > course doesn't handle the dissemination issue of course. A deprecated version is not a hard constraint. In particular Cabal seems to prefer installed versions over deprecations, so in a lot of cases the deprecated versions will still be picked. > On Tuesday, July 8, 2014, Mark Wotton wrote: > >> Hi all, >> >> there was a security update to the underlying library to one of my >> bindings last night (lz4) and it got me thinking - how do we handle >> security updates as a community? I typically find out from IRC or >> twitter now, which isn't particularly reliable. Might it be possible >> to mark an update on Hackage as a security update rather than feature >> update? >> >> cheers >> Mark >> >> -- >> A UNIX signature isn't a return address, it's the ASCII equivalent of a >> black velvet clown painting. It's a rectangle of carets surrounding a >> quote from a literary giant of weeniedom like Heinlein or Dr. Who. >> -- Chris Maeda >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From benjamin.foppa at gmail.com Wed Jul 9 23:52:17 2014 From: benjamin.foppa at gmail.com (Ben Foppa) Date: Wed, 9 Jul 2014 19:52:17 -0400 Subject: [Haskell-cafe] extensible-transformers Message-ID: Hi cafe, I whipped up extensible-transformers ( https://github.com/RobotGymnast/extensible-transformers) this afternoon. The idea is to make Monad transformer code more like extensible-effects code (http://hackage.haskell.org/package/extensible-effects). Here's a sample: {-# LANGUAGE FlexibleContexts #-} module Main(main) where import Control.Monad.Trans.Flexible import Control.Monad.Trans.List import Control.Monad.Trans.State.Strict -- A flexible transformer stack built from existing transformers using `liftT`. bar :: (In (StateT Int) t, In ListT t) => t () bar = do n <- liftT get liftT $ ListT $ return $ replicate n () -- A flexible transformer stack built from existing transformers using `liftT`. baz :: In (StateT Int) t => t () baz = do liftT $ state $ \i -> ((), i + (1 :: Int)) -- A flexible transformer monad stack composed of two other flexible -- transformer monad stacks. foo :: (In (StateT Int) t, In ListT t) => t () foo = do bar baz main :: IO () main = do evalStateT (runListT foo) (1 :: Int) >>= putStrLn . show runListT (evalStateT foo (2 :: Int)) >>= putStrLn . show Any feedback on this? Does such a package already exist? Thanks, Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From gershomb at gmail.com Thu Jul 10 00:06:10 2014 From: gershomb at gmail.com (Gershom Bazerman) Date: Wed, 09 Jul 2014 20:06:10 -0400 Subject: [Haskell-cafe] Taking over setlocale In-Reply-To: References: <20140709233335.1d65dffb@sven.bartscher> Message-ID: <53BDD8F2.2030208@gmail.com> On 7/9/14, 5:56 PM, Carter Schonwald wrote: > a) thats not how taking over maintainer ship works > b) http://www.haskell.org/haskellwiki/Taking_over_a_package > > taking over a package without the maintainers permission requires the > maintainer being unreachable for 6-12 months (or longer) The guideline there is "a reasonable time". That is much closer to 1 month than 6-12 months. I think one week is a bit short, but overall sven seems to be following the process well, and given the last update date on that package, we should still give a reasonable time to respond, but I would err on the side of brevity if anything. --Gershom > > On Wed, Jul 9, 2014 at 5:33 PM, Sven Bartscher > > wrote: > > Greetings, > > I would like to take over the setlocale package. Following the steps > described on > http://www.haskell.org/haskellwiki/Taking_over_a_package I > need to state my intention on a public forum. > > The original author (Lukas Mai) published his package in the Public > Domain. This would be fine, but the Author seems to be living in > Germany. The problem with that is that in Germany an author is not > allowed to give up his copyright in this way. This means the licensing > of the package defaults to "All rights reserved", making the package > undistributable. > > I already tried to contact the author about this problem, but he > didn't > respond in a week. This isn't a very long time, but I didn't get an > answer on past attempts to contact him (this was at least a month, but > probably more, ago). > > To solve this problem, I rewrote the setlocale binding with the > same API > under the BSD3-clause. > > PS: Please keep the CC to Lukas Mai and the debian-haskell list > intact. > > Regards > Sven > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Thu Jul 10 01:14:46 2014 From: vogt.adam at gmail.com (adam vogt) Date: Wed, 9 Jul 2014 21:14:46 -0400 Subject: [Haskell-cafe] Taking over setlocale In-Reply-To: <53BDD8F2.2030208@gmail.com> References: <20140709233335.1d65dffb@sven.bartscher> <53BDD8F2.2030208@gmail.com> Message-ID: Another issue with the package was also came up recently here: Regards, Adam On Wed, Jul 9, 2014 at 8:06 PM, Gershom Bazerman wrote: > On 7/9/14, 5:56 PM, Carter Schonwald wrote: > > a) thats not how taking over maintainer ship works > b) http://www.haskell.org/haskellwiki/Taking_over_a_package > > taking over a package without the maintainers permission requires the > maintainer being unreachable for 6-12 months (or longer) > > > The guideline there is "a reasonable time". That is much closer to 1 month > than 6-12 months. I think one week is a bit short, but overall sven seems to > be following the process well, and given the last update date on that > package, we should still give a reasonable time to respond, but I would err > on the side of brevity if anything. > > --Gershom > > > > On Wed, Jul 9, 2014 at 5:33 PM, Sven Bartscher > wrote: >> >> Greetings, >> >> I would like to take over the setlocale package. Following the steps >> described on http://www.haskell.org/haskellwiki/Taking_over_a_package I >> need to state my intention on a public forum. >> >> The original author (Lukas Mai) published his package in the Public >> Domain. This would be fine, but the Author seems to be living in >> Germany. The problem with that is that in Germany an author is not >> allowed to give up his copyright in this way. This means the licensing >> of the package defaults to "All rights reserved", making the package >> undistributable. >> >> I already tried to contact the author about this problem, but he didn't >> respond in a week. This isn't a very long time, but I didn't get an >> answer on past attempts to contact him (this was at least a month, but >> probably more, ago). >> >> To solve this problem, I rewrote the setlocale binding with the same API >> under the BSD3-clause. >> >> PS: Please keep the CC to Lukas Mai and the debian-haskell list >> intact. >> >> Regards >> Sven >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From roma at ro-che.info Thu Jul 10 05:42:31 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 10 Jul 2014 08:42:31 +0300 Subject: [Haskell-cafe] extensible-transformers In-Reply-To: References: Message-ID: <20140710054231.GA32293@sniper> Hi Ben, I recently wrote a package with the same intent, called monad-classes https://github.com/feuerbach/monad-classes First, I am astonished with the simplicity of your approach. My library is much more complicated, and uses closed type families to find the right layer. I honestly didn't expect anything as simple as that to work ? and yet is seems to do well, at least in simple cases that I checked. I am not sure about more complex ones ? the use of IncoherentInstances somewhat bothers me, and I wonder if it's going to backfire in more complex settings. monad-classes also allows more flexibility regarding which transformers can handle given effects: * @MonadState s@ constraint can be handled by both lazy and strict StateT * @MonadReader r@ can be handled by @StateT r@ (and similarly for MonadWriter) * Given a lens from s' to s, @MonadState s@ can be handled by @StateT s'@ Roman * Ben Foppa [2014-07-09 19:52:17-0400] > Hi cafe, I whipped up extensible-transformers ( > https://github.com/RobotGymnast/extensible-transformers) this afternoon. > The idea is to make Monad transformer code more like extensible-effects > code (http://hackage.haskell.org/package/extensible-effects). Here's a > sample: > > {-# LANGUAGE FlexibleContexts #-} > module Main(main) where > > import Control.Monad.Trans.Flexible > import Control.Monad.Trans.List > import Control.Monad.Trans.State.Strict > > -- A flexible transformer stack built from existing transformers using > `liftT`. > bar :: (In (StateT Int) t, In ListT t) => t () > bar = do > n <- liftT get > liftT $ ListT $ return $ replicate n () > > -- A flexible transformer stack built from existing transformers using > `liftT`. > baz :: In (StateT Int) t => t () > baz = do > liftT $ state $ \i -> ((), i + (1 :: Int)) > > -- A flexible transformer monad stack composed of two other flexible > -- transformer monad stacks. > foo :: (In (StateT Int) t, In ListT t) => t () > foo = do > bar > baz > > main :: IO () > main = do > evalStateT (runListT foo) (1 :: Int) >>= putStrLn . show > runListT (evalStateT foo (2 :: Int)) >>= putStrLn . show > > Any feedback on this? Does such a package already exist? > > Thanks, > Ben > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From nomeata at debian.org Thu Jul 10 07:50:38 2014 From: nomeata at debian.org (Joachim Breitner) Date: Thu, 10 Jul 2014 09:50:38 +0200 Subject: [Haskell-cafe] Taking over setlocale In-Reply-To: <20140709233335.1d65dffb@sven.bartscher> References: <20140709233335.1d65dffb@sven.bartscher> Message-ID: <1404978638.2049.2.camel@kirk> Dear Sven, Am Mittwoch, den 09.07.2014, 23:33 +0200 schrieb Sven Bartscher: > To solve this problem, I rewrote the setlocale binding with the same API > under the BSD3-clause. thanks for that. Can you, independently of the hackage process, upload that package to Debian, so that hgettext works again? I guess you?ll want to leave out the Homepage field for now, to not make false pretenses, but if it is API compatible there is nothing wrong with Debian providing a different package, if the original one is unusable. Greetings, Joachim -- Joachim "nomeata" Breitner Debian Developer nomeata at debian.org | ICQ# 74513189 | GPG-Keyid: F0FBF51F JID: nomeata at joachim-breitner.de | http://people.debian.org/~nomeata -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From sven.bartscher at weltraumschlangen.de Thu Jul 10 08:25:14 2014 From: sven.bartscher at weltraumschlangen.de (Sven Bartscher) Date: Thu, 10 Jul 2014 10:25:14 +0200 Subject: [Haskell-cafe] Taking over setlocale In-Reply-To: <20140709224226.GA9316@scru.org> References: <20140708154100.4436ba68@sven.bartscher> <20140709224226.GA9316@scru.org> Message-ID: <20140710102514.2da32f7d@sven.bartscher> On Wed, 9 Jul 2014 22:42:26 +0000 Clint Adams wrote: > On Tue, Jul 08, 2014 at 03:41:00PM +0200, Sven Bartscher wrote: > > To solve this problem, I rewrote the setlocale binding with the same API > > under the BSD3-clause. > > Have you considered submitting this as a patch to the unix package, > since setlocale() is POSIX? I like that idea. I think I will talk to the maintainers oh the unix package soon. Regards Sven -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: not available URL: From benjamin.foppa at gmail.com Thu Jul 10 16:45:58 2014 From: benjamin.foppa at gmail.com (Ben Foppa) Date: Thu, 10 Jul 2014 12:45:58 -0400 Subject: [Haskell-cafe] extensible-transformers In-Reply-To: <20140710054231.GA32293@sniper> References: <20140710054231.GA32293@sniper> Message-ID: Interesting, monad-classes does seem more potentially powerful - I've kind of pushed the limits of these parts of the type system just constructing this. It's fantastic that it asymptotically reduces the number of typeclass instances required. The IncoherentInstances in extensible-transformers bothers me as well - especially since I'm not very familiar with the unhappy cases of IncoherentInstances. One big problem with extensible-transformers is that it doesn't expose the inner Monad itself (mainly because there isn't one), which creates an issue for code that needs its transformers to transform more than just "something" The big plus (and minus) for extensible-transformers is that it can lift into the existing transformers stacks - it doesn't require rewriting the effects like extensible-effects or monad-classes. It's bound by the same pros and cons as transformers, but it's easy to integrate into existing code. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brandon.m.simmons at gmail.com Thu Jul 10 18:39:00 2014 From: brandon.m.simmons at gmail.com (Brandon Simmons) Date: Thu, 10 Jul 2014 14:39:00 -0400 Subject: [Haskell-cafe] [ANN](and feedback request) unagi-chan: Fast and scalable concurrent queues for x86, with a Chan-like API Message-ID: I'm happy to finally release unagi-chan, an implementation of high-performance concurrent FIFO queues that have an API very similar to Control.Concurrent.Chan. You can see benchmarks and documentation here: http://hackage.haskell.org/package/unagi-chan If you have a moment (especially if you're on a non-x86 architecture) please take 10 minutes and run the tests with: $ cabal configure --enable-tests $ cabal build $ time ./dist/build/test/test Thanks to Ryan Newton for helping answer some low-level questions about his atomic-primops package which provides the CAS and fetch-and-add implementations that are the core of unagi-chan. REQUEST FOR FEEDBACK: would anyone be interested in any functionality like the following: - concurrent builder for Text, something like: new :: IO (InTextChan , Lazy.Text) write :: String -> InTextChan -> IO () - something similar for ByteString (is there a class for types convertable to ByteString?) - concurrent Text and/or ByteString readers, something like: reader :: Text -> IO TextReader takeText :: Int -> TextReader -> IO Text That's very sketchy, but I ask because I'm very close to that already with Unagi.Unboxed, and should be able to implement something like any of the above without too much trouble if it would be useful. Brandon http://brandon.si From bertovic.deni at gmail.com Thu Jul 10 19:07:24 2014 From: bertovic.deni at gmail.com (=?UTF-8?Q?Deni_Bertovi=C4=87?=) Date: Thu, 10 Jul 2014 21:07:24 +0200 Subject: [Haskell-cafe] Meetup - Calling all haskellers from Croatia Message-ID: We've opened a meetup group for all haskellers from Croatia and someone suggested we should post info about it here as it might reach more interested people that way. Here's the link to the meetup group (please join): http://www.meetup.com/haskellzg/ Sorry for the spam if this doesn't apply to you. -Deni -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Thu Jul 10 20:18:04 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 10 Jul 2014 23:18:04 +0300 Subject: [Haskell-cafe] extensible-transformers In-Reply-To: References: <20140710054231.GA32293@sniper> Message-ID: <20140710201804.GA12481@sniper> * Ben Foppa [2014-07-10 12:45:58-0400] > The IncoherentInstances in extensible-transformers bothers me as well - > especially since I'm not very familiar with the unhappy cases of > IncoherentInstances. The problem with IncoherentInstances is that when there's no reason to pick a specific instance, the compiler is happy to pick a general one, even if the more specific one is intended. In your case it is not obvious that this can be a problem. Unlike many "applications" of IncoherentInstances, that look like instance Cls a where ... yours have a superclass constraint involving the same class, so it's not trivial to discharge. I *think* that as soon as a monad stack doesn't contain two identical transformers, the bad case shouldn't happen. But I am not too confident here. > One big problem with extensible-transformers is that it doesn't expose the > inner Monad itself (mainly because there isn't one), which creates an issue > for code that needs its transformers to transform more than just "something" Not sure what you mean. Can you give an example? > The big plus (and minus) for extensible-transformers is that it can lift > into the existing transformers stacks - it doesn't require rewriting the > effects like extensible-effects or monad-classes. It's bound by the same > pros and cons as transformers, but it's easy to integrate into existing > code. monad-classes builds on transformers, too. It sits on the same layer as mtl, providing classes around transformers' types. That was the main motivation behind monad-classes ? it turned out that the free monad approach is much slower than plain transformers. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From benmsherman at gmail.com Fri Jul 11 05:00:22 2014 From: benmsherman at gmail.com (Ben Sherman) Date: Fri, 11 Jul 2014 01:00:22 -0400 Subject: [Haskell-cafe] ANN: FFI bindings to cuBLAS and cuSPARSE Message-ID: <26F545EC-3B04-4E26-AF5C-775E72E1C44D@gmail.com> I have written FFI bindings to the cuBLAS and cuSPARSE libraries, which are CUDA libraries for executing linear algebra computations on the GPU. It's a relatively straightforward translation of the C API. It's slightly novel in that I use language-c and Template Haskell to parse the C headers and create the FFI declarations, avoiding the boilerplate that may otherwise be necessary, even using a preprocessor such as c2hs. http://hackage.haskell.org/package/cublas-0.2.0.0 I've done a similar thing with a subset of the MAGMA GPU library. It's less polished, and the installation process is more unforgiving, so I haven't put it up on Hackage. https://github.com/bmsherman/magma-gpu Finally, I've written a library which abstracts the immutable API of hmatrix and provides a pure, hmatrix-like interface for cuBLAS/MAGMA, enabling simultaneous development of linear algebra programs using either hmatrix or the above GPU bindings as backends. Additionally, I have written "medium-level" mutable and immutable interfaces to cuBLAS/MAGMA (in LinAlg-magma). I use a type system trick reminiscent of the ST monad to allow mutable operations to read from either immutable or mutable datatypes, so it is easy to mix pure and destructive computations in a safe manner. I really made these libraries only complete enough to suit my purposes; I imagine many improvements can be made. https://github.com/bmsherman/LinAlg https://github.com/bmsherman/LinAlg-magma https://github.com/bmsherman/LinAlg-hmatrix Any feedback, bug reports, or pull requests are most welcome! From brucker at spamfence.net Fri Jul 11 05:25:29 2014 From: brucker at spamfence.net (Achim D. Brucker) Date: Fri, 11 Jul 2014 07:25:29 +0200 Subject: [Haskell-cafe] OCL 2014: Submission Deadline Extended by One Week Message-ID: <20140711052529.GA17276@fujikawa.home.brucker.ch> (Apologies for duplicates) ************************************************************** ** Submission Deadline Extended to July 18th, 2014 ** ************************************************************** CALL FOR PAPERS 14th International Workshop on OCL and Textual Modeling Applications and Case Studies (OCL 2014) Co-located with ACM/IEEE 17th International Conference on Model Driven Engineering Languages and Systems (MODELS 2014) September 30, 2014, VALENCIA, SPAIN http://www.software.imdea.org/OCL2014/ Modeling started out with UML and its precursors as a graphical notation. Such visual representations enable direct intuitive capturing of reality, but some of their features are difficult to formalize and lack the level of precision required to create complete and unambiguous specifications. Limitations of the graphical notations encouraged the development of text-based modeling languages that either integrate with or replace graphical notations for modeling. Typical examples of such languages are OCL, textual MOF, Epsilon, and Alloy. Textual modeling languages have their roots in formal language paradigms like logic, programming and databases. The goal of this workshop is create a forum where researchers and practitioners interested in building models using OCL or other kinds of textual languages can directly interact, report advances, share results, identify tools for language development, and discuss appropriate standards. In particular, the workshop will encourage discussions for achieving synergy from different modeling language concepts and modeling language use. The close interaction will enable researchers and practitioners to identify common interests and options for potential cooperation. Topics of interest include (but are not limited to) =================================================== - Mappings between textual modeling languages and other languages/formalisms - Algorithms, evaluation strategies and optimizations in the context of textual modeling languages for -- validation, verification, and testing, -- model transformation and code generation, -- metamodeling and DSLs, and -- query and constraint specifications - Alternative graphical/textual notations for textual modeling languages - Evolution, transformation and simplification of textual modeling expressions - Libraries, templates and patterns for textual modeling languages - Complexity results for textual modeling languages - Quality models and benchmarks for comparing and evaluating textual modeling tools and algorithms - Successful applications of textual modeling languages - Case studies on industrial applications of textual modeling languages - Experience reports -- usage of textual modeling languages and tools in complex domains, -- usability of textual modeling languages and tools for end-users - Empirical studies about the benefits and drawbacks of textual modeling languages - Innovative textual modeling tools - Comparison, evaluation and integration of modeling languages - Correlation between modeling languages and modeling tasks This year, we particularly encourage submissions describing applications and case studies of textual modeling as well as test suites and benchmark collections for evaluating textual modeling tools. Venue ===== The workshop will be organized as a part of MODELS 2014 Conference in Valencia, Spain. It continues the series of OCL workshops held at UML/MODELS conferences: York (2000), Toronto (2001), San Francisco (2003), Lisbon (2004), Montego Bay (2005), Genova (2006), Nashville (2007), Toulouse (2008), Denver (2009), Oslo (2010), Zurich (2011, at the TOOLs conference), 2012 in Innsbruck, and 2013 in Miami. Similar to its predecessors, the workshop addresses both people from academia and industry. The aim is to provide a forum for addressing integration of OCL and other textual modeling languages, as well as tools for textual modeling, and for disseminating good practice and discussing the new requirements for textual modeling. Workshop Format =============== The workshop will include short (about 15 min) presentations, parallel sessions of working groups, and sum-up discussions. Submissions =========== Two types of papers will be considered: * short papers (6 pages) and * full papers (10 pages) in LNCS format. Submissions should be uploaded to EasyChair (https://www.easychair.org/conferences/?conf=ocl2014). The program committee will review the submissions (minimum 2 reviews per paper, usually 3 reviews) and select papers according to their relevance and interest for discussions that will take place at the workshop. Accepted papers will be published online in a pre-conference edition of CEUR (http://www.ceur-ws.org). Authors of selected papers will be invited to submit an extended version of their workshop paper to a special issue of the Electronic Communications of the EASST (http://journal.ub.tu-berlin.de/eceasst) Important Dates =============== Submission of papers: July 18, 2014 (extended) Notification: August 8, 2014 Workshop date: September 30, 2014 Organizers ========== Achim D. Brucker, SAP AG, Germany Carolina Dania, IMDEA Software Institute, Madrid, Spain Geri Georg, Colorado State University, Fort Collins, Colorado, USA Martin Gogolla, University of Bremen, Germany Programme Committee =================== Michael Altenhofen, SAP AG, Germany Thomas Baar, University of Applied Sciences Berlin, Germany Mira Balaban, Ben-Gurion University of the Negev, Israel Tricia Balfe, Nomos Software, Ireland Fabian Buettner, Ecole des Mines de Nantes, France Achim D. Brucker, SAP AG, Germany Jordi Cabot, INRIA-Ecole des Mines de Nantes, France Yoonsik Cheon, University of Texas, USA Dan Chiorean, Babes-Bolyai University, Romania Robert Clariso, Universitat Oberta de Catalunya, Spain Tony Clark, Middlesex University, UK Manuel Clavel, IMDEA Software Institute, Madrid, Spain Carolina Dania, IMDEA Software Institute, Madrid, Spain Birgit Demuth, Technische Universitat Dresden, Germany Marina Egea, Atos Research, Madrid, Spain Geri Georg, Colorado State University, Fort Collins, Colorado, USA Martin Gogolla, University of Bremen, Germany Pieter Van Gorp, Eindhoven University of Technology, The Netherlands Heinrich Hussmann, LMU Munchen, Germany Tihamer Levendovszky, Vanderbilt University, USA Shahar Maoz, Tel Aviv University, Israel Istvan Rath, Budapest University of Technology and Economics, Hungary Bernhard Rumpe, RWTH Aachen, Germany Shane Sendall, Snowie Research SA, Switzerland Michael Wahler, ABB Switzerland Ltd Corporate Research, Switzerland Claas Wilke, Technische Universitat Dresden, Germany Edward Willink, Willink Transformations Ltd., UK Burkhart Wolff, Univ Paris-Sud, France Steffen Zschaler, King?s College, London, UK -- Dr. Achim D. Brucker, SAP SE, Vincenz-Priessnitz-Str. 1, D-76131 Karlsruhe Phone: +49 6227 7-52595, http://www.brucker.ch/ From audunskaugen at gmail.com Fri Jul 11 07:32:30 2014 From: audunskaugen at gmail.com (Audun Skaugen) Date: Fri, 11 Jul 2014 09:32:30 +0200 Subject: [Haskell-cafe] [ANN](and feedback request) unagi-chan: Fast and scalable concurrent queues for x86, with a Chan-like API In-Reply-To: References: Message-ID: Hi, I get lots of import errors trying to build: > tests/Main.hs:19:8: Could not find module `IndexedMVar' Changing that import line to 'import Utilities': > tests/Main.hs:18:8: Could not find module `Atomics' Changing to 'import Data.Atomics': > tests/Main.hs:15:8: Could not find module `UnagiUnboxed' and so on. P? Thu, 10 Jul 2014 20:39:00 +0200, skrev Brandon Simmons : > I'm happy to finally release unagi-chan, an implementation of > high-performance concurrent FIFO queues that have an API very similar > to Control.Concurrent.Chan. You can see benchmarks and documentation > here: > > http://hackage.haskell.org/package/unagi-chan > > If you have a moment (especially if you're on a non-x86 architecture) > please take 10 minutes and run the tests with: > > $ cabal configure --enable-tests > $ cabal build > $ time ./dist/build/test/test > > Thanks to Ryan Newton for helping answer some low-level questions > about his atomic-primops package which provides the CAS and > fetch-and-add implementations that are the core of unagi-chan. > > REQUEST FOR FEEDBACK: would anyone be interested in any functionality > like the following: > - concurrent builder for Text, something like: > new :: IO (InTextChan , Lazy.Text) > write :: String -> InTextChan -> IO () > > - something similar for ByteString (is there a class for types > convertable to ByteString?) > > - concurrent Text and/or ByteString readers, something like: > reader :: Text -> IO TextReader > takeText :: Int -> TextReader -> IO Text > > That's very sketchy, but I ask because I'm very close to that already > with Unagi.Unboxed, and should be able to implement something like any > of the above without too much trouble if it would be useful. > > Brandon > http://brandon.si > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Audun Skaugen From roma at ro-che.info Fri Jul 11 09:26:00 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Fri, 11 Jul 2014 12:26:00 +0300 Subject: [Haskell-cafe] Embedding version info in executables Message-ID: <20140711092600.GA27921@sniper> What are existing solutions for embedding version info (git revision, build date/time, versions of dependencies) in Haskell programs? Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From noteed at gmail.com Fri Jul 11 09:28:40 2014 From: noteed at gmail.com (Vo Minh Thu) Date: Fri, 11 Jul 2014 11:28:40 +0200 Subject: [Haskell-cafe] Embedding version info in executables In-Reply-To: <20140711092600.GA27921@sniper> References: <20140711092600.GA27921@sniper> Message-ID: Hi Roman, I am using this solution: http://www.hyperedsoftware.com/blog/entries/build-info-gen.html Cheers, Thu 2014-07-11 11:26 GMT+02:00 Roman Cheplyaka : > What are existing solutions for embedding version info (git revision, build > date/time, versions of dependencies) in Haskell programs? > > Roman > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From hesselink at gmail.com Fri Jul 11 09:38:41 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Fri, 11 Jul 2014 11:38:41 +0200 Subject: [Haskell-cafe] Embedding version info in executables In-Reply-To: References: <20140711092600.GA27921@sniper> Message-ID: We use template haskell to embed the git revision into the executable. You could probably do the same for the build time. Be aware that if no sources have changed, cabal won't recompile the module so you'd end up with the old git revision/build time. Regards, Erik On Fri, Jul 11, 2014 at 11:28 AM, Vo Minh Thu wrote: > Hi Roman, > > I am using this solution: > > http://www.hyperedsoftware.com/blog/entries/build-info-gen.html > > Cheers, > Thu > > 2014-07-11 11:26 GMT+02:00 Roman Cheplyaka : >> What are existing solutions for embedding version info (git revision, build >> date/time, versions of dependencies) in Haskell programs? >> >> Roman >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From alexander.vershilov at gmail.com Fri Jul 11 09:46:36 2014 From: alexander.vershilov at gmail.com (Alexander V Vershilov) Date: Fri, 11 Jul 2014 13:46:36 +0400 Subject: [Haskell-cafe] Embedding version info in executables In-Reply-To: <20140711092600.GA27921@sniper> References: <20140711092600.GA27921@sniper> Message-ID: It's possible to use a SimpelUserHook setup type, and then in Setup.hs add preBuild hook that will generate a file in ./dist/autobuild/, then you can import this file in Main.hs and use this information. I have used such Setup.hs (have not reviewed it for years), I think it may be improved. ``` import Distribution.Simple import Distribution.Simple.Setup import Data.Time.LocalTime import Distribution.PackageDescription (emptyHookedBuildInfo) import System.Directory (createDirectoryIfMissing, doesDirectoryExist) import System.Process (readProcess) main = defaultMainWithHooks (simpleUserHooks{ preBuild=addGitVersion }) addGitVersion _ buildFlags = do let Flag dir = buildDistPref buildFlags buildFilePath = dir ++ "/build/autogen" putStrLn $ "Generating " ++ buildFilePath ++ "..." createDirectoryIfMissing True buildFilePath exists <- doesDirectoryExist "git" desc <- if exists then readProcess "git" ["describe", "--all", "--long", "--dirty=-modified"] "" else return "detached version" now <- return . show =<< getZonedTime writeFile (buildFilePath ++ "/Build_hvmm.hs") $ unlines [ "module Build_hvmm where " , "gitDescribe::String" , "gitDescribe = " ++ show desc , "buildTime:: String" , "buildTime = " ++ show now ] return emptyHookedBuildInfo ``` On 11 July 2014 13:26, Roman Cheplyaka wrote: > What are existing solutions for embedding version info (git revision, build > date/time, versions of dependencies) in Haskell programs? > > Roman > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Alexander From michael at snoyman.com Fri Jul 11 11:27:56 2014 From: michael at snoyman.com (Michael Snoyman) Date: Fri, 11 Jul 2014 14:27:56 +0300 Subject: [Haskell-cafe] Embedding version info in executables In-Reply-To: References: <20140711092600.GA27921@sniper> Message-ID: I've used the same technique as Erik in the past. More recently, we've had Jenkins output a minimal Haskell file with a string literal containing the Jenkins build ID and timestamp. On Fri, Jul 11, 2014 at 12:38 PM, Erik Hesselink wrote: > We use template haskell to embed the git revision into the executable. > You could probably do the same for the build time. Be aware that if no > sources have changed, cabal won't recompile the module so you'd end up > with the old git revision/build time. > > Regards, > > Erik > > On Fri, Jul 11, 2014 at 11:28 AM, Vo Minh Thu wrote: > > Hi Roman, > > > > I am using this solution: > > > > http://www.hyperedsoftware.com/blog/entries/build-info-gen.html > > > > Cheers, > > Thu > > > > 2014-07-11 11:26 GMT+02:00 Roman Cheplyaka : > >> What are existing solutions for embedding version info (git revision, > build > >> date/time, versions of dependencies) in Haskell programs? > >> > >> Roman > >> > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hvr at gnu.org Fri Jul 11 12:09:43 2014 From: hvr at gnu.org (Herbert Valerio Riedel) Date: Fri, 11 Jul 2014 14:09:43 +0200 Subject: [Haskell-cafe] Embedding version info in executables In-Reply-To: (Alexander V. Vershilov's message of "Fri, 11 Jul 2014 13:46:36 +0400") References: <20140711092600.GA27921@sniper> Message-ID: <87d2dcjdvc.fsf@gnu.org> On 2014-07-11 at 11:46:36 +0200, Alexander V Vershilov wrote: > It's possible to use a SimpelUserHook setup type, and then in Setup.hs > add preBuild hook that will generate a file in ./dist/autobuild/, then you > can import this file in Main.hs and use this information. > > I have used such Setup.hs (have not reviewed it for years), I think it may > be improved. Btw, the main problem with that variant is that it breaks down if you want need `cabal sdist` to work. In order to have `cabal sdist` do something sensible I had to hack up an abomination of a `Setup.hs` which would rewrite the .cabal file and replace the `Setup.hs` by a `build-type: Simple` compliant one during `sdist` creation. It's really a pity Cabal makes this use-case so hard to achieve, as it would just need to provide a hook to determine the version-field dynamically... Cheers, hvr From alexander.vershilov at gmail.com Fri Jul 11 12:26:31 2014 From: alexander.vershilov at gmail.com (Alexander V Vershilov) Date: Fri, 11 Jul 2014 16:26:31 +0400 Subject: [Haskell-cafe] Embedding version info in executables In-Reply-To: <87d2dcjdvc.fsf@gnu.org> References: <20140711092600.GA27921@sniper> <87d2dcjdvc.fsf@gnu.org> Message-ID: Yes, this is a problem. To be honest, the project where I used this approach was never public, and we didn't use sdist. I think that it's possible to check if you have `git` executable, and if the the project is in repository, otherwise there is no sense in this information, and information from a cabal file that is given to the hook can be used. On 11 July 2014 16:09, Herbert Valerio Riedel wrote: > On 2014-07-11 at 11:46:36 +0200, Alexander V Vershilov wrote: >> It's possible to use a SimpelUserHook setup type, and then in Setup.hs >> add preBuild hook that will generate a file in ./dist/autobuild/, then you >> can import this file in Main.hs and use this information. >> >> I have used such Setup.hs (have not reviewed it for years), I think it may >> be improved. > > Btw, the main problem with that variant is that it breaks down if you > want need `cabal sdist` to work. > > In order to have `cabal sdist` do something sensible I had to hack up an > abomination of a `Setup.hs` which would rewrite the .cabal file and > replace the `Setup.hs` by a `build-type: Simple` compliant one during > `sdist` creation. It's really a pity Cabal makes this use-case so hard > to achieve, as it would just need to provide a hook to determine the > version-field dynamically... > > Cheers, > hvr -- Alexander From brandon.m.simmons at gmail.com Fri Jul 11 14:12:33 2014 From: brandon.m.simmons at gmail.com (Brandon Simmons) Date: Fri, 11 Jul 2014 10:12:33 -0400 Subject: [Haskell-cafe] [ANN](and feedback request) unagi-chan: Fast and scalable concurrent queues for x86, with a Chan-like API In-Reply-To: References: Message-ID: On Fri, Jul 11, 2014 at 3:32 AM, Audun Skaugen wrote: > Hi, > I get lots of import errors trying to build: Oops, I forgot to add some things to other-modules for the tests. Should be fixed in 0.1.0.2 now: cabal sandbox init cabal install --only-dependencies cabal configure --enable-tests cabal build test Thanks for the catch, Brandon > > -- > Audun Skaugen From gbwey9 at gmail.com Fri Jul 11 15:01:14 2014 From: gbwey9 at gmail.com (gbwey9) Date: Fri, 11 Jul 2014 11:01:14 -0400 Subject: [Haskell-cafe] help with some code Message-ID: Hi Cafe, I've got some code where a user can provide a filter to subscribe to a particular type of event. The events come in as xml and are parsed using the toEvent method. The code works fine but is repetitive since each event record potentially has the information needed to parse the xml using the field names and types. So is there a way to get rid of the repetition and streamline the code? Should I be using TH or lenses or something else entirely? Here is the paste. http://lpaste.net/107338 Thanks for any pointers! Grant -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark.lentczner at gmail.com Fri Jul 11 15:08:44 2014 From: mark.lentczner at gmail.com (Mark Lentczner) Date: Fri, 11 Jul 2014 08:08:44 -0700 Subject: [Haskell-cafe] Haskell Platform release schedule? In-Reply-To: References: Message-ID: Haskell Platform 2014.2.0.0, based on GHC 7.8.3 just went alpha! I expect the platform team to run it through its paces and hope that we'll have no barrier to a release within two weeks at most - perhaps much sooner! If you want to be intrepid and try it - head to to the haskell-platform mailing list and look for announcements.? As for versioning: The situation is that we can't (on Mac OS X at least) install two versions of Platform at the same time with the same GHC release. For patch release, 2014.2.0.0 and 2014.2.x.y this is fine and probably what we want: If we update a patch release, we sort of want people to use that, and not use the earlier vesion anymore. 2014.4.0.0 will need a new version of GHC... or will else we'll live with the idea that it isn't installable at the same time as 2014.2.0.0. - Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Jul 11 17:58:54 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 11 Jul 2014 18:58:54 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? Message-ID: <20140711175854.GP30588@henry> I am implementing an EDSL that compiles to SQL and I am wondering what is the state of the art in testing code generation. All the Haskell libraries I could find that deal with SQL generation are tested by implementing multiple one-off adhoc queries and checking that when either compiled to SQL or run against a database they give the expected, prespecified result. * https://github.com/prowdsponsor/esqueleto/blob/master/test/Test.hs * https://github.com/m4dc4p/haskelldb/blob/master/test/TestCases.hs * https://github.com/yesodweb/persistent/blob/master/persistent-test/SumTypeTest.hs I couldn't find any tests for groundhog. * https://github.com/lykahb/groundhog I also had a look at Javascript generators. They take a similar adhoc, one-off approach. * https://github.com/valderman/haste-compiler/tree/master/Tests * https://github.com/faylang/fay/tree/master/tests Is this the best we can do in Haskell? Certainly it seems hard to use a QuickCheck/SmallCheck approach for this purpose. Is there any way this kind of testing can be automated or made more robust? Thanks, Tom From alex.solla at gmail.com Fri Jul 11 20:03:44 2014 From: alex.solla at gmail.com (Alexander Solla) Date: Fri, 11 Jul 2014 13:03:44 -0700 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: <20140711175854.GP30588@henry> References: <20140711175854.GP30588@henry> Message-ID: On Fri, Jul 11, 2014 at 10:58 AM, Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > I am implementing an EDSL that compiles to SQL and I am wondering what is > the state of the art in testing code generation. > > All the Haskell libraries I could find that deal with SQL generation are > tested by implementing multiple one-off adhoc queries and checking that > when > either compiled to SQL or run against a database they give the expected, > prespecified result. > > Is this the best we can do in Haskell? Certainly it seems hard to use a > QuickCheck/SmallCheck approach for this purpose. Is there any way this > kind > of testing can be automated or made more robust? > Personally, I would test this in the same way I'd test a compiler: as purely as possible. You have an EDSL, and possibly an AST for it, and finally a target language. Figure out if any one of the layers is particularly "shallow" (and therefore "easy" to validate by inspection). Use the shallow layer to validate the other two. The trouble with this approach is that you'll need to find a way to "interpret" raw SQL statements, since different can be equivalent modulo ordering of fields, subqueries, conditions, etc. So, as an architectural point, I would make the AST -> SQL layer the "easy" one to validate. Then, you can check that your EDSL -> AST layer produces the expected trees. You can even use QuickCheck for this validation. Otherwise, you will have to do it impurely, like the other packages do. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmacristovao at gmail.com Fri Jul 11 20:33:42 2014 From: jmacristovao at gmail.com (=?UTF-8?B?Sm/Do28gQ3Jpc3TDs3bDo28=?=) Date: Fri, 11 Jul 2014 21:33:42 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: References: <20140711175854.GP30588@henry> Message-ID: I'm not sure if this is related and/or applicable, but you didn't seem to mention: https://hackage.haskell.org/package/hssqlppp Its a SQL parser/checker. Cheers, Jo?o 2014-07-11 21:03 GMT+01:00 Alexander Solla : > On Fri, Jul 11, 2014 at 10:58 AM, Tom Ellis > wrote: >> >> I am implementing an EDSL that compiles to SQL and I am wondering what is >> the state of the art in testing code generation. >> >> All the Haskell libraries I could find that deal with SQL generation are >> tested by implementing multiple one-off adhoc queries and checking that >> when >> either compiled to SQL or run against a database they give the expected, >> prespecified result. > > > >> >> Is this the best we can do in Haskell? Certainly it seems hard to use a >> >> QuickCheck/SmallCheck approach for this purpose. Is there any way this >> kind >> of testing can be automated or made more robust? > > > Personally, I would test this in the same way I'd test a compiler: as purely > as possible. You have an EDSL, and possibly an AST for it, and finally a > target language. Figure out if any one of the layers is particularly > "shallow" (and therefore "easy" to validate by inspection). Use the shallow > layer to validate the other two. > > The trouble with this approach is that you'll need to find a way to > "interpret" raw SQL statements, since different can be equivalent modulo > ordering of fields, subqueries, conditions, etc. So, as an architectural > point, I would make the AST -> SQL layer the "easy" one to validate. Then, > you can check that your EDSL -> AST layer produces the expected trees. You > can even use QuickCheck for this validation. > > Otherwise, you will have to do it impurely, like the other packages do. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From hjgtuyl at chello.nl Fri Jul 11 22:42:25 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sat, 12 Jul 2014 00:42:25 +0200 Subject: [Haskell-cafe] [Haskell] ANNOUNCE: GHC version 7.8.3 In-Reply-To: References: Message-ID: On Fri, 11 Jul 2014 15:40:54 +0200, Austin Seipp wrote: > Included in this email is a signed copy of the SHA256 hashes for the > tarballs, using my GPG key (keyid 0x3B58D86F). Where can I find your public key? Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From gbwey9 at gmail.com Fri Jul 11 22:47:02 2014 From: gbwey9 at gmail.com (gbwey9) Date: Fri, 11 Jul 2014 18:47:02 -0400 Subject: [Haskell-cafe] regular-xmlpickler Message-ID: Hi, I am using a very cool package called regular-xmlpickler. Does anyone know of a way to skip one level of nesting for nested complex fields? So I would like to elide that outer/inner Header. Here is the full code: http://lpaste.net/107362 data User = User { name :: String , admin :: Bool , dt :: UTCTime , header :: Header } data Header = Header { header1 :: String , header2 :: String } so instead of generating
twice
abb abb
I would like to have it generate this.
abb abb
Thanks, Grant -------------- next part -------------- An HTML attachment was scrubbed... URL: From jgbailey at gmail.com Fri Jul 11 23:52:22 2014 From: jgbailey at gmail.com (Justin Bailey) Date: Fri, 11 Jul 2014 16:52:22 -0700 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: <20140711175854.GP30588@henry> References: <20140711175854.GP30588@henry> Message-ID: Do you want to share your library yet? Sounds pretty cool. On Fri, Jul 11, 2014 at 10:58 AM, Tom Ellis wrote: > I am implementing an EDSL that compiles to SQL and I am wondering what is > the state of the art in testing code generation. > > All the Haskell libraries I could find that deal with SQL generation are > tested by implementing multiple one-off adhoc queries and checking that when > either compiled to SQL or run against a database they give the expected, > prespecified result. > > * https://github.com/prowdsponsor/esqueleto/blob/master/test/Test.hs > * https://github.com/m4dc4p/haskelldb/blob/master/test/TestCases.hs > * https://github.com/yesodweb/persistent/blob/master/persistent-test/SumTypeTest.hs > > I couldn't find any tests for groundhog. > > * https://github.com/lykahb/groundhog > > I also had a look at Javascript generators. They take a similar adhoc, > one-off approach. > > * https://github.com/valderman/haste-compiler/tree/master/Tests > * https://github.com/faylang/fay/tree/master/tests > > Is this the best we can do in Haskell? Certainly it seems hard to use a > QuickCheck/SmallCheck approach for this purpose. Is there any way this kind > of testing can be automated or made more robust? > > Thanks, > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From mle+hs at mega-nerd.com Fri Jul 11 23:59:40 2014 From: mle+hs at mega-nerd.com (Erik de Castro Lopo) Date: Sat, 12 Jul 2014 09:59:40 +1000 Subject: [Haskell-cafe] [Haskell] ANNOUNCE: GHC version 7.8.3 In-Reply-To: References: Message-ID: <20140712095940.754bfd9859b17c049a414dd5@mega-nerd.com> Henk-Jan van Tuyl wrote: > On Fri, 11 Jul 2014 15:40:54 +0200, Austin Seipp > wrote: > > > Included in this email is a signed copy of the SHA256 hashes for the > > tarballs, using my GPG key (keyid 0x3B58D86F). > > Where can I find your public key? This worked for me: gpg --keyserver pool.sks-keyservers.net --recv-key 3B58D86F Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ From adam at bergmark.nl Sat Jul 12 01:14:17 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Sat, 12 Jul 2014 03:14:17 +0200 Subject: [Haskell-cafe] regular-xmlpickler In-Reply-To: References: Message-ID: Hi Grant, This is an edge case since you have a field name with the same name as a constructor. regular-xmlpickler doesn't try to treat this case differently, I'm not sure if there is a good way to generically fix this in the way you want. That said, you can always write your own picklers using plain hxt to flatten the structure, and note that you can mix custom instances with regular-xmlpickler generated ones. Also see the hxt-pickle-utils[1] package for a few helper functions [1] http://hackage.haskell.org/package/hxt-pickle-utils Cheers, Adam On Sat, Jul 12, 2014 at 12:47 AM, gbwey9 wrote: > Hi, > > I am using a very cool package called regular-xmlpickler. > Does anyone know of a way to skip one level of nesting for nested complex > fields? So I would like to elide that outer/inner Header. > > Here is the full code: http://lpaste.net/107362 > > data User = User > { name :: String > , admin :: Bool > , dt :: UTCTime > , header :: Header > } > > data Header = Header > { header1 :: String > , header2 :: String > } > > so instead of generating
twice > >
>
> abb > abb >
>
> > I would like to have it generate this. > >
> abb > abb >
> > > Thanks, > Grant > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From erantapaa at gmail.com Sat Jul 12 03:39:26 2014 From: erantapaa at gmail.com (Erik Rantapaa) Date: Fri, 11 Jul 2014 20:39:26 -0700 (PDT) Subject: [Haskell-cafe] help with some code In-Reply-To: References: Message-ID: <26de389a-fef5-45f4-a53e-3db24dd9bc03@googlegroups.com> On Friday, July 11, 2014 10:01:38 AM UTC-5, gbwey9 wrote: > > Hi Cafe, > > I've got some code where a user can provide a filter to subscribe to a > particular type of event. The events come in as xml and are parsed using > the toEvent method. > The code works fine but is repetitive since each event record potentially > has the information needed to parse the xml using the field names and > types. > > So is there a way to get rid of the repetition and streamline the code? > Should I be using TH or lenses or something else entirely? > > Here is the paste. > http://lpaste.net/107338 > > > Thanks for any pointers! > Grant > Regarding how the defining the toEvent instances can be simplified, have a look at the FromJSON type class works in the aeson package. One technique they use is to define FromJSON instances for even the primitive types (e.g. Int, String, DateTime, etc.) so that the FromJSON instances of records can be entirely type-directed removing the need to reference specific deserialization functions (e.g. getint, getbool, etc.) One example of a package which uses aeson (of which there are many) is the github package: https://github.com/jwiegley/github/blob/master/Github/Data.hs -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbwey9 at gmail.com Sat Jul 12 03:49:38 2014 From: gbwey9 at gmail.com (gbwey9) Date: Fri, 11 Jul 2014 23:49:38 -0400 Subject: [Haskell-cafe] regular-xmlpickler In-Reply-To: References: Message-ID: Hi Adam, You are right. I didn't realise that I could write my own pickler without having a real parent xml node. Anyway, it works! Thanks for your help, Grant On Fri, Jul 11, 2014 at 9:14 PM, Adam Bergmark wrote: > Hi Grant, > > This is an edge case since you have a field name with the same name as a > constructor. regular-xmlpickler doesn't try to treat this case differently, > I'm not sure if there is a good way to generically fix this in the way you > want. > > That said, you can always write your own picklers using plain hxt to > flatten the structure, and note that you can mix custom instances with > regular-xmlpickler generated ones. > > Also see the hxt-pickle-utils[1] package for a few helper functions > > [1] http://hackage.haskell.org/package/hxt-pickle-utils > > Cheers, > Adam > > > > On Sat, Jul 12, 2014 at 12:47 AM, gbwey9 wrote: > >> Hi, >> >> I am using a very cool package called regular-xmlpickler. >> Does anyone know of a way to skip one level of nesting for nested complex >> fields? So I would like to elide that outer/inner Header. >> >> Here is the full code: http://lpaste.net/107362 >> >> data User = User >> { name :: String >> , admin :: Bool >> , dt :: UTCTime >> , header :: Header >> } >> >> data Header = Header >> { header1 :: String >> , header2 :: String >> } >> >> so instead of generating
twice >> >>
>>
>> abb >> abb >>
>>
>> >> I would like to have it generate this. >> >>
>> abb >> abb >>
>> >> >> Thanks, >> Grant >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbwey9 at gmail.com Sat Jul 12 03:52:49 2014 From: gbwey9 at gmail.com (gbwey9) Date: Fri, 11 Jul 2014 23:52:49 -0400 Subject: [Haskell-cafe] help with some code In-Reply-To: <26de389a-fef5-45f4-a53e-3db24dd9bc03@googlegroups.com> References: <26de389a-fef5-45f4-a53e-3db24dd9bc03@googlegroups.com> Message-ID: Hi Erik, I'll take a look into it. Thanks for the help! Best, Grant On Fri, Jul 11, 2014 at 11:39 PM, Erik Rantapaa wrote: > On Friday, July 11, 2014 10:01:38 AM UTC-5, gbwey9 wrote: >> >> Hi Cafe, >> >> I've got some code where a user can provide a filter to subscribe to a >> particular type of event. The events come in as xml and are parsed using >> the toEvent method. >> The code works fine but is repetitive since each event record potentially >> has the information needed to parse the xml using the field names and >> types. >> >> So is there a way to get rid of the repetition and streamline the code? >> Should I be using TH or lenses or something else entirely? >> >> Here is the paste. >> http://lpaste.net/107338 >> >> >> Thanks for any pointers! >> Grant >> > > Regarding how the defining the toEvent instances can be simplified, have a > look at the FromJSON type class works in the aeson package. One technique > they use is to define FromJSON instances for even the primitive types (e.g. > Int, String, DateTime, etc.) so that the FromJSON instances of records can > be entirely type-directed removing the need to reference specific > deserialization functions (e.g. getint, getbool, etc.) > > One example of a package which uses aeson (of which there are many) is the > github package: > > https://github.com/jwiegley/github/blob/master/Github/Data.hs > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jakewheatmail at gmail.com Sat Jul 12 08:08:51 2014 From: jakewheatmail at gmail.com (Jake Wheat) Date: Sat, 12 Jul 2014 11:08:51 +0300 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: <20140711175854.GP30588@henry> References: <20140711175854.GP30588@henry> Message-ID: > > Is this the best we can do in Haskell? Certainly it seems hard to use a > QuickCheck/SmallCheck approach for this purpose. Is there any way this > kind > of testing can be automated or made more robust? > You could make a simple AST which can be used to generate SQL query text directly, and also the Haskell source code for your DSL. Then you can compare the results of the two code paths 'AST -> concrete SQL' and 'AST -> generate Haskell -> run the Haskell -> concrete SQL'. If you can get this working then this could make it easier to use Quickcheck, etc.. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erkokl at gmail.com Sat Jul 12 19:49:20 2014 From: erkokl at gmail.com (Levent Erkok) Date: Sat, 12 Jul 2014 12:49:20 -0700 Subject: [Haskell-cafe] [ANNOUNCE] New release of SBV (v3.1) Message-ID: I'm pleased to announce v3.1 release of SBV, a library for integrating SMT solvers into Haskell. This release coincides with GHC 7.8.3: A a prior bug in the 7.8 series caused SBV to crash under heavy load. GHC 7.8.3 fixes this bug; so if you're an SBV user, please upgrade to both GHC 7.8.3 and your version of SBV. Also new in this release are two oft-requested features: - Parallel solving capabilities: Using multiple SMT solvers at the same time to get the fastest result (speed), or get all results (to make sure they all behave the same way, safety). - A variant of symbolic if-then-else (called sBranch) that can call the external solver during simulation before it symbolically simulates "then" and "else" branches. This is useful for programming with recursive functions where termination depends on symbolic values. Full release notes: https://github.com/LeventErkok/sbv/blob/master/CHANGES.md SBV web page: http://leventerkok.github.io/sbv/ As usual, bug reports and feedback are most welcome! -Levent. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vigalchin at gmail.com Sat Jul 12 23:54:28 2014 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Sat, 12 Jul 2014 18:54:28 -0500 Subject: [Haskell-cafe] book "Haskell Data Analysis Cookbook" by Nishant Shukla Message-ID: I believe there is a non-thread safe code fragment in Chapter 1(page 15): import System.Directory (doesFileExist) ..... exist <- doesFileExist filename -- these two lines are non-thread safe .. yes?? to be thread-safe the above line and the following line would have to be together atomic .... input <- if exists then readFile filename else return "" ........... Vasili From allbery.b at gmail.com Sun Jul 13 00:02:04 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 12 Jul 2014 20:02:04 -0400 Subject: [Haskell-cafe] book "Haskell Data Analysis Cookbook" by Nishant Shukla In-Reply-To: References: Message-ID: On Sat, Jul 12, 2014 at 7:54 PM, Vasili I. Galchin wrote: > -- these two lines are non-thread safe .. yes?? to be thread-safe > the above line and the following line would have to be together > atomic .... > Not even then would it really be safe; it should trap the exception from readFile failing, instead of checking existence in a separate step. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From vigalchin at gmail.com Sun Jul 13 00:32:21 2014 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Sat, 12 Jul 2014 19:32:21 -0500 Subject: [Haskell-cafe] book "Haskell Data Analysis Cookbook" by Nishant Shukla In-Reply-To: References: Message-ID: that was exactly my point ... I.e. if between two lines the "Haskell thread-of-execution" is interrupted ... and another thread/process ... .deletes the file then 2nd "line" of code would cause an exception to be thrown ... i.e. because of non-existence .. . Brandon, aren't we saying the same thing ... if so, forgive, my English .. :-) Vasya On Sat, Jul 12, 2014 at 7:02 PM, Brandon Allbery wrote: > On Sat, Jul 12, 2014 at 7:54 PM, Vasili I. Galchin > wrote: >> >> -- these two lines are non-thread safe .. yes?? to be thread-safe >> the above line and the following line would have to be together >> atomic .... > > > Not even then would it really be safe; it should trap the exception from > readFile failing, instead of checking existence in a separate step. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net From vigalchin at gmail.com Sun Jul 13 02:04:24 2014 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Sat, 12 Jul 2014 21:04:24 -0500 Subject: [Haskell-cafe] book "Haskell Data Analysis Cookbook" by Nishant Shukla In-Reply-To: References: Message-ID: well .. if my memory is correct .. a previous example was based on using an exemption to make the code safe (.. found it on pg. 14) ..... i was just being lazy(my total bad) .. not being stupid .. ... in any case, aren't books refereed ....not impugning the author .. hey I make mistakes .. e.g. working too fast .. too much booze the night before ... :-) From daniel.trstenjak at gmail.com Sun Jul 13 12:42:27 2014 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Sun, 13 Jul 2014 14:42:27 +0200 Subject: [Haskell-cafe] [ANN] cabal-bounds 0.7: update bounds by haskell platform release Message-ID: <20140713124226.GA10143@machine> Hi cafe, cabal-bounds[1] is a command line program for managing the bounds/versions of the dependencies in a cabal file. cabal-bounds 0.7 adds the feature to set the bounds of dependencies to the library versions used by a haskell platform[2] release. For further details please consult the README[3]. Greetings, Daniel [1] https://github.com/dan-t/cabal-bounds [2] https://www.haskell.org/platform/ [3] https://github.com/dan-t/cabal-bounds/blob/master/README.md From dhrosa at gmail.com Mon Jul 14 02:14:04 2014 From: dhrosa at gmail.com (Diony Rosa) Date: Sun, 14 Jul 2014 02:14:04 +0000 Subject: [Haskell-cafe] =?iso-8859-1?q?Diony_Rosa_-_7/14/2014_2=3A14=3A04_?= =?iso-8859-1?q?AM?= Message-ID: <05CAF40AFE2F50CA05E237A14F3A244D@physics.fsu.edu> http://butikpastalar.net/rhad/cfttllmcrlpibdgdyufrzbhvsd.aucahicfstvtogdrs -------------- next part -------------- An HTML attachment was scrubbed... URL: From tdammers at gmail.com Mon Jul 14 05:40:11 2014 From: tdammers at gmail.com (Tobias Dammers) Date: Mon, 14 Jul 2014 07:40:11 +0200 Subject: [Haskell-cafe] book "Haskell Data Analysis Cookbook" by Nishant Shukla In-Reply-To: References: Message-ID: It is not the same thing, really, unless I'm misunderstanding. AFAIK there is no straightforward way of making the combined check-if-exists-and-delete block atomic at the bearsden level, even if you force serial execution at the haskell level, and the established solution is to forgo the existence check altogether, relying on the delete call to throw when the file doesn't exist. On Jul 13, 2014 2:32 AM, "Vasili I. Galchin" wrote: > that was exactly my point ... I.e. if between two lines the "Haskell > thread-of-execution" is interrupted ... and another thread/process ... > .deletes the file then 2nd "line" of code would cause an exception to > be thrown ... i.e. because of non-existence .. . Brandon, aren't we > saying the same thing ... if so, forgive, my English .. :-) > > Vasya > > On Sat, Jul 12, 2014 at 7:02 PM, Brandon Allbery > wrote: > > On Sat, Jul 12, 2014 at 7:54 PM, Vasili I. Galchin > > wrote: > >> > >> -- these two lines are non-thread safe .. yes?? to be thread-safe > >> the above line and the following line would have to be together > >> atomic .... > > > > > > Not even then would it really be safe; it should trap the exception from > > readFile failing, instead of checking existence in a separate step. > > > > -- > > brandon s allbery kf8nh sine nomine > associates > > allbery.b at gmail.com > ballbery at sinenomine.net > > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From noteed at gmail.com Mon Jul 14 09:26:14 2014 From: noteed at gmail.com (Vo Minh Thu) Date: Mon, 14 Jul 2014 11:26:14 +0200 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: <20140711175854.GP30588@henry> References: <20140711175854.GP30588@henry> Message-ID: Hi Tom, I think there is still some opportunity for something like QuickCheck in your case. Certainly you can use QC to generate expressions/statements in your EDSL. Then if you can also generate schemas and data you should be able to write down some properties, for instance that some class of queries on empty tables should return no rows. A special case of this, and a more specific example, is very similar to the introductory examples to QC: it must be possible to retrieve a row after inserting it in an empty table, or deleting it after inserting it must leave the table unchanged. Even if you don't go as far as writing properties that involves the schema/data generation, generating arbitrary valid AST that must compile successfully to SQL is interesting. HTH, Thu 2014-07-11 19:58 GMT+02:00 Tom Ellis : > I am implementing an EDSL that compiles to SQL and I am wondering what is > the state of the art in testing code generation. > > All the Haskell libraries I could find that deal with SQL generation are > tested by implementing multiple one-off adhoc queries and checking that when > either compiled to SQL or run against a database they give the expected, > prespecified result. > > * https://github.com/prowdsponsor/esqueleto/blob/master/test/Test.hs > * https://github.com/m4dc4p/haskelldb/blob/master/test/TestCases.hs > * https://github.com/yesodweb/persistent/blob/master/persistent-test/SumTypeTest.hs > > I couldn't find any tests for groundhog. > > * https://github.com/lykahb/groundhog > > I also had a look at Javascript generators. They take a similar adhoc, > one-off approach. > > * https://github.com/valderman/haste-compiler/tree/master/Tests > * https://github.com/faylang/fay/tree/master/tests > > Is this the best we can do in Haskell? Certainly it seems hard to use a > QuickCheck/SmallCheck approach for this purpose. Is there any way this kind > of testing can be automated or made more robust? > > Thanks, > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jul 14 12:59:26 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 14 Jul 2014 13:59:26 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: References: <20140711175854.GP30588@henry> Message-ID: <20140714125926.GY30588@henry> On Fri, Jul 11, 2014 at 09:33:42PM +0100, Jo?o Crist?v?o wrote: > I'm not sure if this is related and/or applicable, but you didn't seem > to mention: > > https://hackage.haskell.org/package/hssqlppp > > Its a SQL parser/checker. It seems to take the same ad hoc approach: * https://github.com/JakeWheat/hssqlppp/tree/master/hssqlppp/tests/Database/HsSqlPpp/Tests/Parsing * https://github.com/JakeWheat/hssqlppp/tree/master/hssqlppp/tests/Database/HsSqlPpp/Tests/TypeChecking Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jul 14 13:11:41 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 14 Jul 2014 14:11:41 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: References: <20140711175854.GP30588@henry> Message-ID: <20140714131141.GZ30588@henry> On Fri, Jul 11, 2014 at 01:03:44PM -0700, Alexander Solla wrote: > On Fri, Jul 11, 2014 at 10:58 AM, Tom Ellis < > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > > I am implementing an EDSL that compiles to SQL and I am wondering what is > > the state of the art in testing code generation. > > > > All the Haskell libraries I could find that deal with SQL generation are > > tested by implementing multiple one-off adhoc queries and checking that > > when > > either compiled to SQL or run against a database they give the expected, > > prespecified result. [..] > > Is this the best we can do in Haskell? Certainly it seems hard to use a > > QuickCheck/SmallCheck approach for this purpose. Is there any way this > > kind > > of testing can be automated or made more robust? > > > > Personally, I would test this in the same way I'd test a compiler: as > purely as possible. You have an EDSL, and possibly an AST for it, and > finally a target language. Figure out if any one of the layers is > particularly "shallow" (and therefore "easy" to validate by inspection). > Use the shallow layer to validate the other two. > > The trouble with this approach is that you'll need to find a way to > "interpret" raw SQL statements, since different can be equivalent modulo > ordering of fields, subqueries, conditions, etc. So, as an architectural > point, I would make the AST -> SQL layer the "easy" one to validate. Then, > you can check that your EDSL -> AST layer produces the expected trees. You > can even use QuickCheck for this validation. Right, this EDSL -> AST layer is exactly what I don't know how to test. How would you go about doing that in a non-trivial way? One complication is that the EDSL is typed, making it harder to generate terms with QuickCheck as far as I can tell. Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jul 14 13:15:59 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 14 Jul 2014 14:15:59 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: References: <20140711175854.GP30588@henry> Message-ID: <20140714131559.GA30588@henry> On Fri, Jul 11, 2014 at 04:52:22PM -0700, Justin Bailey wrote: > Do you want to share your library yet? Sounds pretty cool. It is pretty cool, but needs thorough testing before release :) > On Fri, Jul 11, 2014 at 10:58 AM, Tom Ellis > wrote: > > I am implementing an EDSL that compiles to SQL and I am wondering what is > > the state of the art in testing code generation. > > > > All the Haskell libraries I could find that deal with SQL generation are > > tested by implementing multiple one-off adhoc queries and checking that when > > either compiled to SQL or run against a database they give the expected, > > prespecified result. > > > > * https://github.com/prowdsponsor/esqueleto/blob/master/test/Test.hs > > * https://github.com/m4dc4p/haskelldb/blob/master/test/TestCases.hs > > * https://github.com/yesodweb/persistent/blob/master/persistent-test/SumTypeTest.hs > > > > I couldn't find any tests for groundhog. > > > > * https://github.com/lykahb/groundhog > > > > I also had a look at Javascript generators. They take a similar adhoc, > > one-off approach. > > > > * https://github.com/valderman/haste-compiler/tree/master/Tests > > * https://github.com/faylang/fay/tree/master/tests > > > > Is this the best we can do in Haskell? Certainly it seems hard to use a > > QuickCheck/SmallCheck approach for this purpose. Is there any way this kind > > of testing can be automated or made more robust? > > > > Thanks, > > > > Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jul 14 13:20:08 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 14 Jul 2014 14:20:08 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: References: <20140711175854.GP30588@henry> Message-ID: <20140714132008.GB30588@henry> On Sat, Jul 12, 2014 at 11:08:51AM +0300, Jake Wheat wrote: > > Is this the best we can do in Haskell? Certainly it seems hard to use a > > QuickCheck/SmallCheck approach for this purpose. Is there any way this > > kind of testing can be automated or made more robust? > > You could make a simple AST which can be used to generate SQL query > text directly, and also the Haskell source code for your DSL. Then you > can compare the results of the two code paths 'AST -> concrete SQL' > and 'AST -> generate Haskell -> run the Haskell -> concrete SQL'. If > you can get this working then this could make it easier to use > Quickcheck, etc.. Thanks Jake that's an interesting idea, though I fear that any AST powerful enough to compile to both SQL and my EDSL would be no less complicated than my DSL in the first place. Tom From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jul 14 13:26:48 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 14 Jul 2014 14:26:48 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: References: <20140711175854.GP30588@henry> Message-ID: <20140714132648.GC30588@henry> The first impediment to using QuickCheck is that my EDSL is typed. I don't know how to generate random terms in the presence of types. The second impediment is that, although I can indeed test trivial properties, I don't know how to test functionality to its full level of sophistication. How can I test a left join, for example, without reimplementing left join functionality within Haskell? (Indeed I may end up doing this, but would prefer to find an easier path ...) Tom On Mon, Jul 14, 2014 at 11:26:14AM +0200, Vo Minh Thu wrote: > I think there is still some opportunity for something like QuickCheck > in your case. Certainly you can use QC to generate > expressions/statements in your EDSL. Then if you can also generate > schemas and data you should be able to write down some properties, for > instance that some class of queries on empty tables should return no > rows. > > A special case of this, and a more specific example, is very similar > to the introductory examples to QC: it must be possible to retrieve a > row after inserting it in an empty table, or deleting it after > inserting it must leave the table unchanged. > > Even if you don't go as far as writing properties that involves the > schema/data generation, generating arbitrary valid AST that must > compile successfully to SQL is interesting. > 2014-07-11 19:58 GMT+02:00 Tom Ellis > : > > I am implementing an EDSL that compiles to SQL and I am wondering what is > > the state of the art in testing code generation. > > > > All the Haskell libraries I could find that deal with SQL generation are > > tested by implementing multiple one-off adhoc queries and checking that when > > either compiled to SQL or run against a database they give the expected, > > prespecified result. > > > > * https://github.com/prowdsponsor/esqueleto/blob/master/test/Test.hs > > * https://github.com/m4dc4p/haskelldb/blob/master/test/TestCases.hs > > * https://github.com/yesodweb/persistent/blob/master/persistent-test/SumTypeTest.hs > > > > I couldn't find any tests for groundhog. > > > > * https://github.com/lykahb/groundhog > > > > I also had a look at Javascript generators. They take a similar adhoc, > > one-off approach. > > > > * https://github.com/valderman/haste-compiler/tree/master/Tests > > * https://github.com/faylang/fay/tree/master/tests > > > > Is this the best we can do in Haskell? Certainly it seems hard to use a > > QuickCheck/SmallCheck approach for this purpose. Is there any way this kind > > of testing can be automated or made more robust? From allbery.b at gmail.com Mon Jul 14 14:46:48 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 14 Jul 2014 10:46:48 -0400 Subject: [Haskell-cafe] book "Haskell Data Analysis Cookbook" by Nishant Shukla In-Reply-To: References: Message-ID: On Mon, Jul 14, 2014 at 1:40 AM, Tobias Dammers wrote: > It is not the same thing, really, unless I'm misunderstanding. AFAIK there > is no straightforward way of making the combined check-if-exists-and-delete > block atomic at the bearsden level, even if you force serial execution at > the haskell level, and the established solution is to forgo the existence > check altogether, relying on the delete call to throw when the file doesn't > exist. > Yes; this is my point, there is no way to make the separate check atomic. It's going to be two system calls which will allow task switching at syscall entry and thereby allow a race against another process; no amount of careful critical section handling within the process can stop this. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan.wehr at gmail.com Mon Jul 14 15:15:56 2014 From: stefan.wehr at gmail.com (Stefan Wehr) Date: Mon, 14 Jul 2014 17:15:56 +0200 Subject: [Haskell-cafe] ANN: HacBerlin - Haskell Hackathon in Berlin, 26-28 Sep 2014 Message-ID: Dear Haskellers, another Haskell Hackathon is waiting for you! Where: Berlin, Germany When: Fri 26 - Sun 28 September 2014 Meet in Berlin, discuss, hack together and improve the Haskell infrastructure. We welcome all programmers interested in Haskell, beginners and experts! For all details, visit our wiki page (http://www.haskell.org/haskellwiki/HacBerlin2014) and make sure to register early. By the way: we are currently looking for one or two keynote talks. If you feel qualified, please let us know. Happy hacking, Stefan From christiaan.baaij at gmail.com Mon Jul 14 15:51:14 2014 From: christiaan.baaij at gmail.com (Christiaan Baaij) Date: Mon, 14 Jul 2014 17:51:14 +0200 Subject: [Haskell-cafe] How to walk under binders "for free" in 'bound'? Message-ID: <67AF256C-C090-445F-B79A-95B64AC6A0F0@gmail.com> Dear list, I'm trying to implement a small dependently typed language (based on [1]) using the generalised De Bruijn indices from the 'bound' library [2]. My main two datatypes are: > data Binder n a > = Lam {binder :: Name n a} > | Pi {binder :: Name n a} Representing my two types of binders, and: > data Term n a > = Var !a > | Universe Integer > | App !(Term n a) !(Term n a) > | Bind !(Binder n (Term n a)) !(Scope (Name n ()) (Term n) a) Representing terms. My problem lies with implementing type-inference for lambda-binders. Originally I started with: > inferType1 :: Eq a > => (a -> Term n a) -- ^ Context > -> Term n a -- ^ Term > -> Term n a -- ^ Inferred type > inferType1 ctx (Var a) = ctx a > inferType1 ctx (Bind (Lam b) s) = Bind (Pi b) s' > where > s' = toScope . inferType1 ctx' . fromScope $ s > ctx' = unvar bCtx fCtx > bCtx _ = fmap F $ extract b > fCtx = fmap F . ctx Where `toScope . inferType1 ctx' . fromScope` entails doing three subsequent traversals: - `fromScope` traverses the term in `s`, which quotients placements of 'F' distributing them to the leaves - `inferType ctx'` then traverses the result of `fromScope` to infer the type - `toScope` transforms the inferred type to a generalised De Bruijn form, requiring a full tree traversal. Also, the new context, `ctx'`, is defined in term of a traversal (fmap). Also note that, for every Scope I walk under, `ctx'` gets an additional traversal. Doing so many traversals seems/is expensive, so after some thinking I improved `inferType2` to: > inferType2 ctx (Bind (Lam b) s) = Bind (Pi b) s' > where > s' = Scope . inferType2 ctx' . unscope $ s > ctx' = unvar bCtx fCtx > bCtx _ = fmap (F . Var) . extract $ b > fCtx = fmap (F . Var) . inferType2 ctx Where the only traversal needed to get `s'` is done by `inferType ctx'`. However, the new context, `ctx'`, remains defined in terms of traversals (fmap). Again, note that, for every Scope I walk under, `ctx'` gets an additional traversal. I could get rid of the remaining traversals in `ctx'` by implementing `inferType3` as: > inferType3 ctx (Bind (Lam b) s) = Bind (Pi b) s' > where > s' = Scope . inferType3 ctx' . unscope $ s > ctx' = unvar bCtx fCtx > bCtx _ = Var . F . extract $ b > fCtx = Var . F . inferType3 ctx But if I do that I start running into problems elsewhere, because the context is now returning lifted expressions. These problems arise for example in `inferPi`, which checks if the type of a term is a pi-binder: > inferPi :: Eq a > => (Term n a -> Term n a) -- ^ Type inference function > -> Term n a > -> (n,Term n a,Scope (Name n ()) (Term n) a) > inferPi inferTy tm = case inferTy tm of > Bind (Pi b) s -> (name b, extract b, s) > t -> error "Function expected" Let's assume that I'm doing type inference for the term: > \(a:*).\(b:*).\(f:(pi(_:a).b).\(x:a).f x Where `*` is `Universe 0`. In the application `f x`, I need to determine if `f` has a pi-type. When using either `inferType` or `inferType2`, I will see that `f` has the shape: > Bind (Pi {binder = Name "_" (Var (F (Var (F (Var (F (Var (B (Name "a" ())))))))))}) > (Scope (Var (F (Var (F (Var (F (Var (B (Name "b" ())))))))))) And so, `inferPi` will have no problems seeing that `f` has a pi-type. However, when using `inferType3`, where the context, `ctx`, returns lifted expressions , `f` has the shape: > Var (F (Var (F (Bind (Pi {binder = Name "_" (Var (F (Var (B (Name "a" ())))))}) > (Scope (Var (F (Var (B (Name "b" ())))))))))) Now `inferPi` will have problems seeing that `f` has a pi-type, it will need to quotient out and distribute the (Var . F) first. The (non-)solution is to quotient and distribute on demand, by defining `inferType4`: > inferType4 :: Eq a > => (a -> Term n a) -- ^ Context > -> (Term n a -> Term n a) -- Quotient and distribute (Var . F) > -> Term n a -- ^ Term > -> Term n a -- ^ Inferred type > inferType4 ctx dist (Var a) = dist (ctx a) > inferType4 ctx dist (Bind (Lam b) s) = Bind (Pi b) s' > where > s' = Scope . inferType4 ctx' dist' . unscope $ s > ctx' = unvar bCtx fCtx > bCtx _ = Var . F . extract $ b > fCtx = Var . F . inferType4 ctx dist > > dist' (Var (F a)) = fmap (F . Var) . dist $ a > dist' e = e However, `inferType4` simply moves the traversal from one place to the other, giving us no improvement over `inferType2`. What we do however see is that, after having descended two Scopes, we would get a `dist'` function that does: > fmap (F . Var) . fmap (F . Var) . dist This gives me hope that instead of having to do two traversals using `fmap`, we could get one traversal of the form: > fmap (F . Var . F . Var) . dist According to the Functor law. I have absolutely no idea how to achieve this single traversal solution though. This leads me to have several, quite general, questions: - Is there a way to get a `dist` function, as defined in `inferType4`, that does a single traversal? - Would it be possible to even get rid of the traversal for the context `ctx`? Perhaps by approaching the `inferType` function completely differently? - Or is there simply no way to implement `inferType` for free (without traversals) using generalised De Bruijn indices? The complete code can be found at: https://gist.github.com/christiaanb/4e0fd1777aee927999aa Cheers, Christiaan Baaij [1] http://math.andrej.com/2012/11/08/how-to-implement-dependent-type-theory-i/ [2] http://hackage.haskell.org/package/bound-1.0.3 From gautier.difolco at gmail.com Mon Jul 14 16:39:22 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Mon, 14 Jul 2014 18:39:22 +0200 Subject: [Haskell-cafe] Doctest, quickcheck and typeclass Message-ID: Hi all, Is there a way, with doctest and quickcheck, to declare test at typeclass level (such as laws) and play them automatically at instance level? For example: -- | Convert from/to a List to/from an arbitrary data structure -- -- >>> prop > fromList . toList == id class Listable d where fromList :: [a] -> d a toList :: d a -> [a] And this test will be played for each instance. Thanks in advance for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From qdunkan at gmail.com Mon Jul 14 17:08:00 2014 From: qdunkan at gmail.com (Evan Laforge) Date: Mon, 14 Jul 2014 10:08:00 -0700 Subject: [Haskell-cafe] Fwd: how to get ghci to load compiled modules in 7.8? In-Reply-To: References: Message-ID: I sent this to haskell-cafe, but there was no response. On stackoverflow there was no response either. I'm trying one last time, but adding ghc-users (which I should have done at the beginning!). Surely it can't be that no one knows how to load modules in ghci? I know a lot of work was done to enable this, as in https://ghc.haskell.org/trac/ghc/wiki/DynamicByDefault, it seems a waste if no one actually knows how to use it! The 7.8.1 release notes make reference to -dynamic-too, and an unexplained "Dynamic Ghci", but implies ghci should just work. Do I need to compile ghci myself in a dynamic way? The DynamicByDefault page also implies that, but I assumed the binary distributions would come with it compiled the right way. This has almost disabled ghci for my work (it can be used, but very slowly and with much retyping of commands, and I find myself avoiding the REPL now), so it's a big regression from 7.6! I added another paragraph from the stackoverflow question. Also, I can't get this to work on linux either, not just OS X. BTW, I got a nice bump in my profiles after upgrading, so 7.8 is mostly good news. Just this one awkward thing keeps it from being all good news. ---------- Forwarded message ---------- I recently upgraded to 7.8.2 and I have a silly question. How do you get ghci to load compiled modules? When I try this: % cat >T.hs module T where x :: Int x = 42 % ghc -c -dynamic-too T.hs % s T.dyn_hi T.dyn_o T.hi T.hs T.o % ghci GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package filepath-1.3.0.2 ... linking ... done. Prelude> :l T [1 of 1] Compiling T ( T.hs, interpreted ) Ok, modules loaded: T. *T> It still loads the file interpreted, even though there is a .dyn_o present. What am I doing wrong? This is on x86-64 OS X. There is one other thing which may be related. Since I load everything interpreted now, I've noticed that the input gets very laggy when I have a hundred or so modules loaded. Also the haskeline state gets confused, e.g. I hit escape k to get the previous line, but then it spontaneously goes back into insert mode again. It stays balky and awkward for about 15 seconds before returning to normal slightly. It's almost as if, after loading all the bytecode, it's still doing tons of work in the background, with constant GC freezes. But what work could it be doing? The bytecode is loaded and I haven't asked it to do anything yet! I don't know if this is new to 7.8, or if it's a result of loading bytecode instead of binary. Update: loading with -fobject-code to force compilation reduces some of the balkiness, but some is still there! So maybe this is a regression from 7.6? From janis.voigtlaender at gmail.com Mon Jul 14 17:45:28 2014 From: janis.voigtlaender at gmail.com (=?UTF-8?Q?Janis_Voigtl=C3=A4nder?=) Date: Mon, 14 Jul 2014 19:45:28 +0200 Subject: [Haskell-cafe] Doctest, quickcheck and typeclass In-Reply-To: References: Message-ID: 2014-07-14 18:39 GMT+02:00 Gautier DI FOLCO : > Hi all, > > Is there a way, with doctest and quickcheck, to declare test at typeclass > level (such as laws) and play them automatically at instance level? > Hmm, let's try googling for "Testing type class laws". ... Oh, surprise, there is a paper with exactly that title. :-) http://dx.doi.org/10.1145/2430532.2364514 http://wiki.portal.chalmers.se/cse/pmwiki.php/FP/ClassLaws Maybe that does help? (Might need some extra work to actually integrate with doctest, but the groundwork is there, I think.) Best, Janis. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gautier.difolco at gmail.com Mon Jul 14 18:04:59 2014 From: gautier.difolco at gmail.com (Gautier DI FOLCO) Date: Mon, 14 Jul 2014 20:04:59 +0200 Subject: [Haskell-cafe] Doctest, quickcheck and typeclass In-Reply-To: References: Message-ID: 2014-07-14 19:45 GMT+02:00 Janis Voigtl?nder : > 2014-07-14 18:39 GMT+02:00 Gautier DI FOLCO : > > Hi all, >> >> Is there a way, with doctest and quickcheck, to declare test at typeclass >> level (such as laws) and play them automatically at instance level? >> > > Hmm, let's try googling for "Testing type class laws". > > ... > > Oh, surprise, there is a paper with exactly that title. :-) > > http://dx.doi.org/10.1145/2430532.2364514 > > http://wiki.portal.chalmers.se/cse/pmwiki.php/FP/ClassLaws > > Maybe that does help? (Might need some extra work to actually integrate > with doctest, but the groundwork is there, I think.) > > Best, > Janis. > > Thanks, I'll have a look, thanks. Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.gibiansky at gmail.com Tue Jul 15 03:23:21 2014 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Mon, 14 Jul 2014 20:23:21 -0700 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude Message-ID: Hey all, I would like to propose a very minor flag to add to GHC. I would like GHC to have a --with-prelude flag, which would specify an alternate Prelude to use instead of the default Haskell prelude. This would have an effect similar to -XNoImplicitPrelude and an additional import MyNewPrelude in the source file. It might be a *little* different semantically, as a qualified import would disable the original implicit import, just like it does with the default Haskell prelude. The benefit this would have is that this would give alternate preludes a more first-class status. Instead of having to import an alternative prelude everywhere, you could just have a ghc-options: --with-prelude=... flag in your *.cabal file, and have a different prelude be used. This is important for my own work, as I highly prefer other preludes for my non-library development; I think this is a feature which will be very useful as Haskell develops and we try to figure out how to get rid of the warts in the current Prelude. In order to specify the actula module, I propose that you just pass the module name as the --with-prelude argument. You could thus invoke GHC like this: ghc --with-prelude=MyNewPrelude Main.hs Then, the same rules apply for figuring out which MyNewPrelude module you are referring to as if you had written a `import MyNewPrelude` statement in the file. I am willing to implement this for GHC if people agree that this is a useful flag (or at least agree that isn't not a *bad* idea). What are your thoughts on this proposal? -- Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Tue Jul 15 05:55:34 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Tue, 15 Jul 2014 08:55:34 +0300 Subject: [Haskell-cafe] extensible-transformers In-Reply-To: References: Message-ID: <20140715055534.GA8773@sniper> Hi Ben (and others), I'm covering the alternative approaches to the extensible effects problem in this series of articles: http://ro-che.info/articles/2014-06-11-problem-with-mtl.html http://ro-che.info/articles/2014-06-14-extensible-effects-failed.html http://ro-che.info/articles/2014-07-15-type-based-lift.html (to be continued) I thought you may be interested. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From greg at gregorycollins.net Tue Jul 15 06:44:24 2014 From: greg at gregorycollins.net (Gregory Collins) Date: Tue, 15 Jul 2014 08:44:24 +0200 Subject: [Haskell-cafe] [ANN](and feedback request) unagi-chan: Fast and scalable concurrent queues for x86, with a Chan-like API In-Reply-To: References: Message-ID: On Thu, Jul 10, 2014 at 8:39 PM, Brandon Simmons < brandon.m.simmons at gmail.com> wrote: > I'm happy to finally release unagi-chan, an implementation of > high-performance concurrent FIFO queues that have an API very similar > to Control.Concurrent.Chan. You can see benchmarks and documentation > here: > It's difficult to overstate how much faster unagi-chan is than Control.Concurrent under contention, I'm seeing >10x improvements in the 100 readers/100 writers benchmark on this quad-core machine. I'll have to try it on the 8-core at work. Performance seems to be predictably fast as you scale the number of workers, unlike the others which asymptotically explode during contention. Really impressive work, Brandon. How close is unagi-chan to being a drop-in replacement for MVar? Since this implementation seems to clearly be better, personally I would wonder if it shouldn't just replace the existing one in the standard library. Also: can you use the same technique to get a fast implementation of bounded queues? G -- Gregory Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From simonpj at microsoft.com Tue Jul 15 07:26:05 2014 From: simonpj at microsoft.com (Simon Peyton Jones) Date: Tue, 15 Jul 2014 07:26:05 +0000 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: Message-ID: <618BE556AADD624C9C918AA5D5911BEF1042CEC3@DB3PRD3001MB020.064d.mgd.msft.net> That sounds reasonable to me. I?d use ?prelude-is as the flag, by analogy with ?main-is; see http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#options-linker Simon From: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Andrew Gibiansky Sent: 15 July 2014 04:23 To: Haskell Cafe Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude Hey all, I would like to propose a very minor flag to add to GHC. I would like GHC to have a --with-prelude flag, which would specify an alternate Prelude to use instead of the default Haskell prelude. This would have an effect similar to -XNoImplicitPrelude and an additional import MyNewPrelude in the source file. It might be a little different semantically, as a qualified import would disable the original implicit import, just like it does with the default Haskell prelude. The benefit this would have is that this would give alternate preludes a more first-class status. Instead of having to import an alternative prelude everywhere, you could just have a ghc-options: --with-prelude=... flag in your *.cabal file, and have a different prelude be used. This is important for my own work, as I highly prefer other preludes for my non-library development; I think this is a feature which will be very useful as Haskell develops and we try to figure out how to get rid of the warts in the current Prelude. In order to specify the actula module, I propose that you just pass the module name as the --with-prelude argument. You could thus invoke GHC like this: ghc --with-prelude=MyNewPrelude Main.hs Then, the same rules apply for figuring out which MyNewPrelude module you are referring to as if you had written a `import MyNewPrelude` statement in the file. I am willing to implement this for GHC if people agree that this is a useful flag (or at least agree that isn't not a bad idea). What are your thoughts on this proposal? -- Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander at plaimi.net Tue Jul 15 09:25:16 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Tue, 15 Jul 2014 11:25:16 +0200 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: <618BE556AADD624C9C918AA5D5911BEF1042CEC3@DB3PRD3001MB020.064d.mgd.msft.net> References: <618BE556AADD624C9C918AA5D5911BEF1042CEC3@DB3PRD3001MB020.064d.mgd.msft.net> Message-ID: <53C4F37C.4000903@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 +1. Sounds great. Agree with SPJ in that you should call it -prelude-is. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlPE83wACgkQRtClrXBQc7WaXwD+I/1AdXaYeSCFgzdjWDWE7Xmj WWfV0D2BXSR6XZm7CXYA/jWPxwzNLFX5R7n+dxAPJO5hhAesIp6lkOk0TjB/emua =Fz/U -----END PGP SIGNATURE----- From oleg at okmij.org Tue Jul 15 10:26:52 2014 From: oleg at okmij.org (oleg at okmij.org) Date: Tue, 15 Jul 2014 06:26:52 -0400 (EDT) Subject: [Haskell-cafe] What is the state of the art in testing code generation? Message-ID: <20140715102652.F3C93C3842@www1.g3.pair.com> Tom Ellis wrote: > The first impediment to using QuickCheck is that my EDSL is typed. I don't > know how to generate random terms in the presence of types. First I should point out Magic Haskeller (which generates typed (Haskell) terms and then accepts those that satisfy the given input-output relationship). http://nautilus.cs.miyazaki-u.ac.jp/~skata/MagicHaskeller.html It is MagicHaskeller on Hackage. The most straightforward method is to generate random terms and filter well-typed ones. This is usually a bad method since many or most randomly generated terms will be ill-typed. One should generate well-typed terms from the beginning, without any rejections. That is actually not difficult: one merely needs to take the type checker (which one has to write anyway) and run it backwards. Perhaps it is not as simple as I made it sound, depending on the type system (for example, the type inference for simply-typed lambda-calculus without any annotations requires guessing. One has to guess correctly all the type, otherwise the process becomes slow). It has been done, in a mainstream functional language: OCaml. The code can be re-written for Haskell using the tricks for non-determinism with sharing (the Share monad). Due to many deadlines I cannot re-write myself, not until the middle of the next week. Also, I don't know your type system. If you are curious about the OCaml code, it can be found at http://okmij.org/ftp/kakuritu/type_inference.ml The main function is let rec typeof : gamma -> term -> tp = fun gamma exp -> match exp () with | I _ -> int | V name -> begin try List.assoc name gamma with Not_found -> fail () end | L (v,body) -> let targ = new_tvar() in let tbody = typeof ((v,targ) :: gamma) body in arr targ tbody | A (e1,e2) -> let tres = new_tvar() in tp_same (typeof gamma e1) (arr (typeof gamma e2) tres); tres It can infer a type of a term (or fail if it is will-typed), it can generate well-typed terms one-by-one, or it can generate all terms of a particular structure (e.g., with two lambdas at the top) and/or of a particular type or type shape (e.g., an arrow). From chriswarbo at googlemail.com Tue Jul 15 12:15:24 2014 From: chriswarbo at googlemail.com (Chris Warburton) Date: Tue, 15 Jul 2014 13:15:24 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: <20140715102652.F3C93C3842@www1.g3.pair.com> (oleg@okmij.org's message of "Tue, 15 Jul 2014 06:26:52 -0400 (EDT)") References: <20140715102652.F3C93C3842@www1.g3.pair.com> Message-ID: <86a98ahl7n.fsf@gmail.com> oleg at okmij.org writes: > One should generate well-typed terms from the beginning, without any > rejections. That is actually not difficult: one merely needs to take > the type checker (which one has to write anyway) and run it > backwards. In the ideal case, this can be done automatically, eg. see the first "Sample application" on http://kanren.sourceforge.net/ In general, the more information we throw away, the "less reversible" it becomes, and hence the more code we need to support going backwards. > Perhaps it is not as simple as I made it sound, depending on the type > system (for example, the type inference for simply-typed > lambda-calculus without any annotations requires guessing. One has to > guess correctly all the type, otherwise the process becomes slow). We don't need to guess if we generate the terms and the types at the same time; we just have to plug them into the right positions, which may be a little tedious compared to just writing "arbitrary". > Also, I don't know your type system. That's what put me off replying originally. The richer the types, the more difficult it will be to generate terms for them. Choosing between Ints, Strings, Bools, etc. and simple collections thereof is pretty trivial. Finding an inhabitant of some huge auto-generated type containing predicates, constraints, relations, etc. requires a theorem-prover ;) Also related, on the subject of generating typed terms: http://research.microsoft.com/en-us/people/dimitris/every-bit-counts.pdf Cheers, Chris From eir at cis.upenn.edu Tue Jul 15 12:45:24 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 15 Jul 2014 08:45:24 -0400 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: <53C4F37C.4000903@plaimi.net> References: <618BE556AADD624C9C918AA5D5911BEF1042CEC3@DB3PRD3001MB020.064d.mgd.msft.net> <53C4F37C.4000903@plaimi.net> Message-ID: <8C2C6F8D-E357-40F2-B156-65E5A4E86249@cis.upenn.edu> +1 on original proposal and SPJ's amendment. If this existed today, I would plan to use it the first few weeks when teaching an intro Haskell course this fall. Thanks! On Jul 15, 2014, at 5:25 AM, Alexander Berntsen wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > +1. Sounds great. Agree with SPJ in that you should call it -prelude-is. > > - -- > Alexander > alexander at plaimi.net > https://secure.plaimi.net/~alexander > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.22 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iF4EAREIAAYFAlPE83wACgkQRtClrXBQc7WaXwD+I/1AdXaYeSCFgzdjWDWE7Xmj > WWfV0D2BXSR6XZm7CXYA/jWPxwzNLFX5R7n+dxAPJO5hhAesIp6lkOk0TjB/emua > =Fz/U > -----END PGP SIGNATURE----- > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From davidleothomas at gmail.com Tue Jul 15 16:15:34 2014 From: davidleothomas at gmail.com (David Thomas) Date: Tue, 15 Jul 2014 09:15:34 -0700 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: <8C2C6F8D-E357-40F2-B156-65E5A4E86249@cis.upenn.edu> References: <618BE556AADD624C9C918AA5D5911BEF1042CEC3@DB3PRD3001MB020.064d.mgd.msft.net> <53C4F37C.4000903@plaimi.net> <8C2C6F8D-E357-40F2-B156-65E5A4E86249@cis.upenn.edu> Message-ID: I'd just like to suggest that -prelude-is MyPrelude smartly avoid breakage when building MyPrelude.hs On Tue, Jul 15, 2014 at 5:45 AM, Richard Eisenberg wrote: > +1 on original proposal and SPJ's amendment. If this existed today, I would plan to use it the first few weeks when teaching an intro Haskell course this fall. > > Thanks! > > On Jul 15, 2014, at 5:25 AM, Alexander Berntsen wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> +1. Sounds great. Agree with SPJ in that you should call it -prelude-is. >> >> - -- >> Alexander >> alexander at plaimi.net >> https://secure.plaimi.net/~alexander >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v2.0.22 (GNU/Linux) >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ >> >> iF4EAREIAAYFAlPE83wACgkQRtClrXBQc7WaXwD+I/1AdXaYeSCFgzdjWDWE7Xmj >> WWfV0D2BXSR6XZm7CXYA/jWPxwzNLFX5R7n+dxAPJO5hhAesIp6lkOk0TjB/emua >> =Fz/U >> -----END PGP SIGNATURE----- >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From andrew.gibiansky at gmail.com Tue Jul 15 16:38:54 2014 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Tue, 15 Jul 2014 09:38:54 -0700 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <618BE556AADD624C9C918AA5D5911BEF1042CEC3@DB3PRD3001MB020.064d.mgd.msft.net> <53C4F37C.4000903@plaimi.net> <8C2C6F8D-E357-40F2-B156-65E5A4E86249@cis.upenn.edu> Message-ID: Good call, David. It probably makes sense for --prelude-is MyPrelude to just act like -XNoImplicitPrelude when in the context ghc --prelude-is MyPrelude MyPrelude.hs That way it can be used as a flag in a cabal package that contains the prelude to be used. I will try to start working on a patch for this in the next couple of weeks :) -- Andrew On Tue, Jul 15, 2014 at 9:15 AM, David Thomas wrote: > I'd just like to suggest that -prelude-is MyPrelude smartly avoid > breakage when building MyPrelude.hs > > On Tue, Jul 15, 2014 at 5:45 AM, Richard Eisenberg > wrote: > > +1 on original proposal and SPJ's amendment. If this existed today, I > would plan to use it the first few weeks when teaching an intro Haskell > course this fall. > > > > Thanks! > > > > On Jul 15, 2014, at 5:25 AM, Alexander Berntsen > wrote: > > > >> -----BEGIN PGP SIGNED MESSAGE----- > >> Hash: SHA256 > >> > >> +1. Sounds great. Agree with SPJ in that you should call it -prelude-is. > >> > >> - -- > >> Alexander > >> alexander at plaimi.net > >> https://secure.plaimi.net/~alexander > >> -----BEGIN PGP SIGNATURE----- > >> Version: GnuPG v2.0.22 (GNU/Linux) > >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > >> > >> iF4EAREIAAYFAlPE83wACgkQRtClrXBQc7WaXwD+I/1AdXaYeSCFgzdjWDWE7Xmj > >> WWfV0D2BXSR6XZm7CXYA/jWPxwzNLFX5R7n+dxAPJO5hhAesIp6lkOk0TjB/emua > >> =Fz/U > >> -----END PGP SIGNATURE----- > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at groovie.org Tue Jul 15 17:18:24 2014 From: ben at groovie.org (Ben Bangert) Date: Tue, 15 Jul 2014 10:18:24 -0700 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads Message-ID: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> I have been testing solutions in several languages for running a network daemon that accepts hundreds of thousands of websocket connections, and moves messages between them. Originally I used this websocket lib, http://jaspervdj.be/websockets/, but upon discovering a rather severe memory leak issue even when sending just a basic ping, switched to Michael Snoyman's first stab at a websocket impl for Yesod here: https://github.com/yesodweb/yesod/commit/66437453f57e6a2747ff7c2199aa7ad25db5904c#diff-dea2b092b8e392f12cc93acb345745e1R58. When under mild load (5k connections, each pinging once every 10+ seconds), memory usage remained stable and acceptable around 205 MB. Switching to higher load (pinging every second or less), memory usage spiked to 560 MB, and continued to 'leak' slowly. When I quit the server with the profile diagnostics, it indicate that hundreds of MB were "lost due to fragmentation". In addition, merely opening the connections and dropping them, repeatedly, made the base memory usage go up. Somewhere, memory is not being fully reclaimed when the connections are dropped. For a few thousand connections doing little, this wouldn't matter much. However, I'm trying to gauge whether its feasible to use Haskell to handle 150-200k connections that regularly come/go and are held open for long periods of time. Such massive memory use with what looks like leaks (or fragmentation issues) is problematic. I have created a very simple TCP based echo client/server here: https://github.com/bbangert/echo The server can be run after compiling with no additional options, and will listen on port 8080. The client can be run like so: ./dist/build/echoclient/echoclient localhost 8080 2000 0.5 The last number is the frequency to ping (every half second), the second to last is how many clients to connect. Under my local tests, when pinging every 5+ seconds, 2k clients will take about 50-75 MB of ram. Pinging every 0.5 seconds jumps to ~ 180 MB of ram, and this is for a mere 2k clients. Starting/stopping the echoclient repeatedly also causes the servers overall memory usage to continue to climb higher and higher. Releasing the connections never quite gets the memory usage down to where it started. The issue seems to occur under both GHC 7.6.3 and 7.8.2. I know there's a variety of ghc options that might be tuned, am I missing some critical option to keep memory usage under control? Is there a better way to build high TCP throughput/concurrent servers in Haskell that I'm missing? Thanks, Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From michael at orlitzky.com Tue Jul 15 17:30:48 2014 From: michael at orlitzky.com (Michael Orlitzky) Date: Tue, 15 Jul 2014 13:30:48 -0400 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: Message-ID: <53C56548.1040106@orlitzky.com> On 07/14/2014 11:23 PM, Andrew Gibiansky wrote: > Hey all, > > I would like to propose a very minor flag to add to GHC. I would like > GHC to have a --with-prelude flag, which would specify an alternate > Prelude to use instead of the default Haskell prelude. > > This would have an effect similar to -XNoImplicitPrelude and an additional > > import MyNewPrelude > > in the source file. It might be a /little/ different semantically, as a > qualified import would disable the original implicit import, just like > it does with the default Haskell prelude. > To play devil's advocate, I don't think this is a good idea. It moves information that is fundamentally local (which library imports a module requires) into global state: magic flags that must be passed to the build system for anything to work. It would be super annoying for an {IDE, coworker, ...} to have to analyze your build system just to figure out which functions are in scope. We went down this road once before with -fglasgow-exts. Eventually, we all realized it was much better to place the required extensions in pragmas at the top of the file. From alois.cochard at gmail.com Tue Jul 15 17:34:48 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Tue, 15 Jul 2014 18:34:48 +0100 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: Message-ID: +1 I was actually looking for a feature like that few days ago! On Jul 15, 2014 4:24 AM, "Andrew Gibiansky" wrote: > Hey all, > > I would like to propose a very minor flag to add to GHC. I would like GHC > to have a --with-prelude flag, which would specify an alternate Prelude to > use instead of the default Haskell prelude. > > This would have an effect similar to -XNoImplicitPrelude and an additional > > import MyNewPrelude > > in the source file. It might be a *little* different semantically, as a > qualified import would disable the original implicit import, just like it > does with the default Haskell prelude. > > The benefit this would have is that this would give alternate preludes a > more first-class status. Instead of having to import an alternative prelude > everywhere, you could just have a ghc-options: --with-prelude=... flag in > your *.cabal file, and have a different prelude be used. This is important > for my own work, as I highly prefer other preludes for my non-library > development; I think this is a feature which will be very useful as Haskell > develops and we try to figure out how to get rid of the warts in the > current Prelude. > > In order to specify the actula module, I propose that you just pass the > module name as the --with-prelude argument. You could thus invoke GHC like > this: > > ghc --with-prelude=MyNewPrelude Main.hs > > Then, the same rules apply for figuring out which MyNewPrelude module you > are referring to as if you had written a `import MyNewPrelude` statement in > the file. > > I am willing to implement this for GHC if people agree that this is a > useful flag (or at least agree that isn't not a *bad* idea). > > What are your thoughts on this proposal? > > -- Andrew > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Tue Jul 15 18:34:27 2014 From: spam at scientician.net (Bardur Arantsson) Date: Tue, 15 Jul 2014 20:34:27 +0200 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: <53C56548.1040106@orlitzky.com> References: <53C56548.1040106@orlitzky.com> Message-ID: On 2014-07-15 19:30, Michael Orlitzky wrote: > On 07/14/2014 11:23 PM, Andrew Gibiansky wrote: >> Hey all, >> >> I would like to propose a very minor flag to add to GHC. I would like >> GHC to have a --with-prelude flag, which would specify an alternate >> Prelude to use instead of the default Haskell prelude. >> >> This would have an effect similar to -XNoImplicitPrelude and an additional >> >> import MyNewPrelude >> >> in the source file. It might be a /little/ different semantically, as a >> qualified import would disable the original implicit import, just like >> it does with the default Haskell prelude. >> > [--snip--] > > We went down this road once before with -fglasgow-exts. Eventually, we > all realized it was much better to place the required extensions in > pragmas at the top of the file. > Except "we" don't :). "We" use flags in the .cabal file. Or, at least I do. Explicitness certainly sometimes has great value, but not always. Regards, From noteed at gmail.com Tue Jul 15 18:41:03 2014 From: noteed at gmail.com (Vo Minh Thu) Date: Tue, 15 Jul 2014 20:41:03 +0200 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <53C56548.1040106@orlitzky.com> Message-ID: 2014-07-15 20:34 GMT+02:00 Bardur Arantsson : > On 2014-07-15 19:30, Michael Orlitzky wrote: >> On 07/14/2014 11:23 PM, Andrew Gibiansky wrote: >>> Hey all, >>> >>> I would like to propose a very minor flag to add to GHC. I would like >>> GHC to have a --with-prelude flag, which would specify an alternate >>> Prelude to use instead of the default Haskell prelude. >>> >>> This would have an effect similar to -XNoImplicitPrelude and an additional >>> >>> import MyNewPrelude >>> >>> in the source file. It might be a /little/ different semantically, as a >>> qualified import would disable the original implicit import, just like >>> it does with the default Haskell prelude. >>> >> > [--snip--] >> >> We went down this road once before with -fglasgow-exts. Eventually, we >> all realized it was much better to place the required extensions in >> pragmas at the top of the file. >> > > Except "we" don't :). "We" use flags in the .cabal file. Or, at least I > do. Explicitness certainly sometimes has great value, but not always. And the problem exists already for other modules than Prelude, i.e. different libraries can export the same modules. The libraries are selected via cabal or via package-qualified imports (and I think the former is preferred). From eir at cis.upenn.edu Tue Jul 15 18:47:01 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 15 Jul 2014 14:47:01 -0400 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <618BE556AADD624C9C918AA5D5911BEF1042CEC3@DB3PRD3001MB020.064d.mgd.msft.net> <53C4F37C.4000903@plaimi.net> <8C2C6F8D-E357-40F2-B156-65E5A4E86249@cis.upenn.edu> Message-ID: <8EBC5A15-38F6-4DA0-A327-0679CF68D5D9@cis.upenn.edu> One more tiny tiny point: please make it -prelude-is and NOT --prelude-is so that it matches with -main-is. (Note the number of dashes.) In general, the anarchy of whether to use one dash or two is annoying, and I think that the parallel with -main-is helps to make the decision easy for this new flag. Thanks! Richard On Jul 15, 2014, at 12:38 PM, Andrew Gibiansky wrote: > Good call, David. It probably makes sense for --prelude-is MyPrelude to just act like -XNoImplicitPrelude when in the context > > ghc --prelude-is MyPrelude MyPrelude.hs > > That way it can be used as a flag in a cabal package that contains the prelude to be used. > > I will try to start working on a patch for this in the next couple of weeks :) > > -- Andrew > > > On Tue, Jul 15, 2014 at 9:15 AM, David Thomas wrote: > I'd just like to suggest that -prelude-is MyPrelude smartly avoid > breakage when building MyPrelude.hs > > On Tue, Jul 15, 2014 at 5:45 AM, Richard Eisenberg wrote: > > +1 on original proposal and SPJ's amendment. If this existed today, I would plan to use it the first few weeks when teaching an intro Haskell course this fall. > > > > Thanks! > > > > On Jul 15, 2014, at 5:25 AM, Alexander Berntsen wrote: > > > >> -----BEGIN PGP SIGNED MESSAGE----- > >> Hash: SHA256 > >> > >> +1. Sounds great. Agree with SPJ in that you should call it -prelude-is. > >> > >> - -- > >> Alexander > >> alexander at plaimi.net > >> https://secure.plaimi.net/~alexander > >> -----BEGIN PGP SIGNATURE----- > >> Version: GnuPG v2.0.22 (GNU/Linux) > >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > >> > >> iF4EAREIAAYFAlPE83wACgkQRtClrXBQc7WaXwD+I/1AdXaYeSCFgzdjWDWE7Xmj > >> WWfV0D2BXSR6XZm7CXYA/jWPxwzNLFX5R7n+dxAPJO5hhAesIp6lkOk0TjB/emua > >> =Fz/U > >> -----END PGP SIGNATURE----- > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg at gregorycollins.net Tue Jul 15 20:49:31 2014 From: greg at gregorycollins.net (Gregory Collins) Date: Tue, 15 Jul 2014 22:49:31 +0200 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> Message-ID: +kazu, +Simon M On Tue, Jul 15, 2014 at 7:18 PM, Ben Bangert wrote: > I have created a very simple TCP based echo client/server here: > https://github.com/bbangert/echo > Ben, could you please tell us what sort of machine you are running this on? Is it Mac, Linux, or Windows? I took your test case and hacked it down to eliminate some possible sources of error (I was suspicious of Handle for a while, also of an old space leak bug in "forever" which I think is fixed now): https://github.com/gregorycollins/ghc-echo-leak-bug The revised echoserver is fine on my machine (stable at 22MB resident) but *the echo client leaks*. Happens with/without -O2 on GHC 7.8.3 for OSX. Kazu, I think there's a good chance this is a bug in the multicore IO manager, the test code is doing little more than write + read + threadDelay. G -- Gregory Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at groovie.org Tue Jul 15 21:46:14 2014 From: ben at groovie.org (Ben Bangert) Date: Tue, 15 Jul 2014 14:46:14 -0700 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> Message-ID: <4894F785-1332-4624-9C7B-AD4BC2D15B67@groovie.org> On Jul 15, 2014, at 1:49 PM, Gregory Collins wrote: > +kazu, +Simon M > > On Tue, Jul 15, 2014 at 7:18 PM, Ben Bangert wrote: > I have created a very simple TCP based echo client/server here: https://github.com/bbangert/echo > > Ben, could you please tell us what sort of machine you are running this on? Is it Mac, Linux, or Windows? It occurs on my Mac, and it occurs on the linux AWS AMI instances I've compiled/run it on. > I took your test case and hacked it down to eliminate some possible sources of error (I was suspicious of Handle for a while, also of an old space leak bug in "forever" which I think is fixed now): > > https://github.com/gregorycollins/ghc-echo-leak-bug I should note the use of ByteString's was intentional (re: dropping hGetLine in the server), this is because many of the networking libs use ByteString's and I'd prefer not to rewrite all the libs from the TCP layer up to the Websocket layer. This stack of layers.... TCP - HTTP - Websocket all introduce various objects as they slice/dice the bytes into websocket frames using ByteStrings. It's quite possible the issue I'm seeing is related to how GHC handles the introduction of huge amounts of ByteString's that then must all be GC'd (esp regarding how the profile shows memory being lost to fragmentation). Someone on the #haskell channel suggested that due to how ByteString's are implemented, GHC is unable to move them around in memory which can lead to the fragmentation. > The revised echoserver is fine on my machine (stable at 22MB resident) but the echo client leaks. Happens with/without -O2 on GHC 7.8.3 for OSX. Yes, I noticed the client leak, though since I'm mainly interested in running the server that didn't concern me as much. > Kazu, I think there's a good chance this is a bug in the multicore IO manager, the test code is doing little more than write + read + threadDelay. Thanks a lot for looking at this, hopefully the ByteString issue is known or possible to fix short of looking at the larger program I have that exhibits it (which is all open-source so I can post that as well, the 'simple' websocket server and websocket tester looks like this: https://gist.github.com/bbangert/6b7ef979963d7cb1838e) using the yesod-websocket code from the https://github.com/yesodweb/yesod/commit/66437453f57e6a2747ff7c2199aa7ad25db5904c#diff-dea2b092b8e392f12cc93acb345745e1R58 changeset). I'll see about better packaging the more involved websocket one that leaks/fragments memory substantially faster. Cheers, Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From brandon.m.simmons at gmail.com Tue Jul 15 22:41:12 2014 From: brandon.m.simmons at gmail.com (Brandon Simmons) Date: Tue, 15 Jul 2014 18:41:12 -0400 Subject: [Haskell-cafe] [ANN](and feedback request) unagi-chan: Fast and scalable concurrent queues for x86, with a Chan-like API In-Reply-To: References: Message-ID: On Tue, Jul 15, 2014 at 2:44 AM, Gregory Collins wrote: > > On Thu, Jul 10, 2014 at 8:39 PM, Brandon Simmons > wrote: >> >> I'm happy to finally release unagi-chan, an implementation of >> high-performance concurrent FIFO queues that have an API very similar >> to Control.Concurrent.Chan. You can see benchmarks and documentation >> here: > > > It's difficult to overstate how much faster unagi-chan is than > Control.Concurrent under contention, I'm seeing >10x improvements in the 100 > readers/100 writers benchmark on this quad-core machine. I'll have to try it > on the 8-core at work. Performance seems to be predictably fast as you scale > the number of workers, unlike the others which asymptotically explode during > contention. Really impressive work, Brandon. Thanks a lot. And thank you for trying it out. > > How close is unagi-chan to being a drop-in replacement for MVar? Since this > implementation seems to clearly be better, personally I would wonder if it > shouldn't just replace the existing one in the standard library. It's a drop-in replacement for all non-deprecated functions, except for the splitting of input and output ends of the chan and the handling of async exceptions in the reader. I wouldn't be comfortable advocating for it as a replacement, personally. Mostly because of a few questions and misgivings I have about some implementation details (especially related to memory model stuff). They're all documented in the source and I'm very comfortable with people using it in production, but only after running the test suite. > > Also: can you use the same technique to get a fast implementation of bounded > queues? There's a pretty straightforward path to at least some sort of "fuzzy" bounded queue that just fails (rather than the writer block), which might end up as simply a `chanSize :: InChan a -> IO Int`. Please feel free to add to the discussion here: https://github.com/jberryman/unagi-chan/issues/1 Thanks again, Brandon > > G > -- > Gregory Collins From ekmett at gmail.com Tue Jul 15 22:59:01 2014 From: ekmett at gmail.com (Edward Kmett) Date: Tue, 15 Jul 2014 18:59:01 -0400 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <53C56548.1040106@orlitzky.com> Message-ID: Personally I put all the flags in each file. That way I can know what features I'm needing at each use-site. Most of my files have only 1-2 flags. Others have 30. It is important to me to know where I'm leaning on things like FlexibleInstances that can make inference for users worse if I don't do so carefully. It also lets me load up individual modules as I'm working from ghci directly rather than rebuild the entire package. This is, of course, a matter of style, so tastes vary. -Edward On Tue, Jul 15, 2014 at 2:34 PM, Bardur Arantsson wrote: > On 2014-07-15 19:30, Michael Orlitzky wrote: > > On 07/14/2014 11:23 PM, Andrew Gibiansky wrote: > >> Hey all, > >> > >> I would like to propose a very minor flag to add to GHC. I would like > >> GHC to have a --with-prelude flag, which would specify an alternate > >> Prelude to use instead of the default Haskell prelude. > >> > >> This would have an effect similar to -XNoImplicitPrelude and an > additional > >> > >> import MyNewPrelude > >> > >> in the source file. It might be a /little/ different semantically, as a > >> qualified import would disable the original implicit import, just like > >> it does with the default Haskell prelude. > >> > > > [--snip--] > > > > We went down this road once before with -fglasgow-exts. Eventually, we > > all realized it was much better to place the required extensions in > > pragmas at the top of the file. > > > > Except "we" don't :). "We" use flags in the .cabal file. Or, at least I > do. Explicitness certainly sometimes has great value, but not always. > > Regards, > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kazu at iij.ad.jp Wed Jul 16 01:04:15 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Wed, 16 Jul 2014 10:04:15 +0900 (JST) Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> Message-ID: <20140716.100415.1370696111404184357.kazu@iij.ad.jp> Greg, > https://github.com/gregorycollins/ghc-echo-leak-bug > > The revised echoserver is fine on my machine (stable at 22MB resident) but *the > echo client leaks*. Happens with/without -O2 on GHC 7.8.3 for OSX. I looked at your code very quickly. What happens if you replace "replicateM" and "mapM_" to recursions? (Especially I don't trust replicateM in IO.) Also, we need to confirm that atomicModifyIORef' does not really leak space. > Kazu, I think there's a good chance this is a bug in the multicore IO > manager, the test code is doing little more than write + read + threadDelay. If the space leak also happens with GHC 7.6.3, it is not specific to the multicore IO manager. But the old/new IO manager might have potential space leak. P.S. I'm running Mighty 3 (based on WAI) compiled with GHC 7.8.x for a long time. But I don't see any space leak at all. --Kazu From ben at groovie.org Wed Jul 16 03:46:36 2014 From: ben at groovie.org (Ben Bangert) Date: Tue, 15 Jul 2014 20:46:36 -0700 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> Message-ID: <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> On Jul 15, 2014, at 1:49 PM, Gregory Collins wrote: > I took your test case and hacked it down to eliminate some possible sources of error (I was suspicious of Handle for a while, also of an old space leak bug in "forever" which I think is fixed now): > > https://github.com/gregorycollins/ghc-echo-leak-bug > > The revised echoserver is fine on my machine (stable at 22MB resident) but the echo client leaks. Happens with/without -O2 on GHC 7.8.3 for OSX. I've run the new server code, indeed it initially takes less memory. However, when I ctrl-C the testing client, it fails to properly close sockets now, they stay open forever (the original code I posted always closed the sockets when I killed the testing client). Did you try ctrl-c the test client and re-running it several times? I'm guessing that the recv call is blocking forever and failing somehow to note that the socket was actually closed under it, while the hGetline I was using properly detects this condition and closes the socket when it notices the other side has left. I should note that when asking for even 1000 echo clients, the test client as you've changed it dies when I try to launch it (it shows Clients Connected: 0, then just exits silently). I had to use my old testing client to test the server changes you made. If the sockets would properly close when terminating the client abruptly, then its quite possible memory usage would remain lower as it definitely took much much less memory for the first 2k echo clients. Cheers, Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From aspergesoepje at gmail.com Wed Jul 16 09:46:02 2014 From: aspergesoepje at gmail.com (L Corbijn) Date: Wed, 16 Jul 2014 11:46:02 +0200 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: <53C56548.1040106@orlitzky.com> References: <53C56548.1040106@orlitzky.com> Message-ID: Another problem with making it (cabal) global is that you have to separate the alternative Prelude (and the modules it depends on) from the rest of the modules. Otherwise you would have an circular dependency by importing the new Prelude in the new Prelude you are defining. For project specific preludes I can think of two options. Separate into a package/library, which will probably be more trouble than it would solve in the first place. Alternatively there could be a mechanism for excluding the automatic new Prelude import, which would make things only more complicated. Either way it seems that it would make things only more difficult if you want a prelude tailored to a specific project. Lars On Tue, Jul 15, 2014 at 7:30 PM, Michael Orlitzky wrote: > On 07/14/2014 11:23 PM, Andrew Gibiansky wrote: >> Hey all, >> >> I would like to propose a very minor flag to add to GHC. I would like >> GHC to have a --with-prelude flag, which would specify an alternate >> Prelude to use instead of the default Haskell prelude. >> >> This would have an effect similar to -XNoImplicitPrelude and an additional >> >> import MyNewPrelude >> >> in the source file. It might be a /little/ different semantically, as a >> qualified import would disable the original implicit import, just like >> it does with the default Haskell prelude. >> > > To play devil's advocate, I don't think this is a good idea. It moves > information that is fundamentally local (which library imports a module > requires) into global state: magic flags that must be passed to the > build system for anything to work. > > It would be super annoying for an {IDE, coworker, ...} to have to > analyze your build system just to figure out which functions are in scope. > > We went down this road once before with -fglasgow-exts. Eventually, we > all realized it was much better to place the required extensions in > pragmas at the top of the file. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From greg at gregorycollins.net Wed Jul 16 09:49:09 2014 From: greg at gregorycollins.net (Gregory Collins) Date: Wed, 16 Jul 2014 11:49:09 +0200 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: <20140716.100415.1370696111404184357.kazu@iij.ad.jp> References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> <20140716.100415.1370696111404184357.kazu@iij.ad.jp> Message-ID: On Wed, Jul 16, 2014 at 3:04 AM, Kazu Yamamoto wrote: > I looked at your code very quickly. > What happens if you replace "replicateM" and "mapM_" to recursions? > (Especially I don't trust replicateM in IO.) > > Also, we need to confirm that atomicModifyIORef' does not really leak > space. > Those functions are only executed once on start (to fork the threads, wait for them to finish, and to update the connected clients counter respectively), they cannot account for steady-state memory increase from the client loop --- the loop just does write + read + threadDelay. G -- Gregory Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From greg at gregorycollins.net Wed Jul 16 11:00:25 2014 From: greg at gregorycollins.net (Gregory Collins) Date: Wed, 16 Jul 2014 13:00:25 +0200 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> Message-ID: On Wed, Jul 16, 2014 at 5:46 AM, Ben Bangert wrote: > I've run the new server code, indeed it initially takes less memory. > However, when I ctrl-C the testing client, it fails to properly close > sockets now, they stay open forever (the original code I posted always > closed the sockets when I killed the testing client). Did you try ctrl-c > the test client and re-running it several times? > Yes once I exhibited the leaking behaviour I stopped (and didn't implement cleanup properly). It should be ok now. I'm guessing that the recv call is blocking forever and failing somehow to > note that the socket was actually closed under it, while the hGetline I was > using properly detects this condition and closes the socket when it notices > the other side has left. > The Handle stuff will still end up calling recv() under the hood. I should note that when asking for even 1000 echo clients, the test client > as you've changed it dies when I try to launch it (it shows Clients > Connected: 0, then just exits silently). > Are you running out of FDs? > I had to use my old testing client to test the server changes you made. If > the sockets would properly close when terminating the client abruptly, then > its quite possible memory usage would remain lower as it definitely took > much much less memory for the first 2k echo clients. > I've also updated my copy of the the test code to work with the GHC 7.4.1 that's installed on my Ubuntu box at work (64-bit) --- and I *don't* see the client leak there, resident heap plateaus at around 90MB. G -- Gregory Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbrock at goula.sh Wed Jul 16 12:47:03 2014 From: mbrock at goula.sh (Mikael Brockman) Date: Wed, 16 Jul 2014 14:47:03 +0200 Subject: [Haskell-cafe] Looking for architecture/infrastructure advice on coping with thousands of concurrent clients References: Message-ID: Alois Cochard writes: > Hi Isak, > > On 9 July 2014 18:40, Isak Hansen wrote: > > #2 - I'm new to Haskell and would appreciate thoughts on how to > store and process game state. Imagine a plain application managing > 1000 tables of poker, responding to player input (that magically > appears) and timer events (e.g. folding players that fail to take > action). What data structures and libraries should I be looking at > here? Thoughts on concurrency and how I organize program flow? > > If I had to build an system like this, the main design principle I > would adopt is to not try to share the state of games among nodes, but > instead redirect players of the same game on the same node (where you > basically have a thread processing the event of the game and updating > the state in memory). > > Then I would probably use some form of event sourcing to record game > action which could be use in case of node crash to recreate a game > state by replaying events. > > The event source could then be used as well to generate stats/views in > near real-time. Some related thoughts: For poker, it seems reasonable to organize the program around a function like this: step :: Game -> Event -> (Game, Response) This would be the entry point for the game logic. It's obvious how to write tests for this function, and if you're sure that it does the right thing, then you'll be confident about your game loop. Then you need a way to produce a sequence of events, combined from different sources: timers, HTTP requests, etc. If every game is fed by a `TChan`, for example, then you can write events into that from different sources. But from the viewpoint of the core logic, this is just an abstract source of events. Given the performance of GHC's threads, I don't think thousands of concurrent clients is that much different from dozens or hundreds -- yet another reason to avoid premature optimization and focus on clarity and purity! By the way, I've had fun using `pipes`, `stm`, and `async` to implement an event sourcing server using JSON commands from web requests. Using pipe combinators and queues, the data/control flow of the server can be apparent from the code of the main function, which is something I've rarely seen in non-Haskell servers! -- Mikael Brockman From greg at gregorycollins.net Wed Jul 16 13:51:17 2014 From: greg at gregorycollins.net (Gregory Collins) Date: Wed, 16 Jul 2014 15:51:17 +0200 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> Message-ID: OK, I've done some more investigation here, as much time as I can spare for now: - I'm not sure this program really is leaking forever after all, even on latest GHC. Originally I thought it was, because I was running only 2 pings / client-second as you were. If you increase this to something like 20 pings per client-second, you see the same asymptotics at first but eventually the client plateaus, at least on my machine. I left it running for an hour. The question remains as to why this program exhibits such strange GC behavior (I don't see any reason for it to slowly gobble RAM until plateauing at an arbitrary figure), maybe Simon M can comment. - The biggest thing you're spending RAM on here is stacks for the threads you create. By default the stack chunk size is 32k, you can lower this with +RTS -kcXX --- using 2kB stacks both programs use <40MB heap resident on my machine. Counting the garbage being generated, the space needed for buffers/etc, and the fact that the binaries themselves are 8MB, I don't think 20kB per active client is unreasonable. - You can reduce GC pressure somewhat by reusing the output buffer, the "io-streams" branch at my copy of your test repo does this. G On Wed, Jul 16, 2014 at 1:00 PM, Gregory Collins wrote: > > On Wed, Jul 16, 2014 at 5:46 AM, Ben Bangert wrote: > >> I've run the new server code, indeed it initially takes less memory. >> However, when I ctrl-C the testing client, it fails to properly close >> sockets now, they stay open forever (the original code I posted always >> closed the sockets when I killed the testing client). Did you try ctrl-c >> the test client and re-running it several times? >> > > Yes once I exhibited the leaking behaviour I stopped (and didn't implement > cleanup properly). It should be ok now. > > > I'm guessing that the recv call is blocking forever and failing somehow >> to note that the socket was actually closed under it, while the hGetline I >> was using properly detects this condition and closes the socket when it >> notices the other side has left. >> > > The Handle stuff will still end up calling recv() under the hood. > > > I should note that when asking for even 1000 echo clients, the test >> client as you've changed it dies when I try to launch it (it shows Clients >> Connected: 0, then just exits silently). >> > > Are you running out of FDs? > > > >> I had to use my old testing client to test the server changes you made. >> If the sockets would properly close when terminating the client abruptly, >> then its quite possible memory usage would remain lower as it definitely >> took much much less memory for the first 2k echo clients. >> > > I've also updated my copy of the the test code to work with the GHC 7.4.1 > that's installed on my Ubuntu box at work (64-bit) --- and I *don't* see > the client leak there, resident heap plateaus at around 90MB. > > G > -- > Gregory Collins > -- Gregory Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From chowells79 at gmail.com Wed Jul 16 14:51:50 2014 From: chowells79 at gmail.com (Carl Howells) Date: Wed, 16 Jul 2014 08:51:50 -0600 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <53C56548.1040106@orlitzky.com> Message-ID: If you want a prelude tailored to a specific project, you don't need this extension at all. Just create a module named Prelude in your project. Actually, given that, I'm not sure what the actual value of this flag would be. What does it add over just putting a Prelude module in your project? I guess it would work better for the case when you want a pre-packaged Prelude replacement, instead of a custom one. But in that case, be very sure this flag supports loading the Prelude module from an installed package, instead of from source. On Wed, Jul 16, 2014 at 3:46 AM, L Corbijn wrote: > Another problem with making it (cabal) global is that you have to > separate the alternative Prelude (and the modules it depends on) from > the rest of the modules. Otherwise you would have an circular > dependency by importing the new Prelude in the new Prelude you are > defining. > > For project specific preludes I can think of two options. Separate > into a package/library, which will probably be more trouble than it > would solve in the first place. Alternatively there could be a > mechanism for excluding the automatic new Prelude import, which would > make things only more complicated. Either way it seems that it would > make things only more difficult if you want a prelude tailored to a > specific project. > > Lars > > On Tue, Jul 15, 2014 at 7:30 PM, Michael Orlitzky wrote: >> On 07/14/2014 11:23 PM, Andrew Gibiansky wrote: >>> Hey all, >>> >>> I would like to propose a very minor flag to add to GHC. I would like >>> GHC to have a --with-prelude flag, which would specify an alternate >>> Prelude to use instead of the default Haskell prelude. >>> >>> This would have an effect similar to -XNoImplicitPrelude and an additional >>> >>> import MyNewPrelude >>> >>> in the source file. It might be a /little/ different semantically, as a >>> qualified import would disable the original implicit import, just like >>> it does with the default Haskell prelude. >>> >> >> To play devil's advocate, I don't think this is a good idea. It moves >> information that is fundamentally local (which library imports a module >> requires) into global state: magic flags that must be passed to the >> build system for anything to work. >> >> It would be super annoying for an {IDE, coworker, ...} to have to >> analyze your build system just to figure out which functions are in scope. >> >> We went down this road once before with -fglasgow-exts. Eventually, we >> all realized it was much better to place the required extensions in >> pragmas at the top of the file. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From palotai.robin at gmail.com Wed Jul 16 15:18:25 2014 From: palotai.robin at gmail.com (Robin Palotai) Date: Wed, 16 Jul 2014 17:18:25 +0200 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <53C56548.1040106@orlitzky.com> Message-ID: I worked a bit (not too much to this point) with adding toolage, and I have to say I agree with those above who say that things should be explicit if possible, since every special case makes the entry barrier of new tools a little bit higher. The more uniform we can go with features the better. 2014-07-16 16:51 GMT+02:00 Carl Howells : > If you want a prelude tailored to a specific project, you don't need > this extension at all. Just create a module named Prelude in your > project. > > Actually, given that, I'm not sure what the actual value of this flag > would be. What does it add over just putting a Prelude module in your > project? I guess it would work better for the case when you want a > pre-packaged Prelude replacement, instead of a custom one. But in > that case, be very sure this flag supports loading the Prelude module > from an installed package, instead of from source. > > On Wed, Jul 16, 2014 at 3:46 AM, L Corbijn > wrote: > > Another problem with making it (cabal) global is that you have to > > separate the alternative Prelude (and the modules it depends on) from > > the rest of the modules. Otherwise you would have an circular > > dependency by importing the new Prelude in the new Prelude you are > > defining. > > > > For project specific preludes I can think of two options. Separate > > into a package/library, which will probably be more trouble than it > > would solve in the first place. Alternatively there could be a > > mechanism for excluding the automatic new Prelude import, which would > > make things only more complicated. Either way it seems that it would > > make things only more difficult if you want a prelude tailored to a > > specific project. > > > > Lars > > > > On Tue, Jul 15, 2014 at 7:30 PM, Michael Orlitzky > wrote: > >> On 07/14/2014 11:23 PM, Andrew Gibiansky wrote: > >>> Hey all, > >>> > >>> I would like to propose a very minor flag to add to GHC. I would like > >>> GHC to have a --with-prelude flag, which would specify an alternate > >>> Prelude to use instead of the default Haskell prelude. > >>> > >>> This would have an effect similar to -XNoImplicitPrelude and an > additional > >>> > >>> import MyNewPrelude > >>> > >>> in the source file. It might be a /little/ different semantically, as a > >>> qualified import would disable the original implicit import, just like > >>> it does with the default Haskell prelude. > >>> > >> > >> To play devil's advocate, I don't think this is a good idea. It moves > >> information that is fundamentally local (which library imports a module > >> requires) into global state: magic flags that must be passed to the > >> build system for anything to work. > >> > >> It would be super annoying for an {IDE, coworker, ...} to have to > >> analyze your build system just to figure out which functions are in > scope. > >> > >> We went down this road once before with -fglasgow-exts. Eventually, we > >> all realized it was much better to place the required extensions in > >> pragmas at the top of the file. > >> > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Wed Jul 16 15:25:23 2014 From: vogt.adam at gmail.com (adam vogt) Date: Wed, 16 Jul 2014 11:25:23 -0400 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <53C56548.1040106@orlitzky.com> Message-ID: On Wed, Jul 16, 2014 at 10:51 AM, Carl Howells wrote: > If you want a prelude tailored to a specific project, you don't need > this extension at all. Just create a module named Prelude in your > project. Do you know how to load a project like that in ghci? With cabal repl I get the following error: Top level: attempting to use module ?Prelude? (src/Prelude.hs) which is not loaded https://github.com/aavogt/preludeFlag is what I tried Regards, Adam From ben at groovie.org Wed Jul 16 15:28:42 2014 From: ben at groovie.org (Ben Bangert) Date: Wed, 16 Jul 2014 08:28:42 -0700 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> Message-ID: <25F8D74B-24E3-4B4B-875A-2A584F0A084F@groovie.org> On Jul 16, 2014, at 6:51 AM, Gregory Collins wrote: > OK, I've done some more investigation here, as much time as I can spare for now: > ? I'm not sure this program really is leaking forever after all, even on latest GHC. Originally I thought it was, because I was running only 2 pings / client-second as you were. If you increase this to something like 20 pings per client-second, you see the same asymptotics at first but eventually the client plateaus, at least on my machine. I left it running for an hour. The question remains as to why this program exhibits such strange GC behavior (I don't see any reason for it to slowly gobble RAM until plateauing at an arbitrary figure), maybe Simon M can comment. Yes, with the changes I don't see leaking behavior. As I mentioned in a separate email though, this isn't very useful because the various network libraries in the wild (Warp, Yesod, Websockets, etc) all use ByteStrings for reading frames, etc. on the way to/from the socket. These seem to cause memory fragmentation and issues reclaiming memory, which is the real issue I'm seeing. Your test has removed the usage of several components that were most likely part of the problem I've had, but which I can't really remove from the fully functioning application as it would require rewriting libraries all the way down the stack. > ? The biggest thing you're spending RAM on here is stacks for the threads you create. By default the stack chunk size is 32k, you can lower this with +RTS -kcXX --- using 2kB stacks both programs use <40MB heap resident on my machine. Counting the garbage being generated, the space needed for buffers/etc, and the fact that the binaries themselves are 8MB, I don't think 20kB per active client is unreasonable. > ? You can reduce GC pressure somewhat by reusing the output buffer, the "io-streams" branch at my copy of your test repo does this. Besides for not closing the sockets, your master branch had excellent memory usage. I unfortunately wasn't able to try your io-streams branch as I got this compile error: https://gist.github.com/bbangert/d26f28b410faaad4e8d2 I'll put together a minimal websocket server that better demonstrates the memory fragmentation issues today. Cheers, Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From greg at gregorycollins.net Wed Jul 16 15:48:58 2014 From: greg at gregorycollins.net (Gregory Collins) Date: Wed, 16 Jul 2014 17:48:58 +0200 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: <25F8D74B-24E3-4B4B-875A-2A584F0A084F@groovie.org> References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> <25F8D74B-24E3-4B4B-875A-2A584F0A084F@groovie.org> Message-ID: On Wed, Jul 16, 2014 at 5:28 PM, Ben Bangert wrote: > > Yes, with the changes I don't see leaking behavior. As I mentioned in a > separate email though, this isn't very useful because the various network > libraries in the wild (Warp, Yesod, Websockets, etc) all use ByteStrings > for reading frames, etc. on the way to/from the socket. These seem to cause > memory fragmentation and issues reclaiming memory, which is the real issue > I'm seeing. > OK good, that is a data point. BTW the master branch of my version of this test is still using bytestrings -- the main things that I replaced were the use of Handle from the high-level "Network" module and the use of async to run the threads --- not because I thought there was a problem with async but simply to rule out potentially confounding factors. Your issue may not be with bytestring fragmentation but that is one of the working hypothesis and now we are closer to discovering the issue. Personally I am suspicious that network's Handle API (which, by the way, there is almost no reason to use --- libraries like io-streams, pipes, and conduit provide a better user experience) might be the thing that is leaking RAM. (+johan) If the issue is GHC pinned heap fragmentation then you can try generating bytestrings with system malloc instead (which is what we are currently doing for network reads in io-streams and also IIRC what warp is doing). If doing that and linking your binary with e.g. tcmalloc fixes the issue, then I think that would probably be conclusive evidence. Your test has removed the usage of several components that were most likely > part of the problem I've had, but which I can't really remove from the > fully functioning application as it would require rewriting libraries all > the way down the stack. > Of course, but we are trying to find the leak here. Now we can re-add things to the test, starting with going back to Handle. > ? The biggest thing you're spending RAM on here is stacks for the > threads you create. By default the stack chunk size is 32k, you can lower > this with +RTS -kcXX --- using 2kB stacks both programs use <40MB heap BTW I lied about this, that parameter controls how much stacks grow if they overflow, the default stack size for threads is 1kB. Besides for not closing the sockets, your master branch had excellent > memory usage. I unfortunately wasn't able to try your io-streams branch as > I got this compile error: > https://gist.github.com/bbangert/d26f28b410faaad4e8d2 This thread is just full of fun, isn't it. G -- Gregory Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Wed Jul 16 16:58:50 2014 From: mail at joachim-breitner.de (Joachim Breitner) Date: Wed, 16 Jul 2014 18:58:50 +0200 Subject: [Haskell-cafe] Feature Proposal: GHC Flag for implicit external Prelude In-Reply-To: References: <53C56548.1040106@orlitzky.com> Message-ID: <1405529930.31494.1.camel@kirk> Hi, Am Mittwoch, den 16.07.2014, 11:25 -0400 schrieb adam vogt: > On Wed, Jul 16, 2014 at 10:51 AM, Carl Howells wrote: > > If you want a prelude tailored to a specific project, you don't need > > this extension at all. Just create a module named Prelude in your > > project. > > Do you know how to load a project like that in ghci? With cabal repl I > get the following error: > > Top level: > attempting to use module ?Prelude? (src/Prelude.hs) which is not loaded > > https://github.com/aavogt/preludeFlag is what I tried That might well be a bug in GHC. Try to reproduce it without cabal (i.e. find out what options "cabal repl" passes to GHC) and report it at http://hackage.haskell.org/trac/ghc/ticket/ Greetings, Joachim -- Joachim ?nomeata? Breitner mail at joachim-breitner.de ? http://www.joachim-breitner.de/ Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From gbwey9 at gmail.com Thu Jul 17 01:40:09 2014 From: gbwey9 at gmail.com (gbwey9) Date: Wed, 16 Jul 2014 21:40:09 -0400 Subject: [Haskell-cafe] help with multiparam type class Message-ID: Hi, Given any Event constructor, the 'conv' method passes in the field name to 'val' for each field. There is a Z instance for each Event arity. The call "conv E1::E1" works but requires that I explicitly specify the type. Is there any way to avoid that having to do that? For some reason 'conv' does not have enough information to know the type. Is there a way to do this with functional dependencies or type classes or something else? Here is the paste http://lpaste.net/107632 and here is the error: *Main> conv E1 :3:1: No instance for (Z e0 (String -> E1)) arising from a use of `conv' The type variable `e0' is ambiguous Possible fix: add a type signature that fixes these type variable(s) Note: there are several potential instances: instance (Event e, Field a) => Z e (a -> e) -- Defined at testfamily.hs:28:10 instance Event e => Z e e -- Defined at testfamily.hs:20:10 Possible fix: add an instance declaration for (Z e0 (String -> E1)) In the expression: conv E1 In an equation for `it': it = conv E1 Thanks for any help, Grant -------------- next part -------------- An HTML attachment was scrubbed... URL: From leza.ml at fecrd.cujae.edu.cu Thu Jul 17 02:32:27 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Wed, 16 Jul 2014 22:32:27 -0400 Subject: [Haskell-cafe] Problems with type family in a class Message-ID: <53C735BB.6040807@fecrd.cujae.edu.cu> Hi, Consider the following type classes: class (Signal sx) => Complexable sx where type ComplexSignalType .... class (Complexable sx) => FourierTransformable sx where fft :: (cx ~ ComplexSignalType sx) => cx -> cx .... and an instance: instance (RealFloat e) => Complexable [e] where type ComplexSignalType = [Complex e] instance (RealFloat e) => FourierTransformable [e] where fft = ... Why this example will give errors: *DSP.Signals.Core Prelude Data.Complex> :t ax ax :: [Complex Double] *DSP.Signals.Core Prelude Data.Complex> fft ax :90:1: No instance for (FourierTransformable s0 [Complex Double]) arising from a use of ?fft? The type variable ?s0? is ambiguous Note: there is a potential instance available: instance [overlap ok] (RealFloat e, Math.FFT.Base.FFTWReal e) => FourierTransformable [e] [Complex e] -- Defined at src/DSP/Signals/Instances/List.hs:40:10 In the expression: fft ax In an equation for ?it?: it = fft ax Thanks! -- Lemol-C 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From dstcruz at gmail.com Thu Jul 17 03:30:06 2014 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 16 Jul 2014 23:30:06 -0400 Subject: [Haskell-cafe] Haskell Weekly News: Issue 299 Message-ID: Welcome to issue 299 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from June 29 to July 12, 2014 Quotes of the Week * donri: maybe good thing Applicative isn't called StrongLaxSemimonoidalEndofunctor * ninja_code: haskell is used to debug thinking * johnw: the first rule of category theory club is to state your identity Top Reddit Stories * The new haskell.org design Domain: new-www.haskell.org, Score: 130, Comments: 95 Original: [1] http://new-www.haskell.org/ On Reddit: [2] http://goo.gl/qG7683 * GHC-7.8.3 is out! Domain: haskell.org, Score: 115, Comments: 40 Original: [3] http://goo.gl/fyHQZd On Reddit: [4] http://goo.gl/7bsDXj * Announcing rest - A Haskell REST framework Domain: engineering.silk.co, Score: 97, Comments: 41 Original: [5] http://goo.gl/F3W628 On Reddit: [6] http://goo.gl/VqWdi9 * GHC plans for 7.10.1 Domain: ghc.haskell.org, Score: 77, Comments: 54 Original: [7] http://goo.gl/YH6516 On Reddit: [8] http://goo.gl/g16PE3 * unagi-chan: Fast and scalable concurrent queues for x86, with a Chan-like API Domain: hackage.haskell.org, Score: 61, Comments: 17 Original: [9] http://goo.gl/7dE0e4 On Reddit: [10] http://goo.gl/zaMC6o * Come practice Haskell *and* make a difference in the world by helping us build a new Free/Libre/Open patronage economy Domain: snowdrift.coop, Score: 59, Comments: 19 Original: [11] http://goo.gl/vU2cx On Reddit: [12] http://goo.gl/PRkG3B * What's wrong with String Domain: haskell.org, Score: 55, Comments: 123 Original: [13] http://goo.gl/8etnBS On Reddit: [14] http://goo.gl/k2FZ9u * Why is package management so awful? Domain: self.haskell, Score: 55, Comments: 100 Original: [15] http://goo.gl/7h7cWn On Reddit: [16] http://goo.gl/7h7cWn * Re?ection without Remorse: Revealing a hidden sequence to speed up monadic re?ection [pdf] Domain: homepages.cwi.nl, Score: 49, Comments: 36 Original: [17] http://goo.gl/QgiwtW On Reddit: [18] http://goo.gl/BpYmcS * Mutable Algorithms in Immutable Languages, Part 1 Domain: tel.github.io, Score: 49, Comments: 27 Original: [19] http://goo.gl/hn6218 On Reddit: [20] http://goo.gl/apKO9f * Where is Haskell going in industry? Domain: self.haskell, Score: 47, Comments: 114 Original: [21] http://goo.gl/Io2hvy On Reddit: [22] http://goo.gl/Io2hvy * Why Dependently Typed Programming Will (One Day) Rock Your World Domain: ejenk.com, Score: 45, Comments: 154 Original: [23] http://goo.gl/d3zkiG On Reddit: [24] http://goo.gl/z3ZhDf * Using Phantom Types for Extra Safety Domain: blog.jakubarnold.cz, Score: 41, Comments: 19 Original: [25] http://goo.gl/WnZH0Z On Reddit: [26] http://goo.gl/EJTpxl * Designing Dependently Typed Languages - OPLSS '14 Domain: self.haskell, Score: 37, Comments: 11 Original: [27] http://goo.gl/P2mV1A On Reddit: [28] http://goo.gl/P2mV1A * Hackage update, part 3 Domain: lambda.xyz, Score: 37, Comments: 13 Original: [29] http://goo.gl/sLHVfX On Reddit: [30] http://goo.gl/G7dHLc * Announce: The most complete prelude formed from only the "base" package Domain: hackage.haskell.org, Score: 37, Comments: 55 Original: [31] http://goo.gl/lSoKVh On Reddit: [32] http://goo.gl/UeNUYL * New generic programming library (with paper accepted in WGP 2014) Domain: andres-loeh.de, Score: 34, Comments: 11 Original: [33] http://goo.gl/PgV7yV On Reddit: [34] http://goo.gl/qFOlLB * Ideal programming language for a new modern OS built from scratch? Domain: self.haskell, Score: 32, Comments: 63 Original: [35] http://goo.gl/eTkOFd On Reddit: [36] http://goo.gl/eTkOFd * Neil Mitchell's Haskell Blog: Optimisation with Continuations Domain: neilmitchell.blogspot.com.es, Score: 30, Comments: 15 Original: [37] http://goo.gl/lvo8Oa On Reddit: [38] http://goo.gl/haJyX4 * can we do better than cabal sandbox? Domain: self.haskell, Score: 30, Comments: 38 Original: [39] http://goo.gl/RS3j0s On Reddit: [40] http://goo.gl/RS3j0s Top StackOverflow Questions * Is there a monad that doesn't have a corresponding monad transformer (except IO)? votes: 37, answers: 1 Read on SO: [41] http://goo.gl/wBH70C * Arrows are exactly equivalent to applicative functors? votes: 21, answers: 3 Read on SO: [42] http://goo.gl/WRjQx0 * Why does GHC typecheck before desugaring? votes: 19, answers: 1 Read on SO: [43] http://goo.gl/EzaZVr * List of Functors votes: 15, answers: 3 Read on SO: [44] http://goo.gl/RmJvDC * Or-patterns in Haskell votes: 13, answers: 2 Read on SO: [45] http://goo.gl/ukvJm1 * What does this list permutations implementation in Haskell exactly do? votes: 12, answers: 2 Read on SO: [46] http://goo.gl/CXOCch * Should Latitude, Longitude and Elevation have their own type in Haskell? votes: 12, answers: 2 Read on SO: [47] http://goo.gl/fkElae * Haskell List Comprehension Speed Inconsistencies votes: 12, answers: 1 Read on SO: [48] http://goo.gl/0o4rwI * What are some examples of type-level programming? [closed] votes: 11, answers: 3 Read on SO: [49] http://goo.gl/fowZ6b * QuickCheck Gen is not a monad votes: 11, answers: 1 Read on SO: [50] http://goo.gl/hiJ0q8 Until next time, [51]+Daniel Santa Cruz References 1. http://new-www.haskell.org/ 2. http://www.reddit.com/r/haskell/comments/2a77f2/the_new_haskellorg_design/ 3. http://www.haskell.org/ghc/docs/7.8.3/html/users_guide/release-7-8-3.html 4. http://www.reddit.com/r/haskell/comments/2af4jf/ghc783_is_out/ 5. http://engineering.silk.co/post/90354057868/announcing-rest-a-haskell-rest-framework 6. http://www.reddit.com/r/haskell/comments/29h32i/announcing_rest_a_haskell_rest_framework/ 7. https://ghc.haskell.org/trac/ghc/wiki/Status/GHC-7.10.1 8. http://www.reddit.com/r/haskell/comments/29v4lj/ghc_plans_for_7101/ 9. http://hackage.haskell.org/package/unagi-chan-0.1.0.1 10. http://www.reddit.com/r/haskell/comments/2adh2f/unagichan_fast_and_scalable_concurrent_queues_for/ 11. https://snowdrift.coop/ 12. http://www.reddit.com/r/haskell/comments/29zw5j/come_practice_haskell_and_make_a_difference_in/ 13. http://www.haskell.org/pipermail/haskell-cafe/2014-June/114745.html 14. http://www.reddit.com/r/haskell/comments/29jw0s/whats_wrong_with_string/ 15. http://www.reddit.com/r/haskell/comments/2a9n0t/why_is_package_management_so_awful/ 16. http://www.reddit.com/r/haskell/comments/2a9n0t/why_is_package_management_so_awful/ 17. http://homepages.cwi.nl/~ploeg/papers/zseq.pdf 18. http://www.reddit.com/r/haskell/comments/29i94o/re%EF%ACection_without_remorse_revealing_a_hidden/ 19. http://tel.github.io/2014/07/12/mutable_algorithms_in_immutable_languges_part_1/ 20. http://www.reddit.com/r/haskell/comments/2ahorr/mutable_algorithms_in_immutable_languages_part_1/ 21. http://www.reddit.com/r/haskell/comments/2a310v/where_is_haskell_going_in_industry/ 22. http://www.reddit.com/r/haskell/comments/2a310v/where_is_haskell_going_in_industry/ 23. http://ejenk.com/blog/why-dependently-typed-programming-will-one-day-rock-your-world.html 24. http://www.reddit.com/r/haskell/comments/29kv2y/why_dependently_typed_programming_will_one_day/ 25. http://blog.jakubarnold.cz/2014/07/08/using-phantom-types-for-extra-safety.html 26. http://www.reddit.com/r/haskell/comments/2a5duv/using_phantom_types_for_extra_safety/ 27. http://www.reddit.com/r/haskell/comments/2a115h/designing_dependently_typed_languages_oplss_14/ 28. http://www.reddit.com/r/haskell/comments/2a115h/designing_dependently_typed_languages_oplss_14/ 29. http://lambda.xyz/blog/hackage-part-3/ 30. http://www.reddit.com/r/haskell/comments/2abi06/hackage_update_part_3/ 31. http://hackage.haskell.org/package/base-prelude 32. http://www.reddit.com/r/haskell/comments/2ahq11/announce_the_most_complete_prelude_formed_from/ 33. http://www.andres-loeh.de/TrueSumsOfProducts/ 34. http://www.reddit.com/r/haskell/comments/2a535x/new_generic_programming_library_with_paper/ 35. http://www.reddit.com/r/haskell/comments/29tgjd/ideal_programming_language_for_a_new_modern_os/ 36. http://www.reddit.com/r/haskell/comments/29tgjd/ideal_programming_language_for_a_new_modern_os/ 37. http://neilmitchell.blogspot.com.es/2014/06/optimisation-with-continuations.html 38. http://www.reddit.com/r/haskell/comments/29fjg4/neil_mitchells_haskell_blog_optimisation_with/ 39. http://www.reddit.com/r/haskell/comments/2a2ec7/can_we_do_better_than_cabal_sandbox/ 40. http://www.reddit.com/r/haskell/comments/2a2ec7/can_we_do_better_than_cabal_sandbox/ 41. http://stackoverflow.com/questions/24515876/is-there-a-monad-that-doesnt-have-a-corresponding-monad-transformer-except-io 42. http://stackoverflow.com/questions/24668313/arrows-are-exactly-equivalent-to-applicative-functors 43. http://stackoverflow.com/questions/24639279/why-does-ghc-typecheck-before-desugaring 44. http://stackoverflow.com/questions/24589995/list-of-functors 45. http://stackoverflow.com/questions/24700762/or-patterns-in-haskell 46. http://stackoverflow.com/questions/24484348/what-does-this-list-permutations-implementation-in-haskell-exactly-do 47. http://stackoverflow.com/questions/24521976/should-latitude-longitude-and-elevation-have-their-own-type-in-haskell 48. http://stackoverflow.com/questions/24690406/haskell-list-comprehension-speed-inconsistencies 49. http://stackoverflow.com/questions/24481113/what-are-some-examples-of-type-level-programming 50. http://stackoverflow.com/questions/24481648/quickcheck-gen-is-not-a-monad 51. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at nand.wakku.to Thu Jul 17 06:32:36 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Thu, 17 Jul 2014 08:32:36 +0200 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: <53C735BB.6040807@fecrd.cujae.edu.cu> References: <53C735BB.6040807@fecrd.cujae.edu.cu> Message-ID: <20140717083236.GB20051@nanodesu.localdomain> On Wed, 16 Jul 2014 22:32:27 -0400, Leza Morais Lutonda wrote: > > Hi, > > Consider the following type classes: > > class (Signal sx) => Complexable sx where > type ComplexSignalType > .... > > class (Complexable sx) => FourierTransformable sx where > fft :: (cx ~ ComplexSignalType sx) => cx -> cx > .... > > and an instance: > > instance (RealFloat e) => Complexable [e] where > type ComplexSignalType = [Complex e] > > instance (RealFloat e) => FourierTransformable [e] where > fft = ... > > Why this example will give errors: > > *DSP.Signals.Core Prelude Data.Complex> :t ax > ax :: [Complex Double] > *DSP.Signals.Core Prelude Data.Complex> fft ax > > :90:1: > No instance for (FourierTransformable s0 [Complex Double]) > arising from a use of ?fft? > The type variable ?s0? is ambiguous > Note: there is a potential instance available: > instance [overlap ok] (RealFloat e, Math.FFT.Base.FFTWReal e) => > FourierTransformable [e] [Complex e] > -- Defined at src/DSP/Signals/Instances/List.hs:40:10 > In the expression: fft ax > In an equation for ?it?: it = fft ax > > > Thanks! The reason you're getting this error is because all you know about your instance is that the type of fft is :: [Complex Double] -> [Complex Double]. Since by definition this [Complex Double] is ComplexSignalType sx, all we know about the associated instance (parametrized by sx) is that ComplexSignalType sx ~ [Complex Double]. Since ComplexSignalType is a type family, it's not injective, so this does not suffice to uniquely identify our actual instance (sx, here called s0 by GHC). For example, we could have a second instance: instance Complexable () where type ComplexSignalType () = [Complex Double] instance FourierTransformable () where fft = error "oops" And with this instance, fft would also be [Complex Double] -> [Complex Double] but the behavior of would clearly be different to your actually intended function. If you think your signal function is bijective, you could use a two-way functional dependency like this: class Complexable sx cx | sx -> cx, cx -> sx class Complexable sx cx => FourierTransformable sx cx where fft :: cx -> cx Or if you want to avoid the overhead of redesigning Complexable you could even do something like this: class (cx ~ ComplexSignalType sx, Complexable sx) => FourierTransformable sx cx | cx -> sx where fft :: cx -> cx Either way, if instance selection should be possible based solely on the type of ?cx?, then ?cx? must imply everything contained in the instance head. From marat61 at gmail.com Thu Jul 17 09:35:58 2014 From: marat61 at gmail.com (=?UTF-8?B?0JfQsNC60LjRgNC+0LIg0JzQsNGA0LDRgg==?=) Date: Thu, 17 Jul 2014 13:35:58 +0400 Subject: [Haskell-cafe] Q about last&init Message-ID: I am teaching myself haskell. The first impression is very good. But phrase "haskell is polynomially reducible" is making me sad :(. Anyway I am trying to backport my algorithm written in C. The key to performance is to have ability to remove element from the end of a list in O(1). But the original haskell functions last and init are O(n). My questions are: 1) Is last function is something like "black box" written in C++ which perform O(1)? So I shouldn't even try to imagine some haskell O(1) equivalent. 2) Or will optimizer (llvm?) reduce init&last complexity to 1? 3) Some people suggest to use sequences package, but still how do they implement O(1) init&last sequences equivalent in haskell? -- Regards, Marat. From raabe at froglogic.com Thu Jul 17 09:39:32 2014 From: raabe at froglogic.com (Frerich Raabe) Date: Thu, 17 Jul 2014 11:39:32 +0200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: On 2014-07-17 11:35, ??????? ????? wrote: > I am teaching myself haskell. The first impression is very good. > But phrase "haskell is polynomially reducible" is making me sad :(. > Anyway I am trying to backport my algorithm written in C. The key to > performance is to have ability to remove element from the end of a > list in O(1). > But the original haskell functions last and init are O(n). On viable option might be to adjust the algorithm such that instead of appending to the list, it prepends (which is O(1) in Haskell), i.e. you manage the list in reverse and only actually reverse it to the original order when needed (e.g. when printing). -- Frerich Raabe - raabe at froglogic.com www.froglogic.com - Multi-Platform GUI Testing From marat61 at gmail.com Thu Jul 17 09:47:20 2014 From: marat61 at gmail.com (=?UTF-8?B?0JfQsNC60LjRgNC+0LIg0JzQsNGA0LDRgg==?=) Date: Thu, 17 Jul 2014 13:47:20 +0400 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: Thanks, but maybe I badly formulated my question. I'd like to insert at the beginning of the list and remove from the tail both in O(1). 2014-07-17 13:39 GMT+04:00 Frerich Raabe : > On 2014-07-17 11:35, ??????? ????? wrote: >> >> I am teaching myself haskell. The first impression is very good. >> But phrase "haskell is polynomially reducible" is making me sad :(. >> Anyway I am trying to backport my algorithm written in C. The key to >> performance is to have ability to remove element from the end of a >> list in O(1). >> But the original haskell functions last and init are O(n). > > > On viable option might be to adjust the algorithm such that instead of > appending to the list, it prepends (which is O(1) in Haskell), i.e. > you manage the list in reverse and only actually reverse it to the > original order when needed (e.g. when printing). > > -- > Frerich Raabe - raabe at froglogic.com > www.froglogic.com - Multi-Platform GUI Testing > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Marat. ? ????????? ?????. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jul 17 09:47:27 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 17 Jul 2014 10:47:27 +0100 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: <20140717094727.GG3378@henry> On Thu, Jul 17, 2014 at 01:35:58PM +0400, ??????? ????? wrote: > I am teaching myself haskell. The first impression is very good. > But phrase "haskell is polynomially reducible" is making me sad :(. > Anyway I am trying to backport my algorithm written in C. The key to > performance is to have ability to remove element from the end of a > list in O(1). > But the original haskell functions last and init are O(n). > My questions are: > 1) Is last function is something like "black box" written in C++ which > perform O(1)? > So I shouldn't even try to imagine some haskell O(1) equivalent. > 2) Or will optimizer (llvm?) reduce init&last complexity to 1? > 3) Some people suggest to use sequences package, but still how do they > implement O(1) init&last sequences equivalent in haskell? I'm rather confused about your question. If you want a Haskell data structure that supports O(1) head, tail, init and last why not indeed use Data.Sequence as has been suggested? As for how it's implemented, it uses the (very cool) fingertree datastructure. See here for more details: http://hackage.haskell.org/package/containers-0.2.0.1/docs/Data-Sequence.html Tom From raabe at froglogic.com Thu Jul 17 09:55:31 2014 From: raabe at froglogic.com (Frerich Raabe) Date: Thu, 17 Jul 2014 11:55:31 +0200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> On 2014-07-17 11:47, ??????? ????? wrote: > Thanks, but maybe I badly formulated my question. I'd like to insert > at the beginning of the list and remove from the tail both in O(1). ...then you might find DList interesting, see http://hackage.haskell.org/package/dlist-0.5/docs/Data-DList.html -- Frerich Raabe - raabe at froglogic.com www.froglogic.com - Multi-Platform GUI Testing From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jul 17 10:02:51 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 17 Jul 2014 11:02:51 +0100 Subject: [Haskell-cafe] Q about last&init In-Reply-To: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> Message-ID: <20140717100251.GH3378@henry> On Thu, Jul 17, 2014 at 11:55:31AM +0200, Frerich Raabe wrote: > On 2014-07-17 11:47, ??????? ????? wrote: > >Thanks, but maybe I badly formulated my question. I'd like to insert > >at the beginning of the list and remove from the tail both in O(1). > > ...then you might find DList interesting, see > > http://hackage.haskell.org/package/dlist-0.5/docs/Data-DList.html How does DList support O(1) removal from the tail? From raabe at froglogic.com Thu Jul 17 10:07:43 2014 From: raabe at froglogic.com (Frerich Raabe) Date: Thu, 17 Jul 2014 12:07:43 +0200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: <20140717100251.GH3378@henry> References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> <20140717100251.GH3378@henry> Message-ID: On 2014-07-17 12:02, Tom Ellis wrote: > On Thu, Jul 17, 2014 at 11:55:31AM +0200, Frerich Raabe wrote: >> On 2014-07-17 11:47, ??????? ????? wrote: >> >Thanks, but maybe I badly formulated my question. I'd like to insert >> >at the beginning of the list and remove from the tail both in O(1). >> >> ...then you might find DList interesting, see >> >> http://hackage.haskell.org/package/dlist-0.5/docs/Data-DList.html > > How does DList support O(1) removal from the tail? Oops, sorry, it doesn't. I misread the mail. -- Frerich Raabe - raabe at froglogic.com www.froglogic.com - Multi-Platform GUI Testing From marat61 at gmail.com Thu Jul 17 11:34:17 2014 From: marat61 at gmail.com (=?UTF-8?B?0JfQsNC60LjRgNC+0LIg0JzQsNGA0LDRgg==?=) Date: Thu, 17 Jul 2014 15:34:17 +0400 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> <20140717100251.GH3378@henry> Message-ID: Question to all, Tom said that finger tree gives us O(1) on removing last element, but in haskell all data is persistent. So function should return list as is minus last element. How it could be O(1)? This is just blows my mind... My hypothesis is that somehow compiler reduces creating of a new list to just adding or removing one element. If it is not so. Then even ':' which is just adding to list head would be an O(n) operation just because it should return brand new list with one elem added. Or maybe functional approach uses pretty much different complexity metric, there copying of some structure "list" for example is just O(1)? If so then Q about compiler is still exists. 2014-07-17 14:07 GMT+04:00 Frerich Raabe : > On 2014-07-17 12:02, Tom Ellis wrote: >> >> On Thu, Jul 17, 2014 at 11:55:31AM +0200, Frerich Raabe wrote: >>> >>> On 2014-07-17 11:47, ??????? ????? wrote: >>> >Thanks, but maybe I badly formulated my question. I'd like to insert >>> >at the beginning of the list and remove from the tail both in O(1). >>> >>> ...then you might find DList interesting, see >>> >>> http://hackage.haskell.org/package/dlist-0.5/docs/Data-DList.html >> >> >> How does DList support O(1) removal from the tail? > > > Oops, sorry, it doesn't. I misread the mail. > > > -- > Frerich Raabe - raabe at froglogic.com > www.froglogic.com - Multi-Platform GUI Testing > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Marat. ? ????????? ?????. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jul 17 11:43:40 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 17 Jul 2014 12:43:40 +0100 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> <20140717100251.GH3378@henry> Message-ID: <20140717114340.GJ3378@henry> On Thu, Jul 17, 2014 at 03:34:17PM +0400, ??????? ????? wrote: > Tom said that finger tree gives us O(1) on removing last element, but > in haskell all data is persistent. > So function should return list as is minus last element. How it could > be O(1)? This is just blows my mind... Sounds like magic doesn't it :) > My hypothesis is that somehow compiler reduces creating of a new list > to just adding or removing one element. If it is not so. > Then even ':' which is just adding to list head would be an O(n) > operation just because it should return brand new list with one elem > added. Or maybe functional approach uses pretty much different > complexity metric, there copying of some structure "list" for example > is just O(1)? If so then Q about compiler is still exists. But no, there's no compiler magic, just an amazing datastructure. The caveat is that the complexity is amortised, not guaranteed for every operation. Have a look at the paper if you learn about how it works. It's linked from the Hackage docs. http://hackage.haskell.org/package/containers-0.2.0.1/docs/Data-Sequence.html Tom From chriswarbo at googlemail.com Thu Jul 17 12:23:13 2014 From: chriswarbo at googlemail.com (Chris Warburton) Date: Thu, 17 Jul 2014 13:23:13 +0100 Subject: [Haskell-cafe] Q about last&init In-Reply-To: (=?utf-8?B?ItCX0LDQutC40YDQvtCyINCc0LDRgNCw0YIiJ3M=?= message of "Thu, 17 Jul 2014 15:34:17 +0400") References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> <20140717100251.GH3378@henry> Message-ID: <86bnsofa32.fsf@gmail.com> ??????? ????? writes: > My hypothesis is that somehow compiler reduces creating of a new list > to just adding or removing one element. If it is not so. > Then even ':' which is just adding to list head would be an O(n) > operation just because it should return brand new list with one elem > added. Or maybe functional approach uses pretty much different > complexity metric, there copying of some structure "list" for example > is just O(1)? If so then Q about compiler is still exists. There is no magic in the compiler. It's a nice side-effect of having immutable data. If we copied the whole list, that would would be O(n), but we don't need to. We just make references to the old data. In a language like C++ that would be dangerous, since modifying the old list would affect the new one. It's safe in Haskell since data is immutable, so nobody can affect our code by mutating the data we're referencing. Finger trees are complicated, so I'll demonstrate it with a simple implementation of lists. These will work the same way as Haskell's built in lists, except for the types: l1 = (20, (10, ())) This works just like "20 : 10 : []". Now, internally this is not represented as one big array in memory. Instead, each part is stored separately and joined together like this (ie. it's a singly-linked list): l1 = (20, l2) l2 = (10, ()) Since l2 and "()" are immutable, there's no point copying their values around, so the runtime will just use pointers to a single copy. Prepending an element works in the same way, ie. there's no need to copy l1: l3 = (30, l1) Appending to the end is a different story. We can't reference any existing value, since their pointers will be wrong. For example "(30, (20, (10, (40, ()))))" would become: l4 = (30, l5) l5 = (20, l6) l6 = (10, l7) l7 = (40, ()) The only new part here is l7, which is the "40" we've added, but we couldn't re-use l2 for the "10" since its pointer goes to "()" and we need it to go to l7. We're forced to make a new value l6 which has the pointer we need. Of course, the problem has just been shifted since we now can't use l1 for our "20" because it's pointing to l2 and we need one which points to l6. That forces us to define the new value l5, and so on all the way along the list, which is why it takes O(n) time. Datastructures like Finger Trees use references to existing values in much the same way, but they manage these references in clever ways so that operations have small effects (like prepending to a list) rather than expensive chain-reactions (like appending to a list). Cheers, Chris PS : DLists work very differently, since they're created out of functions! From semen at trygub.com Thu Jul 17 12:57:02 2014 From: semen at trygub.com (Semen Trygubenko / =?utf-8?B?0KHQtdC80LXQvSDQotGA0LjQs9GD0LHQtdC9?= =?utf-8?B?0LrQvg==?=) Date: Thu, 17 Jul 2014 13:57:02 +0100 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: <20140717125702.GA38977@inanna.trygub.com> On Thu, Jul 17, 2014 at 01:35:58PM +0400, ??????? ????? wrote: > I am teaching myself haskell. The first impression is very good. > But phrase "haskell is polynomially reducible" is making me sad :(. Cheer up my friend. You know what makes _me_ sad? 250+ soldiers, fine Ukrainian men in their prime, dead; 1000+ wounded. In two months... http://www.pravda.com.ua/news/2014/07/15/7031993/ Anyway. > Anyway I am trying to backport my algorithm written in C. The key to > performance is to have ability to remove element from the end of a > list in O(1). > But the original haskell functions last and init are O(n). > My questions are: > 1) Is last function is something like "black box" written in C++ which > perform O(1)? > So I shouldn't even try to imagine some haskell O(1) equivalent. > 2) Or will optimizer (llvm?) reduce init&last complexity to 1? > 3) Some people suggest to use sequences package, but still how do they > implement O(1) init&last sequences equivalent in haskell? > -- > Regards, Marat. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- ????? ?????????? http://trygub.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 196 bytes Desc: not available URL: From jake.mcarthur at gmail.com Thu Jul 17 13:04:54 2014 From: jake.mcarthur at gmail.com (Jake McArthur) Date: Thu, 17 Jul 2014 09:04:54 -0400 Subject: [Haskell-cafe] Q about last&init In-Reply-To: <20140717114340.GJ3378@henry> References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> <20140717100251.GH3378@henry> <20140717114340.GJ3378@henry> Message-ID: There are also purely functional worst case constant time (not amortized) queues out there. I'm on my phone right now, otherwise I'd try to hunt a package to link. Some of them are actually pretty simple and easy to remember how to write. Okasaki's Purely Functional Data Structures describes some. To give an idea of how far it can go, there are even (much, much more complicated) worst case constant time doubled ended queues that support constant time concatenation (again, without amortization). On Jul 17, 2014 7:44 AM, "Tom Ellis" < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Thu, Jul 17, 2014 at 03:34:17PM +0400, ??????? ????? wrote: > > Tom said that finger tree gives us O(1) on removing last element, but > > in haskell all data is persistent. > > So function should return list as is minus last element. How it could > > be O(1)? This is just blows my mind... > > Sounds like magic doesn't it :) > > > My hypothesis is that somehow compiler reduces creating of a new list > > to just adding or removing one element. If it is not so. > > Then even ':' which is just adding to list head would be an O(n) > > operation just because it should return brand new list with one elem > > added. Or maybe functional approach uses pretty much different > > complexity metric, there copying of some structure "list" for example > > is just O(1)? If so then Q about compiler is still exists. > > But no, there's no compiler magic, just an amazing datastructure. The > caveat is that the complexity is amortised, not guaranteed for every > operation. Have a look at the paper if you learn about how it works. It's > linked from the Hackage docs. > > > http://hackage.haskell.org/package/containers-0.2.0.1/docs/Data-Sequence.html > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From marat61 at gmail.com Thu Jul 17 14:47:43 2014 From: marat61 at gmail.com (=?UTF-8?B?0JfQsNC60LjRgNC+0LIg0JzQsNGA0LDRgg==?=) Date: Thu, 17 Jul 2014 18:47:43 +0400 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> <20140717100251.GH3378@henry> <20140717114340.GJ3378@henry> Message-ID: Jake It would be great if you give some examples when find your notebook :) And link to the book about pure functional data structures which you are talking about. Also If some "haskell.org" maintainers are here I'd like to recommend them to pay more attention to optimality/performance questions. Because almost first question which is apeared in head of standart C/C++ programmer is "Do I get same perfomance?" (even if he do not need it). Maybe some simple and cool PDF tutorial which describes why haskell could be as fast as others will be great to have. 2014-07-17 17:04 GMT+04:00 Jake McArthur : > There are also purely functional worst case constant time (not amortized) > queues out there. I'm on my phone right now, otherwise I'd try to hunt a > package to link. Some of them are actually pretty simple and easy to > remember how to write. Okasaki's Purely Functional Data Structures describes > some. > > To give an idea of how far it can go, there are even (much, much more > complicated) worst case constant time doubled ended queues that support > constant time concatenation (again, without amortization). > > On Jul 17, 2014 7:44 AM, "Tom Ellis" > wrote: >> >> On Thu, Jul 17, 2014 at 03:34:17PM +0400, ??????? ????? wrote: >> > Tom said that finger tree gives us O(1) on removing last element, but >> > in haskell all data is persistent. >> > So function should return list as is minus last element. How it could >> > be O(1)? This is just blows my mind... >> >> Sounds like magic doesn't it :) >> >> > My hypothesis is that somehow compiler reduces creating of a new list >> > to just adding or removing one element. If it is not so. >> > Then even ':' which is just adding to list head would be an O(n) >> > operation just because it should return brand new list with one elem >> > added. Or maybe functional approach uses pretty much different >> > complexity metric, there copying of some structure "list" for example >> > is just O(1)? If so then Q about compiler is still exists. >> >> But no, there's no compiler magic, just an amazing datastructure. The >> caveat is that the complexity is amortised, not guaranteed for every >> operation. Have a look at the paper if you learn about how it works. >> It's >> linked from the Hackage docs. >> >> >> http://hackage.haskell.org/package/containers-0.2.0.1/docs/Data-Sequence.html >> >> Tom >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Regards, Marat. ? ????????? ?????. From marlowsd at gmail.com Thu Jul 17 18:56:27 2014 From: marlowsd at gmail.com (Simon Marlow) Date: Thu, 17 Jul 2014 19:56:27 +0100 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> Message-ID: <53C81C5B.8030004@gmail.com> You guys seem to be doing a good job of narrowing this down. We know there are issues with fragmentation when using ByteStrings; in the worst case each ByteString can pin up to its size rounded up to 4Kbytes. If you're not keeping old ByteStrings around but are regularly recycling them, then you shouldn't see this problem. I believe we made some improvements (allegedly) in 7.6 to the fragmentation behaviour. Do let me know when you've narrowed it down to something you think I should look at. Cheers, Simon On 16/07/2014 14:51, Gregory Collins wrote: > OK, I've done some more investigation here, as much time as I can spare > for now: > > * I'm not sure this program really is leaking forever after all, even > on latest GHC. Originally I thought it was, because I was running > only 2 pings / client-second as you were. If you increase this to > something like 20 pings per client-second, you see the same > asymptotics at first but eventually the client plateaus, at least on > my machine. I left it running for an hour. The question remains as > to why this program exhibits such strange GC behavior (I don't see > any reason for it to slowly gobble RAM until plateauing at an > arbitrary figure), maybe Simon M can comment. > * The biggest thing you're spending RAM on here is stacks for the > threads you create. By default the stack chunk size is 32k, you can > lower this with +RTS -kcXX --- using 2kB stacks both programs use > <40MB heap resident on my machine. Counting the garbage being > generated, the space needed for buffers/etc, and the fact that the > binaries themselves are 8MB, I don't think 20kB per active client is > unreasonable. > * You can reduce GC pressure somewhat by reusing the output buffer, > the "io-streams" branch at my copy of your test repo does this. > > G > > > On Wed, Jul 16, 2014 at 1:00 PM, Gregory Collins > > wrote: > > > On Wed, Jul 16, 2014 at 5:46 AM, Ben Bangert > wrote: > > I've run the new server code, indeed it initially takes less > memory. However, when I ctrl-C the testing client, it fails to > properly close sockets now, they stay open forever (the original > code I posted always closed the sockets when I killed the > testing client). Did you try ctrl-c the test client and > re-running it several times? > > > Yes once I exhibited the leaking behaviour I stopped (and didn't > implement cleanup properly). It should be ok now. > > > I'm guessing that the recv call is blocking forever and failing > somehow to note that the socket was actually closed under it, > while the hGetline I was using properly detects this condition > and closes the socket when it notices the other side has left. > > > The Handle stuff will still end up calling recv() under the hood. > > > I should note that when asking for even 1000 echo clients, the > test client as you've changed it dies when I try to launch it > (it shows Clients Connected: 0, then just exits silently). > > > Are you running out of FDs? > > I had to use my old testing client to test the server changes > you made. If the sockets would properly close when terminating > the client abruptly, then its quite possible memory usage would > remain lower as it definitely took much much less memory for the > first 2k echo clients. > > > I've also updated my copy of the the test code to work with the GHC > 7.4.1 that's installed on my Ubuntu box at work (64-bit) --- and I > *don't* see the client leak there, resident heap plateaus at around > 90MB. > > G > -- > Gregory Collins > > > > > > -- > Gregory Collins > From jgbailey at gmail.com Thu Jul 17 20:43:35 2014 From: jgbailey at gmail.com (Justin Bailey) Date: Thu, 17 Jul 2014 13:43:35 -0700 Subject: [Haskell-cafe] Extensible Effects & Multiple Operations Message-ID: I am playing around with the extensible-effects framework and cannot figure out how to solve this problem. I am trying to define a set of operations that only work after a file has been opened. For example, reading a character from a file or detecting EOF. My problem is I cannot figure out how to define one "runner" for my Effect that can deal with operations with different result types. For example, I would like my `readFrom` and `atEOF` operations to have the following types: data OpenFile r v = ... -- my "OpenFile" effect -- read a character from the file readFrom :: Eff r Char -- detect EOF atEOF :: Eff r Bool And I would like to use this operations as follows (where I read a byte from the file, check EOF, and return the concatenation of the two values): main = do c <- runOpenFile "Setup.hs" (do a <- readFrom -- `a` has `Char` type eof <- atEOF -- `eof` has `Bool` type return $ [a] ++ show eof) putStrLn c However, I cannot define a `runOpenFile` that compiles. For example, this definition gives me "Overlapping Instance" errors: runOpenFile :: FilePath -> Eff (OpenFile v :> r) result -> IO result The best I've come up with is to define a `Result` type that holds all possible results: data Result = AtEOF Bool | ReadChar Char The `Result` type then lets me put a single type on the `OpenFile` effect in `runOpenFile`: runOpenFile :: FilePath -> Eff (OpenFile Result :> r) result -> IO result But that makes my `main` program pretty ugly, because I have to deconstruct those result types each time: main = do c <- runOpenFile "Setup.hs" (do (ReadChar a) <- readFrom (AtEOF eof) <- atEOF return $ [a] ++ show eof) putStrLn c Does anyone have suggestions? Justin p.s. The complete code (in a sort-of similar form) can be seen at https://github.com/m4dc4p/ext-eff-sample/blob/master/src/OpenFile.hs From haskell at ibotty.net Thu Jul 17 22:32:11 2014 From: haskell at ibotty.net (Tobias Florek) Date: Fri, 18 Jul 2014 00:32:11 +0200 Subject: [Haskell-cafe] Extensible Effects & Multiple Operations In-Reply-To: References: Message-ID: <53C84EEB.8050504@ibotty.net> hi, > My problem is I cannot figure out how to define one "runner" for my > Effect that can deal with operations with different result types. afaict you have two possibilities. * `OpenFile` is essentially a `Reader Handle` and `readFrom :: (SetMember Lift IO r, Member OpenFile r) => Eff r Char` asks for the handle and works with that (in `IO`). * if you don't want to impose `SetMember Lift IO`, you will have to live with a sum type in your `OpenFile`, but not with `Result`. just use data OpenFile v = Read (Char -> v) | EOF (Bool -> v) deriving Typeable btw: i find working with `ScopedTypeVariables` easier than using your `asTypeOf`. but even then, you should maybe define your own prj' :: Union (OpenFile :> r) (VE (OpenFile :> r) result) -> Maybe (OpenFile (VE (OpenFile :> r) result)) prj' = prj iff you really need it, which you don't in this example. have fun with extensible effects, tob From rendel at informatik.uni-marburg.de Thu Jul 17 22:59:52 2014 From: rendel at informatik.uni-marburg.de (Tillmann Rendel) Date: Fri, 18 Jul 2014 00:59:52 +0200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: <53C85568.5000002@informatik.uni-marburg.de> Hi, ??????? ????? wrote: > Is last function is something like "black box" written in C++ which > perform O(1)? This is not really about Haskell vs. C++, but about how the data structures look like in memory. If you have single-linked list in memory: root --> 1 --> 2 --> ... --> n And you only have a pointer to 1, you cannot even access the n'th element without following n pointers. So last for a single-linked list is necessarily O(n), independently of language. Let's look at adding an element to the front of the list. We start with this: old --> 1 --> 2 --> ... --> n and we want to end up with this: new --> 0 --> 1 --> 2 --> ... -> n This looks bad at first, because it seems that we have to copy the original list before putting the 0 in front. The trick is to just use the old list in the new list without copying it: old --> 1 --> 2 --> ... --> n ^ | new --> 0 In C++, this trick would be dangerous: If one part of the code would use the old pointer to modify the list, this modification would be visible to some other part of the code using the new pointer. In Haskell, no code can modify the list once it is created. (Note that from the point of view of 1, nothing changed, because the 1 cannot see the 0). So this problem doesn't arise and we can freely share most the list between old and new. All we did was allocate 1 heap cell for the new list element, so this operation is O(1). But what if we want to append to the end of the list? We start with this: old --> 1 --> 2 --> ... --> n And we want to end up with this: new --> 1 --> 2 --> ... --> n --> n + 1 We cannot even reach the n without doing O(n) operations. Even worse, we cannot reuse any of the old list, because the difference between the old and the new list is visible to every heap cell. So we have to allocate n + 1 new heap cells. > Or will optimizer (llvm?) reduce init&last complexity to 1? No. > Some people suggest to use sequences package, but still how do they > implement O(1) init&last sequences equivalent in haskell? They use a different data structure that's carefully designed to have just the right pointer where and when you need it. The API documentation of Data.Sequence mentions the complexity of each function. hackage.haskell.org/package/containers/docs/Data-Sequence.html If you want to learn how that works, you can follow the source links on the API documentation or reads the research paper they link to. Tillmann From jwlato at gmail.com Thu Jul 17 23:09:24 2014 From: jwlato at gmail.com (John Lato) Date: Fri, 18 Jul 2014 07:09:24 +0800 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: Oddly enough, I don't think anyone has attempted to answer the original questions, so I'll try to do so. On Thu, Jul 17, 2014 at 5:35 PM, ??????? ????? wrote: > I am teaching myself haskell. The first impression is very good. > But phrase "haskell is polynomially reducible" is making me sad :(. > Anyway I am trying to backport my algorithm written in C. The key to > performance is to have ability to remove element from the end of a > list in O(1). > But the original haskell functions last and init are O(n). > My questions are: > 1) Is last function is something like "black box" written in C++ which > perform O(1)? > No. Haskell lists are equivalent to linked lists in C. If you know how to get the last element of a singly-linked list in O(1), you should be able to implement the same algorithm in Haskell (hint: it's not possible, but if you're more familiar with C maybe this will help you see why). > So I shouldn't even try to imagine some haskell O(1) equivalent. > 2) Or will optimizer (llvm?) reduce init&last complexity to 1? > Generally no, for the same reasons. > 3) Some people suggest to use sequences package, but still how do they > implement O(1) init&last sequences equivalent in haskell? > By using a different data structure. The finger tree data structure is designed to have O(1) access to either end. Access to elements near the middle is slower, but the worse case is some complicated log factor so it's still better than O(n). I expect your C algorithm uses arrays, not linked lists. You could do exactly the same in Haskell (using mutable arrays) and then you would have the same algorithmic complexity as your C code. The big downside is that mutable array operations are in IO or ST. John L. -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at ibotty.net Thu Jul 17 23:12:33 2014 From: haskell at ibotty.net (Tobias Florek) Date: Fri, 18 Jul 2014 01:12:33 +0200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: <53C85568.5000002@informatik.uni-marburg.de> References: <53C85568.5000002@informatik.uni-marburg.de> Message-ID: <53C85861.9070604@ibotty.net> hi, >> Is last function is something like "black box" written in C++ which >> perform O(1)? > > This is not really about Haskell vs. C++, but about how the data > structures look like in memory. as tillmann said, it's about the data structures. Data.Sequence sounds like it fits your algorithm very well. but maybe one of the array libraries (vector, array, repa, accelerate) suits you better. there are also mutable variants that live in `ST` or `IO`, so you could translate your algorithm without any difference. good luck, tobias florek From hjgtuyl at chello.nl Thu Jul 17 23:50:04 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Fri, 18 Jul 2014 01:50:04 +0200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: <46510730bd9d574b3a7cc01d9707d580@roundcube.froglogic.com> <20140717100251.GH3378@henry> <20140717114340.GJ3378@henry> Message-ID: On Thu, 17 Jul 2014 16:47:43 +0200, ??????? ????? wrote: > Jake It would be great if you give some examples when find your > notebook :) And link to the book about pure functional data structures > which you are talking about. > Also If some "haskell.org" maintainers are here I'd like to recommend > them to pay more attention to optimality/performance questions. > Because almost first question which is apeared in head of standart > C/C++ programmer is "Do I get same perfomance?" (even if he do not > need it). > Maybe some simple and cool PDF tutorial which describes why haskell > could be as fast as others will be great to have. The introduction to Haskell[0], linked from the front page, mentions performance; if you type the word performance in the search field, you will get the main performance page[1], that links to a lot of other pages about performance. The The Computer Language Benchmarks Game[2] shows how well Haskell(GHC) performs, compared to other (implementations of) languages. Everybody is welcome to request a HaskellWiki account[3] and update pages[4]. Regards, Henk-Jan van Tuyl [0] https://www.haskell.org/haskellwiki/Introduction [1] http://www.haskell.org/haskellwiki/Performance [2] http://benchmarksgame.alioth.debian.org/ [3] http://www.haskell.org/haskellwiki/index.php?title=Special:UserLogin&returnto=HaskellWiki%3ACommunity [4] http://www.haskell.org/haskellwiki/HaskellWiki:Contributing -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From ok at cs.otago.ac.nz Fri Jul 18 00:54:11 2014 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 18 Jul 2014 12:54:11 +1200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: <69FEE37C-5D4B-4850-9018-8F0C5DC758C4@cs.otago.ac.nz> On 17/07/2014, at 9:35 PM, ??????? ????? wrote: > I am teaching myself haskell. The first impression is very good... > Anyway I am trying to backport my algorithm written in C. The key to > performance is to have ability to remove element from the end of a > list in O(1). You can't. Not in *any* programming language. That's because lists are one of many possible implementations of the "sequence" concept, and they are optimised to support some operations at the expense of others. At the beginning level, you should think of all Haskell data structures as immutable; fixed; frozen; forever unchanged. You can't even remove an element from the front of a Haskell list, at all. All you can do is to forget about the original list and concentrate on its tail. > But the original haskell functions last and init are O(n). Haskell lists are singly linked lists. Even by going to assembly code, you could not make these operations O(1) without *using a different data structure*. > My questions are: > 1) Is last function is something like "black box" written in C++ which > perform O(1)? No. > 2) Or will optimizer (llvm?) reduce init&last complexity to 1? No. > 3) Some people suggest to use sequences package, but still how do they > implement O(1) init&last sequences equivalent in haskell? Well, you could try reading Chris Okasaki's functional data structures book. There is a classic queue representation devised for Lisp last century which represents by ([a,b],[e,d,c]) so that you can push and pop at either end. When the end you are working on runs out, you reverse the other end, e.g., ([],[e,d,c]) -> ([c,d,e],[]). That can give you a queue with *amortised* constant time. (There is a technical issue which I'll avoid for now.) But let's start at the beginning. You have an interesting problem, P. You have an algorithm for it, A, written in C. You want an algorithm for it, H, written in Haskell. Your idea is to make small local syntactic changes to A to turn in into H. That's probably going to fail, because C just loves to smash things, and Haskell hates to. Maybe you should be using quite a different approach, one that would be literally unthinkable in C. After all, being able to do things that are unthinkable in C is one of the reasons for learning Haskell. Why not tell us what problem P is? > From allbery.b at gmail.com Fri Jul 18 01:09:42 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 17 Jul 2014 21:09:42 -0400 Subject: [Haskell-cafe] Q about last&init In-Reply-To: <69FEE37C-5D4B-4850-9018-8F0C5DC758C4@cs.otago.ac.nz> References: <69FEE37C-5D4B-4850-9018-8F0C5DC758C4@cs.otago.ac.nz> Message-ID: On Thu, Jul 17, 2014 at 8:54 PM, Richard A. O'Keefe wrote: > > But the original haskell functions last and init are O(n). > > Haskell lists are singly linked lists. Even by going to > assembly code, you could not make these operations O(1) > without *using a different data structure*. > At this point, you may be wondering why Haskell uses singly linked lists so much, when one might think an array/vector type might be more generally useful. The thing about functional languages, and in particular pure functional languages such as Haskell, is that you don't generally have things like looping constructs; instead, you represent your data in a form which implies such a construct. In particular, when you might use a for/foreach loop in other languages, in a functional language you use a singly linked list and a map or fold over the list. (Some object-oriented languages do this as well; consider the "each" method in Smalltalk or Ruby.) In a pure functional language like Haskell, this can lead to optimizations you would not get from an explicit foreach loop: since values are immutable and can be generated lazily, a compiler can more easily recognize that it doesn't need to generate or maintain a list at all but just consume values as they are generated. Languages that use foreach loops often can only do this optimization in specific cases: for example, in Perl a foreach loop on a constant numeric range is optimized this way, but not others; in Ruby, it's much harder to do this at all because the "each" method needs to be resolved to a list object; and commercial Smalltalk implementations generally have quite a lot of behind the scenes intelligence to try to recognize and optimize these kinds of cases without falling into the same trap as e.g. Ruby. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmorris at tmorris.net Fri Jul 18 06:04:49 2014 From: tmorris at tmorris.net (Tony Morris) Date: Fri, 18 Jul 2014 16:04:49 +1000 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: data SnocList a = SnocList ([a] -> [a]) Inserts to the front and end in O(1). On 17/07/2014 7:47 PM, "??????? ?????" wrote: > Thanks, but maybe I badly formulated my question. I'd like to insert > at the beginning of the list and remove from the tail both in O(1). > > > 2014-07-17 13:39 GMT+04:00 Frerich Raabe : > > On 2014-07-17 11:35, ??????? ????? wrote: > >> > >> I am teaching myself haskell. The first impression is very good. > >> But phrase "haskell is polynomially reducible" is making me sad :(. > >> Anyway I am trying to backport my algorithm written in C. The key to > >> performance is to have ability to remove element from the end of a > >> list in O(1). > >> But the original haskell functions last and init are O(n). > > > > > > On viable option might be to adjust the algorithm such that instead of > > appending to the list, it prepends (which is O(1) in Haskell), i.e. > > you manage the list in reverse and only actually reverse it to the > > original order when needed (e.g. when printing). > > > > -- > > Frerich Raabe - raabe at froglogic.com > > www.froglogic.com - Multi-Platform GUI Testing > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > -- > Regards, Marat. > ? ????????? ?????. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From janis.voigtlaender at gmail.com Fri Jul 18 06:23:13 2014 From: janis.voigtlaender at gmail.com (=?UTF-8?Q?Janis_Voigtl=C3=A4nder?=) Date: Fri, 18 Jul 2014 08:23:13 +0200 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: 2014-07-18 8:04 GMT+02:00 Tony Morris : > data SnocList a = SnocList ([a] -> [a]) > > Inserts to the front and end in O(1). > Which is not what he wants. He said he wants to insert at the front and *remove* from the end in O(1). -------------- next part -------------- An HTML attachment was scrubbed... URL: From marat61 at gmail.com Fri Jul 18 06:52:24 2014 From: marat61 at gmail.com (=?UTF-8?B?0JfQsNC60LjRgNC+0LIg0JzQsNGA0LDRgg==?=) Date: Fri, 18 Jul 2014 10:52:24 +0400 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: Thank you all guys, really your answers were helpful, Also I noticed than most of haskell people is in faaaar west from Moscow. Lisp queue are really cool, thanks Richard (something like that were been cooking in my head). I do think that imperative languages are horrible they are unreadable (they are just "sugar" version of Turing machine :) ). They constrain SW parallelism with pointer aliasing. Thay are need to be executed on CPU with retirement buffer. So my preferences is on functional side... The big question is all about: how to make code which has ~same performance in single core CPU with algorithms which are not too much complex. But lets speak about problem. I need to form array of local mins observe. Radius = 1 In [1, 2, 0, 3, 5, 7, 4] Out [1, 0, 0, 0, 3, 4, 4] A itself a bit complicated and spaghetti like in my C version. But verbally it sounds like: I dynamically form (or support or provide) o sequence of indices's of strictly increasing elems. To perform that I push in head new elem just after I have poped all stuff which is bigger or equal. Also I remove from the tail all elems that have range bigger than Radius. And than I just put elem to out array. Pretty simple huh? This is a part of bigger procedure (which is image filtration) which operates on matrix and calculate local mins and maxs by reusing of described above algorithm in a pretty straightforward way and obtains O(n) complexity. --Marat 2014-07-18 10:04 GMT+04:00 Tony Morris : > data SnocList a = SnocList ([a] -> [a]) > > Inserts to the front and end in O(1). > > On 17/07/2014 7:47 PM, "??????? ?????" wrote: >> >> Thanks, but maybe I badly formulated my question. I'd like to insert >> at the beginning of the list and remove from the tail both in O(1). >> >> >> 2014-07-17 13:39 GMT+04:00 Frerich Raabe : >> > On 2014-07-17 11:35, ??????? ????? wrote: >> >> >> >> I am teaching myself haskell. The first impression is very good. >> >> But phrase "haskell is polynomially reducible" is making me sad :(. >> >> Anyway I am trying to backport my algorithm written in C. The key to >> >> performance is to have ability to remove element from the end of a >> >> list in O(1). >> >> But the original haskell functions last and init are O(n). >> > >> > >> > On viable option might be to adjust the algorithm such that instead of >> > appending to the list, it prepends (which is O(1) in Haskell), i.e. >> > you manage the list in reverse and only actually reverse it to the >> > original order when needed (e.g. when printing). >> > >> > -- >> > Frerich Raabe - raabe at froglogic.com >> > www.froglogic.com - Multi-Platform GUI Testing >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> >> >> -- >> Regards, Marat. >> ? ????????? ?????. >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Marat. ? ????????? ?????. From edskodevries at gmail.com Fri Jul 18 09:30:37 2014 From: edskodevries at gmail.com (Edsko de Vries) Date: Fri, 18 Jul 2014 10:30:37 +0100 Subject: [Haskell-cafe] Unable to build vector on OSX (ghc 7.4, gcc 4.8) Message-ID: Hi guys, I am currently unable to build vector on OSX: Loading package base ... : can't load .so/.DLL for: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib (dlopen(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib, 9): no suitable image found. Did find: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib: mach-o, but wrong filetype) cabal: Error: some packages failed to install: vector-0.10.11.0 failed during the building phase. The exception was: This has been reported before as some kind of clang issue, but I am using gcc 4.8 (ghc-7.4.2/settings has "gcc-4.8" for "C compiler command"). Any suggestions? Thanks! Edsko -------------- next part -------------- An HTML attachment was scrubbed... URL: From lghtfck at gmail.com Fri Jul 18 13:15:38 2014 From: lghtfck at gmail.com (=?UTF-8?B?0J/QsNCy0LXQuyDQk9Cw0LLRgNC40LvQvtCy?=) Date: Fri, 18 Jul 2014 17:15:38 +0400 Subject: [Haskell-cafe] Conduit & state Message-ID: Hi! I have: runUnixServer (serverSettings socket) $ \appData -> appSource appData $$ CL.map handleBS =$ appSink appData I want to store some data in priority queue in Monad.State and be able to access it inside the handleBS (now: handleBS :: ByteString -> ByteString). Can you send me on the right path? Thanx, Pavel. -------------- next part -------------- An HTML attachment was scrubbed... URL: From toby at paccrat.org Fri Jul 18 14:07:24 2014 From: toby at paccrat.org (Toby Goodwin) Date: 18 Jul 2014 14:07:24 -0000 Subject: [Haskell-cafe] Conduit & state Message-ID: <1405692444.596.hydrogen.mv6.co.uk@hydrogen.mpv6.com> Hi Pavel, >runUnixServer (serverSettings socket) $ \appData -> > ... >I want to store some data in priority queue in Monad.State and be able to >access it inside the handleBS (now: handleBS :: ByteString -> ByteString). Funnily enough, I've just been looking at an analogous problem (with runTCPClient and Persistent). It seems that in the recent move from conduit-network to conduit-extra, the run*Client and run*Server functions were specialized to the IO monad. I don't know what the motivation for this change was (simpler error messages perhaps?) but it does seem unhelpful. The workaround I deployed last night was to roll my own runTCPClient' which merges the code from the (deprecated) conduit-network package and the (current) streaming-commons, but this is hardly satisfactory. I'm sure I must be missing something. (I don't know if there's a better list to discuss conduit.) Toby. From charles at charlesweitzer.com Fri Jul 18 15:35:12 2014 From: charles at charlesweitzer.com (charles at charlesweitzer.com) Date: Fri, 18 Jul 2014 08:35:12 -0700 Subject: [Haskell-cafe] Functional Programing-Oriented Machine Learning Startup Seeks DevOps Guru Message-ID: <20140718083512.65248dbfd22d8a78aaf03ec31bc78ba7.c3f1e6d3bb.wbe@email13.secureserver.net> An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Fri Jul 18 15:36:43 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 18 Jul 2014 11:36:43 -0400 Subject: [Haskell-cafe] Unable to build vector on OSX (ghc 7.4, gcc 4.8) In-Reply-To: References: Message-ID: Is this a 32bit ghc? It's complaining about libiconv beig the wrong architecture. On Friday, July 18, 2014, Edsko de Vries wrote: > Hi guys, > > I am currently unable to build vector on OSX: > > Loading package base ... : can't load .so/.DLL for: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib (dlopen(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib, 9): no suitable image found. Did find: > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib: mach-o, but wrong filetype) > cabal: Error: some packages failed to install: > vector-0.10.11.0 failed during the building phase. The exception was: > > This has been reported before as some kind of clang issue, but I am using gcc 4.8 (ghc-7.4.2/settings has "gcc-4.8" for "C compiler command"). > > Any suggestions? > > Thanks! > > Edsko > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From edskodevries at gmail.com Fri Jul 18 15:48:11 2014 From: edskodevries at gmail.com (Edsko de Vries) Date: Fri, 18 Jul 2014 16:48:11 +0100 Subject: [Haskell-cafe] Unable to build vector on OSX (ghc 7.4, gcc 4.8) In-Reply-To: References: Message-ID: No, it's ghc-7.4.2-x86_64-apple-darwin.tar.bz2 from haskell.org/ghc. Turns out it's got nothing to do with vector per se. ghci doesn't work either (should have realized this sooner -- it's going wrong when TH initializes when building vector). -E On Fri, Jul 18, 2014 at 4:36 PM, Carter Schonwald < carter.schonwald at gmail.com> wrote: > Is this a 32bit ghc? It's complaining about libiconv beig the wrong > architecture. > > > On Friday, July 18, 2014, Edsko de Vries wrote: > >> Hi guys, >> >> I am currently unable to build vector on OSX: >> >> Loading package base ... : can't load .so/.DLL for: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib (dlopen(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib, 9): no suitable image found. Did find: >> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib: mach-o, but wrong filetype) >> cabal: Error: some packages failed to install: >> vector-0.10.11.0 failed during the building phase. The exception was: >> >> This has been reported before as some kind of clang issue, but I am using gcc 4.8 (ghc-7.4.2/settings has "gcc-4.8" for "C compiler command"). >> >> Any suggestions? >> >> Thanks! >> >> Edsko >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From edskodevries at gmail.com Fri Jul 18 19:17:38 2014 From: edskodevries at gmail.com (Edsko de Vries) Date: Fri, 18 Jul 2014 20:17:38 +0100 Subject: [Haskell-cafe] Unable to build vector on OSX (ghc 7.4, gcc 4.8) In-Reply-To: References: Message-ID: Ok, I finally figured out what was going on. At the time that I installed gcc-4.9 (through brew) I did not have the Xcode command line tools installed. As a result, gcc was using the linker from the SDK; gcc-4.9 -v reported: Configured with: ../configure --build=x86_64-apple-darwin13.3.0 --prefix=/Users/dev/brew/Cellar/gcc49/4.9.0 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --with-gmp=/Users/dev/brew/opt/gmp4 --with-mpfr=/Users/dev/brew/opt/mpfr2 --with-mpc=/Users/dev/brew/opt/libmpc08 --with-cloog=/Users/dev/brew/opt/cloog018 --with-isl=/Users/dev/brew/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion='Homebrew gcc49 4.9.0' --with-bugurl= https://github.com/Homebrew/homebrew-versions/issues --enable-plugin --disable-nls --enable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk Note the sysroot. I think this ultimately causing ghc to load the wrong dynamic library (from /Applications/.. rather than /usr/lib). Once I rebuilt gcc _after_ installing the command line tools (xcode-select --install) gcc reports: Configured with: ../configure --build=x86_64-apple-darwin13.3.0 --prefix=/Users/dev/brew/Cellar/gcc49/4.9.0 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --with-gmp=/Users/dev/brew/opt/gmp4 --with-mpfr=/Users/dev/brew/opt/mpfr2 --with-mpc=/Users/dev/brew/opt/libmpc08 --with-cloog=/Users/dev/brew/opt/cloog018 --with-isl=/Users/dev/brew/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion='Homebrew gcc49 4.9.0' --with-bugurl= https://github.com/Homebrew/homebrew-versions/issues --enable-plugin --disable-nls --enable-multilib and now when I install ghc (with gcc-4.9 as the C compiler) ghci and TH work. Finally :) Edsko On Fri, Jul 18, 2014 at 4:48 PM, Edsko de Vries wrote: > No, it's ghc-7.4.2-x86_64-apple-darwin.tar.bz2 from haskell.org/ghc. > > Turns out it's got nothing to do with vector per se. ghci doesn't work > either (should have realized this sooner -- it's going wrong when TH > initializes when building vector). > > -E > > > On Fri, Jul 18, 2014 at 4:36 PM, Carter Schonwald < > carter.schonwald at gmail.com> wrote: > >> Is this a 32bit ghc? It's complaining about libiconv beig the wrong >> architecture. >> >> >> On Friday, July 18, 2014, Edsko de Vries wrote: >> >>> Hi guys, >>> >>> I am currently unable to build vector on OSX: >>> >>> Loading package base ... : can't load .so/.DLL for: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib (dlopen(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib, 9): no suitable image found. Did find: >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libiconv.dylib: mach-o, but wrong filetype) >>> cabal: Error: some packages failed to install: >>> vector-0.10.11.0 failed during the building phase. The exception was: >>> >>> This has been reported before as some kind of clang issue, but I am using gcc 4.8 (ghc-7.4.2/settings has "gcc-4.8" for "C compiler command"). >>> >>> Any suggestions? >>> >>> Thanks! >>> >>> Edsko >>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From J.Hage at uu.nl Sat Jul 19 11:33:25 2014 From: J.Hage at uu.nl (Jurriaan Hage) Date: Sat, 19 Jul 2014 13:33:25 +0200 Subject: [Haskell-cafe] Cabal question Message-ID: <34100956-750C-49CF-97F0-F973ADB1E2FA@uu.nl> Hi there, I am busy making the Helium compiler available as a Cabal install. What I still need is a way to run some kind of postprocessing (like running a Makefile) after installation (as it happens this is for compiling the libraries that come with Helium). Does anyone know here whether that is supported and how, without having to resort to build-types like Make that for I actually want to avoid? best, Jur From alois.cochard at gmail.com Sat Jul 19 11:50:13 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Sat, 19 Jul 2014 12:50:13 +0100 Subject: [Haskell-cafe] No `base-4.7.0.1` in hackage Message-ID: Hi, GHC 7.8.3 ships with base 4.7.0.1, but this module is not published in hackage. Is there any reason why? That is an issue in my tool `codex` because he used hackage to download the sources and tags them [1]. [1]: https://github.com/aloiscochard/codex/issues/15 -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Sat Jul 19 14:07:50 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Sat, 19 Jul 2014 16:07:50 +0200 Subject: [Haskell-cafe] No `base-4.7.0.1` in hackage In-Reply-To: References: Message-ID: On Jul 19, 2014 2:50 PM, "Alois Cochard" wrote: > Hi, > > GHC 7.8.3 ships with base 4.7.0.1, but this module is not published in > hackage. > Is there any reason why? > > That is an issue in my tool `codex` because he used hackage to download > the sources and tags them [1]. > > [1]: https://github.com/aloiscochard/codex/issues/15 > > -- > *A\ois* > http://twitter.com/aloiscochard > http://github.com/aloiscochard > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From creswick at gmail.com Sat Jul 19 15:49:29 2014 From: creswick at gmail.com (Rogan Creswick) Date: Sat, 19 Jul 2014 08:49:29 -0700 Subject: [Haskell-cafe] Cabal question In-Reply-To: <34100956-750C-49CF-97F0-F973ADB1E2FA@uu.nl> References: <34100956-750C-49CF-97F0-F973ADB1E2FA@uu.nl> Message-ID: On Sat, Jul 19, 2014 at 4:33 AM, Jurriaan Hage wrote: > What I still need is a way to run some kind of postprocessing (like running > a Makefile) after installation (as it happens this is for compiling the > libraries that come with Helium). You can do this with a custom cabal build type, a non-trivial Setup.hs. Cabal exposes a bunch of 'user hooks' that let you specify functions to be run at various stages of the compilation (such as pre-build, post-install, etc...). See the API here for the hooks available: - http://www.haskell.org/ghc/docs/7.6.3/html/libraries/Cabal/Distribution-Simple-UserHooks.html I use prebuild hooks quite a lot to pre-process GF files (for the grammatical framework); one relatively simple example is shown in my gfI8N package: https://github.com/creswick/gfI8N Note that the cabal file uses `build-type: Custom` (which causes cabal to actually use the Setup.hs). The relevant part of the Setup.hs is: import Distribution.Simple import Distribution.Simple.Program.Types import Distribution.Simple.Setup import Distribution.Simple.UserHooks import Distribution.Simple.Utils ( rawSystemExit, warn, debug , findProgramVersion, notice ) import Distribution.Verbosity ( Verbosity ) main = do defaultMainWithHooks simpleUserHooks { preBuild = \a b -> generatePGF a b >> preBuild simpleUserHooks a b , preClean = \a b -> preClean simpleUserHooks a b } That should be enough to get you going -- now some cautions, and a minor rant ;) Working with these hooks has lead me to /really/ want a way to express dependencies for Setup.hs files. You *can not* use any hackage libraries in the definitions of these hooks and retain a portable build, because there is no way to indicate that the Setup.hs depends on such things. It used to be the case that you could assume that the dependencies of your library / executable would be visible, but with sandboxed builds that assumption is no longer valid. There's a cabal ticket for this feature here: https://github.com/haskell/cabal/issues/948 You should be able to rely on these packages (which shipped with ghc -- the versions will depend on the ghc version installed): Cabal-1.16.0 array-0.4.0.1 base-4.6.0.1 bin-package-db-0.0.0.0 binary-0.5.1.1 bytestring-0.10.0.2 containers-0.5.0.0 deepseq-1.3.0.1 directory-1.2.0.1 filepath-1.3.0.1 ghc-7.6.3 ghc-prim-0.3.0.0 haskell2010-1.1.1.0 haskell98-2.0.0.2 hoopl-3.9.0.0 hpc-0.6.0.0 integer-gmp-0.5.0.0 old-locale-1.0.0.5 old-time-1.1.0.1 pretty-1.1.1.0 process-1.1.0.2 rts-1.0 template-haskell-2.8.0.0 time-1.4.0.1 --Rogan Does anyone know here whether that is supported > and how, without having to resort to build-types like Make that for I > actually > want to avoid? > > best, > Jur > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at blitzcode.net Sat Jul 19 19:43:57 2014 From: tim at blitzcode.net (Tim C. Schroeder) Date: Sat, 19 Jul 2014 21:43:57 +0200 Subject: [Haskell-cafe] ANN: hackage-diff - Compare the public API of different versions of a Hackage library Message-ID: Just a first shot at the problem, hope it?s useful to somebody! https://github.com/blitzcode/hackage-diff Cheers, Tim From michael at snoyman.com Sat Jul 19 22:08:33 2014 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 20 Jul 2014 01:08:33 +0300 Subject: [Haskell-cafe] Conduit & state In-Reply-To: References: Message-ID: Keep in mind that a State monad won't necessarily play nicely with a multithreaded server. In particular, each new connection will have its state set at the point the state was at when the server started, and modifications from each child thread will be discarded. (That's assuming you do something like using monad-control.) Depending on your actual needs, you may instead want to store the priority queue in some kind of a mutable variable, so that the child threads are able to update the state for other threads. On Fri, Jul 18, 2014 at 4:15 PM, ????? ???????? wrote: > Hi! > > I have: > > runUnixServer (serverSettings socket) $ \appData -> > appSource appData > $$ CL.map handleBS > =$ appSink appData > > I want to store some data in priority queue in Monad.State and be able to > access it inside the handleBS (now: handleBS :: ByteString -> ByteString). > Can you send me on the right path? > > Thanx, Pavel. > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.g.larson at gmail.com Sat Jul 19 22:17:41 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Sat, 19 Jul 2014 18:17:41 -0400 Subject: [Haskell-cafe] How many Haskell programmers are there? Message-ID: Obviously this is a very fuzzy question. But what's the credible range of answers? Here's one: http://steve-yegge.blogspot.ca/2010/12/haskell-researchers-announce-discovery.html 38 -- Johan Larson -- Toronto, Canada From alexander at plaimi.net Sat Jul 19 22:38:16 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Sun, 20 Jul 2014 00:38:16 +0200 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: Message-ID: <53CAF358.9060100@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 20/07/14 00:17, Johan Larson wrote: > Obviously this is a very fuzzy question. But what's the credible range > of answers? > > Here's one: > http://steve-yegge.blogspot.ca/2010/12/haskell-researchers-announce-discovery.html > > 38 Isn't this research in stark contrast with our motto? I'm not sure I am comfortable with it. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlPK81gACgkQRtClrXBQc7UP5wD/dm9C0wsxB5hm4YtTW1uotoOR 2uEkHKeURsL/nOz+GNQBAKOjgD+zzh6iXbscAz7RrqoENl1OQsHYwuoce+oCZdM4 =Jakj -----END PGP SIGNATURE----- From almeidaraf at gmail.com Sat Jul 19 22:44:46 2014 From: almeidaraf at gmail.com (Rafael Almeida) Date: Sat, 19 Jul 2014 19:44:46 -0300 Subject: [Haskell-cafe] Creating a Point Message-ID: Hello, I was talking to friends about how could you make a Point type in haskell. It's intuitive to make a 2D point such as: type Point2D = (Double, Double) Let's define one operation on this new type: add2D (x1, y1) (x2, y2) = (x1+x2, y1+y2) Let's say now we want a 3D point. Then we'd be tempted to do: type Point3D = (Double, Double, Double) add3D (x1, y1, z1) (x2, y2, z2) = (x1+x2, y1+y2, z1+z2) Although those types work great and you could make a type class so you don't have to suffix each function with 2D and 3D. It feels like we are just repeating code when defining the add function. If we want to go 4D, 5D, etc it would be more repeated code. Using a list would be more general: type Point = [Double] now we have a nice, general add function add = zipWith (+) It's not so fun that we are able to do something like: add [2,3] [5,7,11] We have no type-safety that we can only operate on points with the same dimension. How could we address this? Can we make a general function, yet retain the type safety? I suppose maybe there's something that could be done with TH so that we automatically generate those Point2D, Point3D, etc code. I'm not sure that would be a nice path to follow, though. []'s Rafael -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at nand.wakku.to Sat Jul 19 23:05:32 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Sun, 20 Jul 2014 01:05:32 +0200 Subject: [Haskell-cafe] Creating a Point In-Reply-To: References: Message-ID: <20140720010532.GB4607@nanodesu.localdomain> On Sat, 19 Jul 2014 19:44:46 -0300, Rafael Almeida wrote: > How could we address this? Can we make a general function, yet retain the > type safety? I suppose maybe there's something that could be done with TH > so that we automatically generate those Point2D, Point3D, etc code. I'm not > sure that would be a nice path to follow, though. This can be achieved with only the help of GADTs: data Zero data Succ dim data Vector dim a where VEmpty :: Vector Zero a VCons :: a -> Vector d a -> Vector (Succ d) a add :: Num a => Vector d a -> Vector d a -> Vector d a add VEmpty VEmpty = VEmpty add (VCons a x) (VCons b y) = VCons (a+b) (add x y) If we allow for the use of DataKinds as well, we can get some additional niceties by defining our Zero/Succ like this instead: data Dim = Zero | Succ Dim In this representation, we can also add a typeclass to define something like: class Dimension (d :: Dim) where inj :: a -> Vector d a dim :: Vector d a -> Dim instance Dimension Zero where inj _ = VEmpty dim _ = Zero instance Dimension d => Dimension (Succ d) where inj a = VCons a (inj a) dim (VCons _ v) = Succ (dim v) This allows us to write, among other things: fromInteger :: (Num a, Inj d) => Integer -> Vector d a fromInteger = inj . fromInteger Ultimately leading to: instance (Dimension d, Num a) => Num (Vector d a) where ... Figuring out the details of this is left as an exercise to the reader. From fa-ml at ariis.it Sat Jul 19 23:17:14 2014 From: fa-ml at ariis.it (Francesco Ariis) Date: Sun, 20 Jul 2014 01:17:14 +0200 Subject: [Haskell-cafe] Creating a Point In-Reply-To: References: Message-ID: <20140719231714.GA14995@x60s.casa> On Sat, Jul 19, 2014 at 07:44:46PM -0300, Rafael Almeida wrote: > I was talking to friends about how could you make a Point type in haskell. > It's intuitive to make a 2D point such as: > > type Point2D = (Double, Double) > > Using a list would be more general: > > type Point = [Double] > > now we have a nice, general add function > > add = zipWith (+) > > It's not so fun that we are able to do something like: > > add [2,3] [5,7,11] > > We have no type-safety that we can only operate on points with the same > dimension. > > How could we address this? Can we make a general function, yet retain the > type safety? A possible solution /without/ using Template Haskell is using phantom types for the various kind of |Point|s. Example: data Point a = Point [Int] deriving (Show) data Two -- data declaration sans constructors data Three crea2d :: Int -> Int -> Point Two crea2d a b = Point [a,b] crea3d :: Int -> Int -> Int -> Point Three crea3d a b c = Point [a,b,c] addPoints :: Point a -> Point a -> Point a addPoints (Point pa) (Point pb) = Point $ zipWith (+) pa pb So you are sure addPoints is will only type-check on two similarly constructed (i.e. same dimensions) |Point|s: ex2 = crea2d 1 2 -- make sure that "exSomething" is the only way to ex3 = crea3d 1 2 3 -- create Points (i.e. don't export Point(..)) works = addPoints ex2 ex2 stillworks = addPoints ex3 ex3 doesntwork = addPoints ex2 ex3 -- won't type-check Phantom types are a well known trick for "shifting" checks from run-time to compile-time. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From leza.ml at fecrd.cujae.edu.cu Sun Jul 20 04:33:00 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Sun, 20 Jul 2014 00:33:00 -0400 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: <20140717083236.GB20051@nanodesu.localdomain> References: <53C735BB.6040807@fecrd.cujae.edu.cu> <20140717083236.GB20051@nanodesu.localdomain> Message-ID: <53CB467C.3070802@fecrd.cujae.edu.cu> On 17/07/14 02:32, Niklas Haas wrote: > The reason you're getting this error is because all you know about your > instance is that the type of fft is :: [Complex Double] -> [Complex > Double]. > > Since by definition this [Complex Double] is ComplexSignalType sx, all > we know about the associated instance (parametrized by sx) is that > ComplexSignalType sx ~ [Complex Double]. Since ComplexSignalType is a > type family, it's not injective, so this does not suffice to uniquely > identify our actual instance (sx, here called s0 by GHC). > > For example, we could have a second instance: > > instance Complexable () where > type ComplexSignalType () = [Complex Double] > > instance FourierTransformable () where > fft = error "oops" > > And with this instance, fft would also be [Complex Double] -> [Complex > Double] but the behavior of would clearly be different to your actually > intended function. > > If you think your signal function is bijective, you could use a two-way > functional dependency like this: > > class Complexable sx cx | sx -> cx, cx -> sx > > class Complexable sx cx => FourierTransformable sx cx where > fft :: cx -> cx > > Or if you want to avoid the overhead of redesigning Complexable you > could even do something like this: > > class (cx ~ ComplexSignalType sx, Complexable sx) => FourierTransformable sx cx | cx -> sx where > fft :: cx -> cx > > Either way, if instance selection should be possible based solely on the > type of ?cx?, then ?cx? must imply everything contained in the instance > head. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe Thanks for the explanation, Niklas, now I understand (I'm understanding) type families and I left with: class (Signal s, ComplexSignal (ComplexSignalType s), RealSignalType (ComplexSignalType s) ~ s) ? Complexable s where type ComplexSignalType s class (Complexable s) ? FourierTransformable s where fft ? ? csx. (csx ~ ComplexSignalType s, ComplexSignal csx) ? csx ? csx Maybe more complex than normal? Thanks again. -- Leza Morais Lutonda, Lemol-C http://lemol.github.io 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From winterkoninkje at gmail.com Sun Jul 20 04:56:13 2014 From: winterkoninkje at gmail.com (wren romano) Date: Sun, 20 Jul 2014 00:56:13 -0400 Subject: [Haskell-cafe] Is there a name for this property: x + x - x == x In-Reply-To: References: Message-ID: On Wed, Jun 4, 2014 at 10:34 AM, Omari Norman wrote: > It's not quite idempotence, because more than one function is involved. It's a restricted version of the quasigroup law. For non-commutative operators there are actually two laws: left-division: forall a, b. exists (a\b). a*(a\b) == b N.B., it follows that: forall a, b. a \ (a*b) == b right-division: forall a, b. exists (b/a). (b/a)*a == b N.B., it follows that: forall a, b. (a*b) / b == a The "division" in the name just comes from assuming (*) is a "multiplication", as is usually assumed in group theory. We call (*) a left- or right-quasigroup depending on which law holds, or call it a quasigroup if both laws hold. If the quasigroup has an identity element, then it's called a loop, and we can define left- and right-inverse operators by (x\1) and (1/x). If we have various weak forms of associativity then we get left Bol loops, right Bol loops, and Moufang loops depending on what sort of weak associativity we have. If we have full associativity then the loop is a monoid. If the left- and right-inverses coincide, then this monoid is in fact a group. cf., also Alternatively, if you want to view the law as being associated the other way ? i.e., (x*y)/y == x ? then, as Alexander Vieth said, the way to think about it is in terms of the endomorphism group. That is, given any monoid (G,(*)) we can construct a monoid (Endo(G),(.)) where forall x:G we have (_*x) : Endo(G), and where (.) is function composition. When G happens to be a group every element has a unique multiplicative inverse, therefore every endomorphism has a unique compositional inverse, hence Endo(G) is a group. Thus, we'd just call (_*x) and (_/x) inverses since they're inverse elements in Endo(G). If you want to get fancy, whenever r . s == id we say that s is a "section" of r, and that r is a "retraction" of s. So you could use that terminology, though it's more general and it loses the fact that we actually have both (_*x).(_/x) == id and also (_/x).(_*x) == id. -- Live well, ~wren From winterkoninkje at gmail.com Sun Jul 20 05:26:03 2014 From: winterkoninkje at gmail.com (wren romano) Date: Sun, 20 Jul 2014 01:26:03 -0400 Subject: [Haskell-cafe] ANN: loop - fast for loops In-Reply-To: <536114F2.2060400@nh2.me> References: <536114F2.2060400@nh2.me> Message-ID: On Wed, Apr 30, 2014 at 11:21 AM, Niklas Hamb?chen wrote: > Announcing the first version of the loop package: > > http://hackage.haskell.org/package/loop > > This is for iterating over numeric or otherwise iteratable things in a > fast fashion. Looks like C, runs like C. > > It's trivial, but very robust performance-wise and more independent of > GHC smartness or non-smartness in regards to optimising alternatives > like `forM_ [1..n]`. > > It comes with a lot of benchmarks. > > Contributions are very welcome. How do you feel about bikeshedding contributions? The following seems more idiomatic to me: -- Formerly @forLoopFold at . This is the primitive notion, so it should have the simplest name. loop :: a -> (a -> Bool) -> (a -> a) -> b -> (b -> a -> b) -> b -- This one is new. We want to implement it directly instead of using 'loop' for the same reasons that we want to implement 'loopM_' directly. loopM :: Monad m => a -> (a -> Bool) -> (a -> a) -> b -> (b -> a -> m b) -> m b -- Formerly @forLoop@ loopM_ :: Monad m => a -> (a -> Bool) -> (a -> a) -> (a -> m ()) -> m () loopFromTo :: (Eq a, Enum a) => a -> a -> b -> (b -> a -> b) -> b loopFromTo start stop = loop start (stop ==) succ loopNumFromTo :: (Eq a, Num a) => a -> a -> b -> (b -> a -> b) -> b loopNumFromTo start stop = loop start (stop ==) (1+) loopFromToM :: (Eq a, Enum a) => a -> a -> b -> (b -> a -> m b) -> m b loopFromToM start stop = loopM start (stop ==) succ loopNumFromToM :: (Eq a, Num a) => a -> a -> b -> (b -> a -> m b) -> m b loopNumFromToM start stop = loopM start (stop ==) (1+) loopFromToM_ :: (Eq a, Enum a) => a -> a -> (a -> m ()) -> m () loopFromToM_ start stop = loopM_ start (stop ==) succ loopNumFromToM_ :: (Eq a, Num a) => a -> a -> (a -> m ()) -> m () loopNumFromToM_ start stop = loopM_ start (stop ==) (1+) the loopNum* names are pretty arbitrary/crappy, but using the *FromTo, *M, and *M_ names is far more idiomatic. -- Live well, ~wren From ollie at ocharles.org.uk Sun Jul 20 11:07:31 2014 From: ollie at ocharles.org.uk (Oliver Charles) Date: Sun, 20 Jul 2014 12:07:31 +0100 Subject: [Haskell-cafe] ANN: hackage-diff - Compare the public API of different versions of a Hackage library In-Reply-To: References: Message-ID: <53CBA2F3.1010003@ocharles.org.uk> On 19/07/14 20:43, Tim C. Schroeder wrote: > Just a first shot at the problem, hope it?s useful to somebody! > > https://github.com/blitzcode/hackage-diff > > Cheers, > Tim Nice work, Tim - you've built exactly what I've been dreaming of for months! This should come in really helpful when I'm determining versions - both for my own work and when using other people's work. Nice job :) - ocharles -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: OpenPGP digital signature URL: From hjgtuyl at chello.nl Sun Jul 20 11:10:31 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sun, 20 Jul 2014 13:10:31 +0200 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: Message-ID: On Sun, 20 Jul 2014 00:17:41 +0200, Johan Larson wrote: > Obviously this is a very fuzzy question. But what's the credible range > of answers? The tags page of stackoverflow[0] says (when hovering over the rectangle with the word Haskell) that there are 5.6k followers. Of course, there is no guarantee that the followers are Haskell programmers, and it is certain that not all Haskell programmers are followers (I am a Haskell programmer, but not a follower). Can someone tell us, how many subscriptions there are for the Haskell-Caf? mailing list? Regards, Henk-Jan van Tuyl [0] http://stackoverflow.com/tags -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From mail at nh2.me Sun Jul 20 12:24:42 2014 From: mail at nh2.me (=?UTF-8?B?TmlrbGFzIEhhbWLDvGNoZW4=?=) Date: Sun, 20 Jul 2014 14:24:42 +0200 Subject: [Haskell-cafe] ANN: loop - fast for loops In-Reply-To: References: <536114F2.2060400@nh2.me> Message-ID: <53CBB50A.3030609@nh2.me> Hey, I have nothing against bikeshedding contributions :) For now I don't want to break backwards compatibility with renames, but if more idomatic things like forM_ [1..n] keep not being optimised as well and more people start using loop as a package, agreeing on a set of names that people find nicest would be good. Maybe you can put your suggestion into a github issue, so that we don't forget about them? On 20/07/14 07:26, wren romano wrote: > How do you feel about bikeshedding contributions? The following seems > more idiomatic to me: > > -- Formerly @forLoopFold at . This is the primitive notion, so it > should have the simplest name. > loop :: a -> (a -> Bool) -> (a -> a) -> b -> (b -> a -> b) -> b > > -- This one is new. We want to implement it directly instead of > using 'loop' for the same reasons that we want to implement 'loopM_' > directly. > loopM :: Monad m => a -> (a -> Bool) -> (a -> a) -> b -> (b -> a > -> m b) -> m b > > -- Formerly @forLoop@ > loopM_ :: Monad m => a -> (a -> Bool) -> (a -> a) -> (a -> m ()) -> m () > > loopFromTo :: (Eq a, Enum a) => a -> a -> b -> (b -> a -> b) -> b > loopFromTo start stop = loop start (stop ==) succ > > loopNumFromTo :: (Eq a, Num a) => a -> a -> b -> (b -> a -> b) -> b > loopNumFromTo start stop = loop start (stop ==) (1+) > > loopFromToM :: (Eq a, Enum a) => a -> a -> b -> (b -> a -> m b) -> m b > loopFromToM start stop = loopM start (stop ==) succ > > loopNumFromToM :: (Eq a, Num a) => a -> a -> b -> (b -> a -> m b) -> m b > loopNumFromToM start stop = loopM start (stop ==) (1+) > > loopFromToM_ :: (Eq a, Enum a) => a -> a -> (a -> m ()) -> m () > loopFromToM_ start stop = loopM_ start (stop ==) succ > > loopNumFromToM_ :: (Eq a, Num a) => a -> a -> (a -> m ()) -> m () > loopNumFromToM_ start stop = loopM_ start (stop ==) (1+) > > the loopNum* names are pretty arbitrary/crappy, but using the *FromTo, > *M, and *M_ names is far more idiomatic. > From trupill at gmail.com Sun Jul 20 12:45:02 2014 From: trupill at gmail.com (Alejandro Serrano Mena) Date: Sun, 20 Jul 2014 14:45:02 +0200 Subject: [Haskell-cafe] Obtaining kind of a HsType Message-ID: Dear Haskell-caf?, I'm trying to get some information of the kinds of types in a program. In particular, I want to obtain the kinds of arguments to type family instances, that is, given: type family F a b :: Nat type instance F (List k) b = b I would like to obtain the kinds of "k" and "b" in the left-hand side of the type instance. In particular, I'm obtaining type family instance information via LTyFamInstEqn [ http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/HsDecls.html#t:LTyFamInstEqn]. Inside, I get a list of binders of type HsWithBndrs [LHsType name]. I'm assuming each of the LHsTypes inside is a pattern in the type family instance. Thus, I'm looking at those elements and try to find their kind there. Thus, the specific question is: given a HsType, can I obtain its kind somehow? Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at nand.wakku.to Sun Jul 20 13:57:08 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Sun, 20 Jul 2014 15:57:08 +0200 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: <53CB467C.3070802@fecrd.cujae.edu.cu> References: <53C735BB.6040807@fecrd.cujae.edu.cu> <20140717083236.GB20051@nanodesu.localdomain> <53CB467C.3070802@fecrd.cujae.edu.cu> Message-ID: <20140720155708.GD6863@nanodesu.localdomain> On Sun, 20 Jul 2014 00:33:00 -0400, Leza Morais Lutonda wrote: > Thanks for the explanation, Niklas, now I understand (I'm understanding) > type families and I left with: > > class (Signal s, > ComplexSignal (ComplexSignalType s), > RealSignalType (ComplexSignalType s) ~ s) ? Complexable s where > > type ComplexSignalType s > > class (Complexable s) ? FourierTransformable s where > fft ? ? csx. (csx ~ ComplexSignalType s, ComplexSignal csx) ? csx ? csx > > > Maybe more complex than normal? > > Thanks again. Hmm, to be honest I'm not sure if this is effectively any different from what you had in your original example. Does this work as expected w.r.t type inferencing and instance selection? From roma at ro-che.info Sun Jul 20 14:59:49 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Sun, 20 Jul 2014 17:59:49 +0300 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: Message-ID: <20140720145949.GA24120@sniper> * Henk-Jan van Tuyl [2014-07-20 13:10:31+0200] > On Sun, 20 Jul 2014 00:17:41 +0200, Johan Larson > wrote: > > >Obviously this is a very fuzzy question. But what's the credible range > >of answers? > > The tags page of stackoverflow[0] says (when hovering over the rectangle > with the word Haskell) that there are 5.6k followers. Of course, there is > no guarantee that the followers are Haskell programmers, and it is certain > that not all Haskell programmers are followers (I am a Haskell programmer, > but not a follower). Other numbers: * 16k reddit.com/r/haskell followers * 2k registered users at haskellers.com * 30k linkedin profiles are found for the "Haskell" query, presumably because people mention Haskell as their skill (the same caveats apply). Thus my feeling is that the number of people who are interested in Haskell and know some basics falls within 10k-100k range; the number of people who use Haskell professionally (including academy and industry) is probably between 1k and 10k. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From mail at joachim-breitner.de Sun Jul 20 16:05:28 2014 From: mail at joachim-breitner.de (Joachim Breitner) Date: Sun, 20 Jul 2014 18:05:28 +0200 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: <20140720145949.GA24120@sniper> References: <20140720145949.GA24120@sniper> Message-ID: <1405872328.13230.5.camel@joachim-breitner.de> Hi, more numbers: Of the roughly 150k machines taking part in the Debian popularity contest, 4936 (3%) have GHC installed, and but only 898 (0.5% ) use it: https://qa.debian.org/popcon.php?package=ghc And that might include some xmonad users that you wouldn?t necessary consider Haskell programmers. Greetings, Joachim -- Joachim ?nomeata? Breitner mail at joachim-breitner.de ? http://www.joachim-breitner.de/ Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From eir at cis.upenn.edu Sun Jul 20 16:17:19 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Sun, 20 Jul 2014 12:17:19 -0400 Subject: [Haskell-cafe] Obtaining kind of a HsType In-Reply-To: References: Message-ID: <1238E3BE-5035-4AAF-9076-3FBDD0DB3C8A@cis.upenn.edu> Hi Alejandro, It sounds like you want tc_infer_lhs_type from TcHsType. This function is not exported, but you can look around at other functions in that module to see if there's an exported one that serves your needs. You may need to convert the HsType to a Type (Type is the same as TcType, roughly) and then call typeKind. I hope this helps! Richard On Jul 20, 2014, at 8:45 AM, Alejandro Serrano Mena wrote: > Dear Haskell-caf?, > I'm trying to get some information of the kinds of types in a program. In particular, I want to obtain the kinds of arguments to type family instances, that is, given: > > type family F a b :: Nat > type instance F (List k) b = b > > I would like to obtain the kinds of "k" and "b" in the left-hand side of the type instance. > > In particular, I'm obtaining type family instance information via LTyFamInstEqn [http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/HsDecls.html#t:LTyFamInstEqn]. Inside, I get a list of binders of type HsWithBndrs [LHsType name]. I'm assuming each of the LHsTypes inside is a pattern in the type family instance. Thus, I'm looking at those elements and try to find their kind there. > > Thus, the specific question is: given a HsType, can I obtain its kind somehow? > > Thanks in advance > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From trupill at gmail.com Sun Jul 20 17:51:50 2014 From: trupill at gmail.com (Alejandro Serrano Mena) Date: Sun, 20 Jul 2014 19:51:50 +0200 Subject: [Haskell-cafe] Obtaining kind of a HsType In-Reply-To: <1238E3BE-5035-4AAF-9076-3FBDD0DB3C8A@cis.upenn.edu> References: <1238E3BE-5035-4AAF-9076-3FBDD0DB3C8A@cis.upenn.edu> Message-ID: Is it very difficult to convert from HsType to Type? Thanks for the information! 2014-07-20 18:17 GMT+02:00 Richard Eisenberg : > Hi Alejandro, > > It sounds like you want tc_infer_lhs_type from TcHsType. This function is > not exported, but you can look around at other functions in that module to > see if there's an exported one that serves your needs. You may need to > convert the HsType to a Type (Type is the same as TcType, roughly) and then > call typeKind. > > I hope this helps! > Richard > > On Jul 20, 2014, at 8:45 AM, Alejandro Serrano Mena > wrote: > > Dear Haskell-caf?, > I'm trying to get some information of the kinds of types in a program. In > particular, I want to obtain the kinds of arguments to type family > instances, that is, given: > > type family F a b :: Nat > type instance F (List k) b = b > > I would like to obtain the kinds of "k" and "b" in the left-hand side of > the type instance. > > In particular, I'm obtaining type family instance information via > LTyFamInstEqn [ > http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/HsDecls.html#t:LTyFamInstEqn]. > Inside, I get a list of binders of type HsWithBndrs [LHsType name]. I'm > assuming each of the LHsTypes inside is a pattern in the type family > instance. Thus, I'm looking at those elements and try to find their kind > there. > > Thus, the specific question is: given a HsType, can I obtain its kind > somehow? > > Thanks in advance > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Sun Jul 20 17:53:38 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Sun, 20 Jul 2014 13:53:38 -0400 Subject: [Haskell-cafe] Obtaining kind of a HsType In-Reply-To: References: <1238E3BE-5035-4AAF-9076-3FBDD0DB3C8A@cis.upenn.edu> Message-ID: On Jul 20, 2014, at 1:51 PM, Alejandro Serrano Mena wrote: > Is it very difficult to convert from HsType to Type? > This is what many of the functions in the TcHsType module do, with slight variations. Look closely in that module, and I think you'll find a solution. Richard > Thanks for the information! > > > 2014-07-20 18:17 GMT+02:00 Richard Eisenberg : > Hi Alejandro, > > It sounds like you want tc_infer_lhs_type from TcHsType. This function is not exported, but you can look around at other functions in that module to see if there's an exported one that serves your needs. You may need to convert the HsType to a Type (Type is the same as TcType, roughly) and then call typeKind. > > I hope this helps! > Richard > > On Jul 20, 2014, at 8:45 AM, Alejandro Serrano Mena wrote: > >> Dear Haskell-caf?, >> I'm trying to get some information of the kinds of types in a program. In particular, I want to obtain the kinds of arguments to type family instances, that is, given: >> >> type family F a b :: Nat >> type instance F (List k) b = b >> >> I would like to obtain the kinds of "k" and "b" in the left-hand side of the type instance. >> >> In particular, I'm obtaining type family instance information via LTyFamInstEqn [http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/HsDecls.html#t:LTyFamInstEqn]. Inside, I get a list of binders of type HsWithBndrs [LHsType name]. I'm assuming each of the LHsTypes inside is a pattern in the type family instance. Thus, I'm looking at those elements and try to find their kind there. >> >> Thus, the specific question is: given a HsType, can I obtain its kind somehow? >> >> Thanks in advance >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at fstaals.net Sun Jul 20 18:00:21 2014 From: frank at fstaals.net (Frank Staals) Date: Sun, 20 Jul 2014 20:00:21 +0200 Subject: [Haskell-cafe] Creating a Point In-Reply-To: <20140720010532.GB4607@nanodesu.localdomain> (Niklas Haas's message of "Sun, 20 Jul 2014 01:05:32 +0200") References: <20140720010532.GB4607@nanodesu.localdomain> Message-ID: Niklas Haas writes: > On Sat, 19 Jul 2014 19:44:46 -0300, Rafael Almeida wrote: >> How could we address this? Can we make a general function, yet retain the >> type safety? I suppose maybe there's something that could be done with TH >> so that we automatically generate those Point2D, Point3D, etc code. I'm not >> sure that would be a nice path to follow, though. > > This can be achieved with only the help of GADTs: > > Small self-plug: I recently started working on a geometry library[1] based on vinyl[2], fixed-vector[3], and GHC's type-level naturals. It uses the ideas like the one sketched by Niklas. It is nowhere near finished (or even usable), and requires pretty much every type-related GHC extension under the sun. But it does allow you to write cool things like: x = SNatField :: SDField 1 y = SNatField :: SDField 2 name = SSymField :: SSField "name" String myPoint :: Point 2 '["name" :~> String] Int myPoint = point $ x =: 1 <+> name =: "myPoint" <+> y =: 100 p :: Point 100 '[] Double p = origin myVector1 :: Vector (ToNat1 3) Int myVector1 = Vector $ V.mk3 1 2 3 -- myPoint1 :: Point 3 '[] Int myPoint1 = fromVector myVector1 If anyone is interested in this let me know :). Regards, [1] https://github.com/noinia/hgeometry [2] http://hackage.haskell.org/package/vinyl [3] http://hackage.haskell.org/package/fixed-vector -- - Frank From ben at groovie.org Sun Jul 20 19:11:52 2014 From: ben at groovie.org (Ben Bangert) Date: Sun, 20 Jul 2014 12:11:52 -0700 Subject: [Haskell-cafe] HTTP/2 implementation? Message-ID: <5F77AD1C-A9F0-493D-A807-C13FBC63B863@groovie.org> Has anyone started a HTTP/2 implementation in Haskell? I see there's a HPACK-08 Haskell implementation, but I haven't seen an actual HTTP/2 impl. I've been looking at starting some work on this and didn't want to replicate effort elsewhere that I may have missed. Cheers, Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From ben at groovie.org Sun Jul 20 21:14:02 2014 From: ben at groovie.org (Ben Bangert) Date: Sun, 20 Jul 2014 14:14:02 -0700 Subject: [Haskell-cafe] Memory consumption issues under heavy network throughput/concurrency loads In-Reply-To: <53C81C5B.8030004@gmail.com> References: <2938DD18-FE07-41E9-9945-D0838B69A753@groovie.org> <212A007B-5E9B-4C2D-BE0D-6DD99744A706@groovie.org> <53C81C5B.8030004@gmail.com> Message-ID: On Jul 17, 2014, at 11:56 AM, Simon Marlow wrote: > You guys seem to be doing a good job of narrowing this down. We know there are issues with fragmentation when using ByteStrings; in the worst case each ByteString can pin up to its size rounded up to 4Kbytes. If you're not keeping old ByteStrings around but are regularly recycling them, then you shouldn't see this problem. I believe we made some improvements (allegedly) in 7.6 to the fragmentation behaviour. > > Do let me know when you've narrowed it down to something you think I should look at. I made a slightly more complex version of the echo server that uses attoparsec to read into a basic datatype here: https://gist.github.com/bbangert/592e3dcc0253f275e9a3 I've been unable to make it leak using the socket handling code Gregory supplied, and its growth bounds seem fine (113Mb for 5k connections each sending 2 pings/sec). As I flesh out the HTTP/2 frame handling (which will result in substantial increases of temporary ByteStrings), I'll see if any fragmentation issues return. Thanks! Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From ekmett at gmail.com Sun Jul 20 22:22:02 2014 From: ekmett at gmail.com (Edward Kmett) Date: Sun, 20 Jul 2014 18:22:02 -0400 Subject: [Haskell-cafe] Q about last&init In-Reply-To: References: Message-ID: Note: all of the options for playing with lists and queues and fingertrees come with trade-offs. Finger trees give you O(log n) appends and random access, O(1) cons/uncons/snoc/unsnoc etc. but _cost you_ infinite lists. Realtime queues give you the O(1) uncons/snoc. There are catenable output restricted deques that can preserve those and can upgrade you to O(1) append, but we've lost unsnoc and random access along the way. Skew binary random access lists give you O(log n) drop and random access and O(1) cons/uncons, but lose the infinite lists, etc. Tarjan and Mihaescu's deque may get you back worst-case bounds on more of the, but we still lose O(log n) random access and infinite lists. Difference lists give you an O(1) append, but alternating between inspection and construction can hit your asymptotics. Lists are used by default because they cleanly extend to the infinite cases, anything more clever necessarily loses some of that power. -Edward On Fri, Jul 18, 2014 at 2:04 AM, Tony Morris wrote: > data SnocList a = SnocList ([a] -> [a]) > > Inserts to the front and end in O(1). > On 17/07/2014 7:47 PM, "??????? ?????" wrote: > >> Thanks, but maybe I badly formulated my question. I'd like to insert >> at the beginning of the list and remove from the tail both in O(1). >> >> >> 2014-07-17 13:39 GMT+04:00 Frerich Raabe : >> > On 2014-07-17 11:35, ??????? ????? wrote: >> >> >> >> I am teaching myself haskell. The first impression is very good. >> >> But phrase "haskell is polynomially reducible" is making me sad :(. >> >> Anyway I am trying to backport my algorithm written in C. The key to >> >> performance is to have ability to remove element from the end of a >> >> list in O(1). >> >> But the original haskell functions last and init are O(n). >> > >> > >> > On viable option might be to adjust the algorithm such that instead of >> > appending to the list, it prepends (which is O(1) in Haskell), i.e. >> > you manage the list in reverse and only actually reverse it to the >> > original order when needed (e.g. when printing). >> > >> > -- >> > Frerich Raabe - raabe at froglogic.com >> > www.froglogic.com - Multi-Platform GUI Testing >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> >> >> -- >> Regards, Marat. >> ? ????????? ?????. >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbwey9 at gmail.com Sun Jul 20 22:43:20 2014 From: gbwey9 at gmail.com (grant) Date: Sun, 20 Jul 2014 18:43:20 -0400 Subject: [Haskell-cafe] applicative question Message-ID: Hi guys, I am trying to simplify some code. A user provides a combination of boolean expressions and for each expression an async task is run until that expression becomes true. The boolean expressions have type (Event e => e -> Bool) eg (PC.availableFlag .&&. "asmith" .== PC.userId) Unfortunately the way I have coded this, the user needs to include the \r -> r ? for each expression, with a unique number indicating the position in the sequence (so I can keep track of the asyncs when restarting after a failure). The 'r' function just wraps the expression in a Concurrently constructor. r :: (forall e.Event e => (e -> Bool) -> Concurrently e) -> Concurrently a Here is a sample expression that someone might provide: expr1 = runit (\r -> (,) <$> r 1 (PC.availableFlag .&&. "asmith" .== PC.userId) <*> r 2 (22 .== SC.signalNumber)) So, is there a way to rewrite or simplify this to avoid having to pass the r + unique Int to each subexpression? Or, is there a different format that I can write this in and then transform to the Concurrently applicative? Here is the runit method: runit expr = runConcurrently (expr (Concurrently . queryToIOAction)) And some more sample queries: expr1 = runit (\r -> r (PC.availableFlag .&&. "asmith" .== PC.userId)) expr2 = runit (\r -> (,) <$> r 1 (PC.availableFlag .&&. "asmith" .== PC.userId) <*> r 2 (22 .== SC.signalNumber)) expr3 = runit (\r -> (\(a b -> Left (a,b)) <$> r 1 (PC.availableFlag .&&. "asmith" .== PC.userId) -- (Event e => e -> Bool) <*> r 2 (2 .== SC.signalNumber)) <|> Right <$> r 3 (1 .== SC.signalNumber)) Thanks for any help! Grant -------------- next part -------------- An HTML attachment was scrubbed... URL: From phil at cnphil.com Mon Jul 21 04:49:13 2014 From: phil at cnphil.com (Phil Xiaojun Hu) Date: Mon, 21 Jul 2014 12:49:13 +0800 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: <1405872328.13230.5.camel@joachim-breitner.de> References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> Message-ID: <20140721044913.GA12968@bento.takau.net> On Sun, Jul 20, 2014 at 06:05:28PM +0200, Joachim Breitner wrote: > Hi, > > more numbers: Of the roughly 150k machines taking part in the Debian > popularity contest, 4936 (3%) have GHC installed, and but only 898 (0.5% > ) use it: https://qa.debian.org/popcon.php?package=ghc > > And that might include some xmonad users that you wouldn?t necessary > consider Haskell programmers. Users of xmonad and pandoc certainly add up to that number. Cabal-install would be a better reference than GHC, with 1467 (0.8%) users have haskell-platform installed: https://qa.debian.org/popcon.php?package=haskell-platform --- Phil Xiaojun Hu -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From mike at izbicki.me Mon Jul 21 05:27:51 2014 From: mike at izbicki.me (Mike Izbicki) Date: Sun, 20 Jul 2014 22:27:51 -0700 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: <20140721044913.GA12968@bento.takau.net> References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: The lens package on hackage has almost 63000 downloads. I think this is probably a good approximation to the number of serious haskell *installations* because even people who don't like lens probably have downloaded packages that depend on it. I suspect that very few serious haskell programmers don't have lens installed. (Packages that ship with the platform, OTOH, won't get counted enough.) Of course, this is not a good approximation for the number of haskell *programmers* because many people will have multiple installs going. For example, I have 4 installations (3 work + my laptop). It's probably best to think of this number as an upper bound. If we assume that haskellers have on average two installations, then we would come up with about 30000 haskellers. On Sun, Jul 20, 2014 at 9:49 PM, Phil Xiaojun Hu wrote: > On Sun, Jul 20, 2014 at 06:05:28PM +0200, Joachim Breitner wrote: >> Hi, >> >> more numbers: Of the roughly 150k machines taking part in the Debian >> popularity contest, 4936 (3%) have GHC installed, and but only 898 (0.5% >> ) use it: https://qa.debian.org/popcon.php?package=ghc >> >> And that might include some xmonad users that you wouldn't necessary >> consider Haskell programmers. > > Users of xmonad and pandoc certainly add up to that number. > Cabal-install would be a better reference than GHC, with 1467 (0.8%) users > have haskell-platform installed: > https://qa.debian.org/popcon.php?package=haskell-platform > > --- > Phil Xiaojun Hu > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From leza.ml at fecrd.cujae.edu.cu Mon Jul 21 06:16:46 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Mon, 21 Jul 2014 02:16:46 -0400 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: <20140720155708.GD6863@nanodesu.localdomain> References: <53C735BB.6040807@fecrd.cujae.edu.cu> <20140717083236.GB20051@nanodesu.localdomain> <53CB467C.3070802@fecrd.cujae.edu.cu> <20140720155708.GD6863@nanodesu.localdomain> Message-ID: <53CCB04E.5010701@fecrd.cujae.edu.cu> On 20/07/14 09:57, Niklas Haas wrote: > Hmm, to be honest I'm not sure if this is effectively any different from > what you had in your original example. > > Does this work as expected w.r.t type inferencing and instance selection? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe Yes, it works as expected, e.g, now I have instances of FourierTrasformable for List [Double] and for HMatrix.Vector Double, and the following works well: > fft (toComplex [1,2,3,4 :: Double]) [10.0 :+ 0.0,(-2.0) :+ 2.0,(-2.0) :+ 0.0,(-2.0) :+ (-2.0)] > fft (toComplex $ vector [1,2,3,4]) fromList [10.0 :+ 0.0,(-2.0) :+ 2.0,(-2.0) :+ 0.0,(-2.0) :+ (-2.0)] I think (if I understand well) this is because the constraints (RealSignalType (ComplexSignalType s) ~ s) in the Complexable class definition and (csx ~ ComplexSignalType s, ComplexSignal csx) in the fft definition makes a one-by-one dependency between s and csx. -- Leza Morais Lutonda, Lemol-C http://lemol.github.io 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From J.Hage at uu.nl Mon Jul 21 06:33:29 2014 From: J.Hage at uu.nl (Jurriaan Hage) Date: Mon, 21 Jul 2014 08:33:29 +0200 Subject: [Haskell-cafe] Cabal question In-Reply-To: References: <34100956-750C-49CF-97F0-F973ADB1E2FA@uu.nl> Message-ID: <5843FF3C-CFC7-48F1-A4F2-638F669E5960@uu.nl> Hello Rogan, Thanks for the info. I was aware of this facility, and my mail was written in the hope that I could avoid it. When you talk of the problem of dependencies below, I suppose (and hope) you do NOT mean that the package I want to compile can only depend on the listed packages, just the Setup.hs code itself. Or am I naive here? best, Jur On 19Jul, 2014, at 17:49, Rogan Creswick wrote: > On Sat, Jul 19, 2014 at 4:33 AM, Jurriaan Hage wrote: > What I still need is a way to run some kind of postprocessing (like running > a Makefile) after installation (as it happens this is for compiling the > libraries that come with Helium). > > You can do this with a custom cabal build type, a non-trivial Setup.hs. Cabal exposes a bunch of 'user hooks' that let you specify functions to be run at various stages of the compilation (such as pre-build, post-install, etc...). > > See the API here for the hooks available: > - http://www.haskell.org/ghc/docs/7.6.3/html/libraries/Cabal/Distribution-Simple-UserHooks.html > > I use prebuild hooks quite a lot to pre-process GF files (for the grammatical framework); one relatively simple example is shown in my gfI8N package: https://github.com/creswick/gfI8N > > Note that the cabal file uses `build-type: Custom` (which causes cabal to actually use the Setup.hs). > > The relevant part of the Setup.hs is: > > import Distribution.Simple > import Distribution.Simple.Program.Types > import Distribution.Simple.Setup > import Distribution.Simple.UserHooks > import Distribution.Simple.Utils ( rawSystemExit, warn, debug > , findProgramVersion, notice ) > import Distribution.Verbosity ( Verbosity ) > > main = do > defaultMainWithHooks simpleUserHooks > { preBuild = \a b -> generatePGF a b >> preBuild simpleUserHooks a b > , preClean = \a b -> preClean simpleUserHooks a b > } > > That should be enough to get you going -- now some cautions, and a minor rant ;) > > Working with these hooks has lead me to /really/ want a way to express dependencies for Setup.hs files. You *can not* use any hackage libraries in the definitions of these hooks and retain a portable build, because there is no way to indicate that the Setup.hs depends on such things. It used to be the case that you could assume that the dependencies of your library / executable would be visible, but with sandboxed builds that assumption is no longer valid. There's a cabal ticket for this feature here: https://github.com/haskell/cabal/issues/948 > > You should be able to rely on these packages (which shipped with ghc -- the versions will depend on the ghc version installed): > Cabal-1.16.0 > array-0.4.0.1 > base-4.6.0.1 > bin-package-db-0.0.0.0 > binary-0.5.1.1 > bytestring-0.10.0.2 > containers-0.5.0.0 > deepseq-1.3.0.1 > directory-1.2.0.1 > filepath-1.3.0.1 > ghc-7.6.3 > ghc-prim-0.3.0.0 > haskell2010-1.1.1.0 > haskell98-2.0.0.2 > hoopl-3.9.0.0 > hpc-0.6.0.0 > integer-gmp-0.5.0.0 > old-locale-1.0.0.5 > old-time-1.1.0.1 > pretty-1.1.1.0 > process-1.1.0.2 > rts-1.0 > template-haskell-2.8.0.0 > time-1.4.0.1 > > --Rogan > > Does anyone know here whether that is supported > and how, without having to resort to build-types like Make that for I actually > want to avoid? > > best, > Jur > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From lambda.fairy at gmail.com Mon Jul 21 07:41:26 2014 From: lambda.fairy at gmail.com (Chris Wong) Date: Mon, 21 Jul 2014 19:41:26 +1200 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: > Of course, this is not a good approximation for the number of haskell > *programmers* because many people will have multiple installs going. > For example, I have 4 installations (3 work + my laptop). It's > probably best to think of this number as an upper bound. Also, services like Travis will download a fresh set of dependencies on every commit. From J.Hage at uu.nl Mon Jul 21 13:16:24 2014 From: J.Hage at uu.nl (Jurriaan Hage) Date: Mon, 21 Jul 2014 15:16:24 +0200 Subject: [Haskell-cafe] Another Cabal question Message-ID: <52D325CE-B26B-4A7D-8F66-B1642DC23BE9@uu.nl> Dear all, I have another issue: I have a Cabal package (call it A) that runtime depends on another (say B), where B provides (only) an executable that is compiled with the Make build-type. Now, I would like to list B under the build-depends of A (since there is no way to specify having just a run-time dependency), but it seems that when I cabal install B the package is not registered (although the executable does in fact become available to use within the standard directory.) So when I then compile A with Cabal it will complain the package is not registered. Does anyone know whether the behaviour for B is normal, or whether this is a bug of some kind? If the former, what is an easy and clean way of dealing with this situation. best, Jur From ezyang at mit.edu Mon Jul 21 13:33:50 2014 From: ezyang at mit.edu (Edward Z. Yang) Date: Mon, 21 Jul 2014 14:33:50 +0100 Subject: [Haskell-cafe] Another Cabal question In-Reply-To: <52D325CE-B26B-4A7D-8F66-B1642DC23BE9@uu.nl> References: <52D325CE-B26B-4A7D-8F66-B1642DC23BE9@uu.nl> Message-ID: <1405949512-sup-1698@sabre> Hello Jurriaan, Cabal is unable to handle this sort of dependency. Something almost close to what you want is might be 'build-tools', however. Edward Excerpts from Jurriaan Hage's message of 2014-07-21 14:16:24 +0100: > Dear all, > > I have another issue: > I have a Cabal package (call it A) that runtime depends on another (say B), where > B provides (only) an executable that is compiled with the Make build-type. > > Now, I would like to list B under the build-depends of A (since there is no > way to specify having just a run-time dependency), but it seems that > when I cabal install B the package is not registered (although the executable > does in fact become available to use within the standard directory.) > So when I then compile A with Cabal it will complain the package is not registered. > > Does anyone know whether the behaviour for B is normal, or whether this is a bug > of some kind? If the former, what is an easy and clean way of dealing with this situation. > > best, > Jur > From vlatko.basic at gmail.com Mon Jul 21 14:12:09 2014 From: vlatko.basic at gmail.com (Vlatko Basic) Date: Mon, 21 Jul 2014 16:12:09 +0200 Subject: [Haskell-cafe] Another Cabal question In-Reply-To: <52D325CE-B26B-4A7D-8F66-B1642DC23BE9@uu.nl> References: <52D325CE-B26B-4A7D-8F66-B1642DC23BE9@uu.nl> Message-ID: <53CD1FB9.4000701@gmail.com> Hi Jurriaan, not quite sure I understand what you need, but if B.cabal file does not have a Library section, there is nothing to register. It is only executable. If you have sources of both packages and you're using sandboxing for A, than inside the package A directory you can do: cabal sandbox add-source path/package_B so cabal should use source files from B to compile A. (Not sure if you should add the Library section in B for compilig A.) Best regards, vlatko -------- Original Message -------- Subject: [Haskell-cafe] Another Cabal question From: Jurriaan Hage To: haskell-cafe Date: 21.07.2014 15:16 > Dear all, > > I have another issue: > I have a Cabal package (call it A) that runtime depends on another (say B), where > B provides (only) an executable that is compiled with the Make build-type. > > Now, I would like to list B under the build-depends of A (since there is no > way to specify having just a run-time dependency), but it seems that > when I cabal install B the package is not registered (although the executable > does in fact become available to use within the standard directory.) > So when I then compile A with Cabal it will complain the package is not registered. > > Does anyone know whether the behaviour for B is normal, or whether this is a bug > of some kind? If the former, what is an easy and clean way of dealing with this situation. > > best, > Jur > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From creswick at gmail.com Mon Jul 21 14:49:25 2014 From: creswick at gmail.com (Rogan Creswick) Date: Mon, 21 Jul 2014 07:49:25 -0700 Subject: [Haskell-cafe] Cabal question In-Reply-To: <5843FF3C-CFC7-48F1-A4F2-638F669E5960@uu.nl> References: <34100956-750C-49CF-97F0-F973ADB1E2FA@uu.nl> <5843FF3C-CFC7-48F1-A4F2-638F669E5960@uu.nl> Message-ID: On Sun, Jul 20, 2014 at 11:33 PM, Jurriaan Hage wrote: > Hello Rogan, > > Thanks for the info. > I was aware of this facility, and my mail was written in the hope that I > could avoid it. > Ah, I misunderstood your email (I thought you were just trying to avoid 'Make'). I don't know of any other "clean" way to do what you're looking for, but it shouldn't be too difficult to do with build-type: Custom. When you talk of the problem of dependencies below, I suppose (and hope) > you do NOT mean > that the package I want to compile can only depend on the listed packages, > just the Setup.hs code itself. Or am I naive here? > You are correct. The package dependencies behave as normal, only the code in Setup.hs is limited by the dependencies issue. --Rogan > > best, > Jur > > On 19Jul, 2014, at 17:49, Rogan Creswick wrote: > > > On Sat, Jul 19, 2014 at 4:33 AM, Jurriaan Hage wrote: > > What I still need is a way to run some kind of postprocessing (like > running > > a Makefile) after installation (as it happens this is for compiling the > > libraries that come with Helium). > > > > You can do this with a custom cabal build type, a non-trivial Setup.hs. > Cabal exposes a bunch of 'user hooks' that let you specify functions to be > run at various stages of the compilation (such as pre-build, post-install, > etc...). > > > > See the API here for the hooks available: > > - > http://www.haskell.org/ghc/docs/7.6.3/html/libraries/Cabal/Distribution-Simple-UserHooks.html > > > > I use prebuild hooks quite a lot to pre-process GF files (for the > grammatical framework); one relatively simple example is shown in my gfI8N > package: https://github.com/creswick/gfI8N > > > > Note that the cabal file uses `build-type: Custom` (which causes cabal > to actually use the Setup.hs). > > > > The relevant part of the Setup.hs is: > > > > import Distribution.Simple > > import Distribution.Simple.Program.Types > > import Distribution.Simple.Setup > > import Distribution.Simple.UserHooks > > import Distribution.Simple.Utils ( rawSystemExit, warn, debug > > , findProgramVersion, notice ) > > import Distribution.Verbosity ( Verbosity ) > > > > main = do > > defaultMainWithHooks simpleUserHooks > > { preBuild = \a b -> generatePGF a b >> preBuild simpleUserHooks > a b > > , preClean = \a b -> preClean simpleUserHooks a b > > } > > > > That should be enough to get you going -- now some cautions, and a minor > rant ;) > > > > Working with these hooks has lead me to /really/ want a way to express > dependencies for Setup.hs files. You *can not* use any hackage libraries > in the definitions of these hooks and retain a portable build, because > there is no way to indicate that the Setup.hs depends on such things. It > used to be the case that you could assume that the dependencies of your > library / executable would be visible, but with sandboxed builds that > assumption is no longer valid. There's a cabal ticket for this feature > here: https://github.com/haskell/cabal/issues/948 > > > > You should be able to rely on these packages (which shipped with ghc -- > the versions will depend on the ghc version installed): > > Cabal-1.16.0 > > array-0.4.0.1 > > base-4.6.0.1 > > bin-package-db-0.0.0.0 > > binary-0.5.1.1 > > bytestring-0.10.0.2 > > containers-0.5.0.0 > > deepseq-1.3.0.1 > > directory-1.2.0.1 > > filepath-1.3.0.1 > > ghc-7.6.3 > > ghc-prim-0.3.0.0 > > haskell2010-1.1.1.0 > > haskell98-2.0.0.2 > > hoopl-3.9.0.0 > > hpc-0.6.0.0 > > integer-gmp-0.5.0.0 > > old-locale-1.0.0.5 > > old-time-1.1.0.1 > > pretty-1.1.1.0 > > process-1.1.0.2 > > rts-1.0 > > template-haskell-2.8.0.0 > > time-1.4.0.1 > > > > --Rogan > > > > Does anyone know here whether that is supported > > and how, without having to resort to build-types like Make that for I > actually > > want to avoid? > > > > best, > > Jur > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jgbailey at gmail.com Mon Jul 21 16:02:56 2014 From: jgbailey at gmail.com (Justin Bailey) Date: Mon, 21 Jul 2014 09:02:56 -0700 Subject: [Haskell-cafe] Extensible Effects & Multiple Operations In-Reply-To: <53C84EEB.8050504@ibotty.net> References: <53C84EEB.8050504@ibotty.net> Message-ID: On Thu, Jul 17, 2014 at 3:32 PM, Tobias Florek wrote: > data OpenFile v = Read (Char -> v) > | EOF (Bool -> v) > deriving Typeable > That worked! Removing the type variable (`a`) from `OpenFile` did the trick. I was carrying too much type information around for what I wanted to do (e.g., OpenFile Char and OpenFile Bool). Removing that extra piece of info allowed me to write `runOpenFile` just like I wanted. Thanks! Justin From mike at izbicki.me Mon Jul 21 16:23:52 2014 From: mike at izbicki.me (Mike Izbicki) Date: Mon, 21 Jul 2014 09:23:52 -0700 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: I was assuming hackage's downloads showed unique ips. That seems much more useful at least. If not, the lens method would also be double counting every time someone created a sandbox or upgraded ghc. On Mon, Jul 21, 2014 at 12:41 AM, Chris Wong wrote: >> Of course, this is not a good approximation for the number of haskell >> *programmers* because many people will have multiple installs going. >> For example, I have 4 installations (3 work + my laptop). It's >> probably best to think of this number as an upper bound. > > Also, services like Travis will download a fresh set of dependencies > on every commit. From roma at ro-che.info Mon Jul 21 16:45:19 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Mon, 21 Jul 2014 19:45:19 +0300 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: <20140721164519.GA11642@sniper> cabal caches package tarballs under ~/.cabal/packages/hackage.haskell.org/ * Mike Izbicki [2014-07-21 09:23:52-0700] > I was assuming hackage's downloads showed unique ips. That seems much > more useful at least. If not, the lens method would also be double > counting every time someone created a sandbox or upgraded ghc. > > On Mon, Jul 21, 2014 at 12:41 AM, Chris Wong wrote: > >> Of course, this is not a good approximation for the number of haskell > >> *programmers* because many people will have multiple installs going. > >> For example, I have 4 installations (3 work + my laptop). It's > >> probably best to think of this number as an upper bound. > > > > Also, services like Travis will download a fresh set of dependencies > > on every commit. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From haskell at nand.wakku.to Mon Jul 21 18:52:50 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Mon, 21 Jul 2014 20:52:50 +0200 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: <53CCB04E.5010701@fecrd.cujae.edu.cu> References: <53C735BB.6040807@fecrd.cujae.edu.cu> <20140717083236.GB20051@nanodesu.localdomain> <53CB467C.3070802@fecrd.cujae.edu.cu> <20140720155708.GD6863@nanodesu.localdomain> <53CCB04E.5010701@fecrd.cujae.edu.cu> Message-ID: <20140721205250.GB21926@nanodesu.localdomain> On Mon, 21 Jul 2014 02:16:46 -0400, Leza Morais Lutonda wrote: > Yes, it works as expected, e.g, now I have instances of > FourierTrasformable for List [Double] and for HMatrix.Vector Double, and > the following works well: > > > fft (toComplex [1,2,3,4 :: Double]) > [10.0 :+ 0.0,(-2.0) :+ 2.0,(-2.0) :+ 0.0,(-2.0) :+ (-2.0)] > > fft (toComplex $ vector [1,2,3,4]) > fromList [10.0 :+ 0.0,(-2.0) :+ 2.0,(-2.0) :+ 0.0,(-2.0) :+ (-2.0)] > > > I think (if I understand well) this is because the constraints > (RealSignalType (ComplexSignalType s) ~ s) in the Complexable class > definition and (csx ~ ComplexSignalType s, ComplexSignal csx) in the fft > definition makes a one-by-one dependency between s and csx. I think you may be right. I missed the changes to the ComplexSignal class in between this and your original edit, I was just fixated on the fact that your new ?fft? definition looked nearly identical to your first. You can drop the forall csx. bit, for what it's worth, since csx is an unbound variable either way (and hence implicitly quantified). From korczis at gmail.com Mon Jul 21 19:01:58 2014 From: korczis at gmail.com (Tomas Korcak) Date: Mon, 21 Jul 2014 12:01:58 -0700 Subject: [Haskell-cafe] GHCI on ARM (Nvidia Jetson TK1) Message-ID: Hi There, I would like to ask you what is the situation with ghci on arm. I bought Jetson TK1 and I am really sad that ghci does not works there. I have found mentioned somewhere that this should be fixed in 7.4.2 but still it is not. Can somebody clarify what is the situation at the moment and what are further plans? Best regards, T. -- This e-mail is intended for the named recipient(s). It may contain privileged and/or confidential information. If you are not one of the intended recipients, please notify the sender immediately and destroy this e-mail and attachment(s): you must not copy, distribute, retain or take any action in reliance upon the email or attachment(s). While all reasonable efforts are made to safeguard inbound and outbound e-mails, Tomas Korcak cannot guarantee that attachments are virus-free or are compatible with your systems, and does not accept liability in respect of viruses or computer problems experienced. Thank you. Your Skills In Reading Have Improved +1 Some days you're the dog; some days you're the hydrant. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Mon Jul 21 19:39:08 2014 From: vogt.adam at gmail.com (adam vogt) Date: Mon, 21 Jul 2014 15:39:08 -0400 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: <20140721205250.GB21926@nanodesu.localdomain> References: <53C735BB.6040807@fecrd.cujae.edu.cu> <20140717083236.GB20051@nanodesu.localdomain> <53CB467C.3070802@fecrd.cujae.edu.cu> <20140720155708.GD6863@nanodesu.localdomain> <53CCB04E.5010701@fecrd.cujae.edu.cu> <20140721205250.GB21926@nanodesu.localdomain> Message-ID: On Mon, Jul 21, 2014 at 2:52 PM, Niklas Haas wrote: > You can drop the forall csx. bit, for what it's worth, since csx is an > unbound variable either way (and hence implicitly quantified). Also, the "ComplexSignal csx" constraint is redundant, since the Complexable superclass constraint includes it. In other words, you can write: class (Complexable s) ? FourierTransformable s where fft :: (csx ~ ComplexSignalType s) ? csx ? csx From haskell at nand.wakku.to Mon Jul 21 20:09:56 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Mon, 21 Jul 2014 22:09:56 +0200 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: References: <53C735BB.6040807@fecrd.cujae.edu.cu> <20140717083236.GB20051@nanodesu.localdomain> <53CB467C.3070802@fecrd.cujae.edu.cu> <20140720155708.GD6863@nanodesu.localdomain> <53CCB04E.5010701@fecrd.cujae.edu.cu> <20140721205250.GB21926@nanodesu.localdomain> Message-ID: <20140721220956.GB24310@nanodesu.localdomain> On Mon, 21 Jul 2014 15:39:08 -0400, adam vogt wrote: > Also, the "ComplexSignal csx" constraint is redundant, since the > Complexable superclass constraint includes it. In other words, you can > write: > > class (Complexable s) ? FourierTransformable s where > fft :: (csx ~ ComplexSignalType s) ? csx ? csx In fact, this type should now even be equivalent to: class Complexable s => FourierTransformable s where fft :: ComplexSignalType s -> ComplexSignalType s From leza.ml at fecrd.cujae.edu.cu Mon Jul 21 20:56:20 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Mon, 21 Jul 2014 16:56:20 -0400 Subject: [Haskell-cafe] Problems with type family in a class In-Reply-To: <20140721220956.GB24310@nanodesu.localdomain> References: <53C735BB.6040807@fecrd.cujae.edu.cu> <20140717083236.GB20051@nanodesu.localdomain> <53CB467C.3070802@fecrd.cujae.edu.cu> <20140720155708.GD6863@nanodesu.localdomain> <53CCB04E.5010701@fecrd.cujae.edu.cu> <20140721205250.GB21926@nanodesu.localdomain> <20140721220956.GB24310@nanodesu.localdomain> Message-ID: <53CD7E74.60707@fecrd.cujae.edu.cu> On 21/07/14 16:09, Niklas Haas wrote: > On Mon, 21 Jul 2014 15:39:08 -0400, adam vogt wrote: >> Also, the "ComplexSignal csx" constraint is redundant, since the >> Complexable superclass constraint includes it. In other words, you can >> write: >> >> class (Complexable s) ? FourierTransformable s where >> fft :: (csx ~ ComplexSignalType s) ? csx ? csx > In fact, this type should now even be equivalent to: > > class Complexable s => FourierTransformable s where > fft :: ComplexSignalType s -> ComplexSignalType s > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe Yes, it was redundant, and now it looks better. Thanks! -- Leza Morais Lutonda, Lemol-C http://lemol.github.io 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From leza.ml at fecrd.cujae.edu.cu Mon Jul 21 21:29:38 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Mon, 21 Jul 2014 17:29:38 -0400 Subject: [Haskell-cafe] OverlappingInstances-extension-like for type families Message-ID: <53CD8642.2050908@fecrd.cujae.edu.cu> Hello haskell-caf?, I just started working with type families, and come with some difficulties. Now I have a class: class (...) ? Complexable s where type ComplexSignalType s ... Is there a possibility to have this two instances (in any way)? instance (RealFloat e) ? Complexable [e] where type ComplexSignalType [e] = [? e] instance (RealFloat e) ? Complexable [? e] where type ComplexSignalType [? e] = [? e] Thanks. -- Leza Morais Lutonda, Lemol-C http://lemol.github.io 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From elliot.robinson at argiopetech.com Mon Jul 21 22:16:10 2014 From: elliot.robinson at argiopetech.com (Elliot Robinson) Date: Mon, 21 Jul 2014 18:16:10 -0400 Subject: [Haskell-cafe] GHCI on ARM (Nvidia Jetson TK1) In-Reply-To: References: Message-ID: I've had good success with Fedora 19 and GHC 7.6 on the ODROID. I don't recall any problems with GHCI. 7.4.2 is over 2 years old now. I recommend checking out something newer (7.8.3 being the most recent release). --- Elliot Robinson Phone: (321) 252-9660 Site: www.argiopetech.com Email: elliot.robinson at argiopetech.com PGP Fingerprint: 0xD1E72E6A9D0610FFBBF838A6FFB5205A9FEDE59A -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jul 21 22:24:18 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 21 Jul 2014 23:24:18 +0100 Subject: [Haskell-cafe] What is the state of the art in testing code generation? In-Reply-To: <20140715102652.F3C93C3842@www1.g3.pair.com> References: <20140715102652.F3C93C3842@www1.g3.pair.com> Message-ID: <20140721222418.GI1589@henry> On Tue, Jul 15, 2014 at 06:26:52AM -0400, oleg at okmij.org wrote: > Tom Ellis wrote: > > The first impediment to using QuickCheck is that my EDSL is typed. I don't > > know how to generate random terms in the presence of types. > > First I should point out Magic Haskeller (which generates typed > (Haskell) terms and then accepts those that satisfy the given > input-output relationship). > http://nautilus.cs.miyazaki-u.ac.jp/~skata/MagicHaskeller.html > It is MagicHaskeller on Hackage. This is very cool! > The most straightforward method is to generate random terms and filter > well-typed ones. This is usually a bad method since many or most > randomly generated terms will be ill-typed. One should generate > well-typed terms from the beginning, without any rejections. That is > actually not difficult: one merely needs to take the type checker > (which one has to write anyway) and run it backwards. Perhaps it is > not as simple as I made it sound, depending on the type system (for > example, the type inference for simply-typed lambda-calculus without > any annotations requires guessing. One has to guess correctly all the > type, otherwise the process becomes slow). It has been done, in a > mainstream functional language: OCaml. The code can be re-written for > Haskell using the tricks for non-determinism with sharing (the Share > monad). Due to many deadlines I cannot re-write myself, not until the > middle of the next week. Also, I don't know your type system. My type system is not especially complicated, so I imagine I will be able to build terms of arbitrary type straightforwardly without resorting to rejection sampling. However, this is not my main concern with the type system. I have an AST only some of whose terms are well typed, but I have a Haskell "front end" to this AST and using Haskell's type system I ensure that I only create well-typed terms of the AST. A fairly dumb example (not of my EDSL, but probably easier to understand than mine) might be like the following: f :: Func MyInt MyBool g :: Func MyBool MyDouble compose :: Func b c -> Func a b -> Func a c g `compose` f :: Func MyInt MyDouble and the last term would result in something like Lam "x" (Ap "g" (Ap "f" "x")) It's Haskell-typed terms like 'g `compose` f' that I don't know how to generate programatically, and the fact that they all have different types seems to be the problem. Tom From ben at smart-cactus.org Mon Jul 21 22:46:23 2014 From: ben at smart-cactus.org (Ben Gamari) Date: Mon, 21 Jul 2014 18:46:23 -0400 Subject: [Haskell-cafe] GHCI on ARM (Nvidia Jetson TK1) In-Reply-To: References: Message-ID: <87zjg2ib40.fsf@gmail.com> Tomas Korcak writes: > Hi There, > I would like to ask you what is the situation with ghci on arm. > GHCi should be functional. As of 7.6.3 (IIRC) the GHC runtime linker has had support for ARM, although it is known to be buggy in some cases. More recently there has been a push to move towards dynamic linking by default. This removes GHC's runtime linker from the equation although introduces some difficulties of its own (mostly due to bugs in binutil's linker [1). A few months back I wrote down some notes on the current state of GHC on ARM [2]. This might answer some of your questions. Cheers, - Ben [1] https://sourceware.org/bugzilla/show_bug.cgi?id=16177 [2] http://bgamari.github.io/posts/2014-03-06-compiling-ghc-7.8-on-arm.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From liuxinyu95 at gmail.com Tue Jul 22 03:01:10 2014 From: liuxinyu95 at gmail.com (Xinyu LIU) Date: Tue, 22 Jul 2014 11:01:10 +0800 Subject: [Haskell-cafe] Elementary algorithms - (Haskell language is used) Message-ID: Hi, I spent 6 years to write the book ?Elementary Algorithms?. I finally completed it yesterday. This book is open and free, the PDF version can be downloaded from: https://github.com/liuxinyu95/AlgoXY/blob/algoxy/preview/elementary-algorithms.pdf?raw=true Why There are plenty of books about algorithms, such as ?Introduction to algorithms?, ?The art of computer programming?, ?structure and interpretation of computer programs?? why another book? Is it reinvention of wheel? This book can?t compare with the above classic bibles at all. It has some features like: 1. All algorithms are described in math formulas and pseudo codes. I hope it bring some taste of elegant by using algebraic symbols. 2. All algorithms are realized in both purely functional and imperative approaches. 3. The examples are provided in multiple programming languages, including C, Haskell, Python, C++, Scheme/Lisp. Haskell is the main language for all functional implementations. Content The following content are covered in this book (in the order of appearance) ? Binary search tree, insertion sort, red-black tree, AVL tree, Trie, Patricia, suffix tree, B-tree; ? Binary heap, Leftist heap, skew heap, splay heap, selection sort, binomial heap, Fibonacci heap, pairing heap; ? Queue, Finger tree based sequence, quick sort, merge sort, binary search, saddle-back search, KMP, Boyer-Moore, DFS, BFS, Greedy algorithm, Dynamic programming. There are two books influenced me most, one is ?Purely functional data structure? by Chris Okasaki, the other is ?Introduction to algorithms?. Problems I always don?t have enough time in writing this book during the past 6 years. I am not a native speaker, the biggest problem is about English. It is lack of proof reading by native speakers. I used some result directly, if I had time, I should add more proof for those results. Future work Ideally, I think a serious algorithm book should be written in a stable environment. I planned to write this book in 10 years. But everything changes so fast in modern society. I experienced lay-offs once in 2012 due to Symbian business cut off, and now again in MS. I am not sure if I can continue this work. I think the best way is to open this book to the community. Some future work in my mind: ? Proof reading and review ? Provide answers to the exercises ? Provide proof for the directly referenced result The whole manuscript is available at github: https://github.com/liuxinyu95/AlgoXY Best regards -- Larry, LIU Xinyu https://sites.google.com/site/algoxy/ https://github.com/liuxinyu95/AlgoXY *e*^(*?*i)+1 = 0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Tue Jul 22 03:02:53 2014 From: vogt.adam at gmail.com (adam vogt) Date: Mon, 21 Jul 2014 23:02:53 -0400 Subject: [Haskell-cafe] OverlappingInstances-extension-like for type families In-Reply-To: <53CD8642.2050908@fecrd.cujae.edu.cu> References: <53CD8642.2050908@fecrd.cujae.edu.cu> Message-ID: Hi Leza, You can make a closed type family (not associated with the class as you have): type family ComplexSignalType e where ComplexSignalType [C e] = [C e] ComplexSignalType [e] = [C e] But then you pretty much have to define all instances in the same module. If you instead use functional dependencies (FDs): class Complexable s cs | s -> cs instance Complexable [e] [C e] instance Complexable [C e] [C e] you can put these instances in separate modules. But the disadvantage is that you have to deal with more type variables. Regards, Adam On Mon, Jul 21, 2014 at 5:29 PM, Leza Morais Lutonda wrote: > > Hello haskell-caf?, > > I just started working with type families, and come with some difficulties. > Now I have a class: > > class (...) ? Complexable s where > type ComplexSignalType s > ... > > Is there a possibility to have this two instances (in any way)? > > instance (RealFloat e) ? Complexable [e] where > type ComplexSignalType [e] = [? e] > > instance (RealFloat e) ? Complexable [? e] where > type ComplexSignalType [? e] = [? e] > > > Thanks. > -- > Leza Morais Lutonda, Lemol-C > http://lemol.github.io > > > > 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 > http://cujae.edu.cu > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From leza.ml at fecrd.cujae.edu.cu Tue Jul 22 04:40:14 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Tue, 22 Jul 2014 00:40:14 -0400 Subject: [Haskell-cafe] OverlappingInstances-extension-like for type families In-Reply-To: References: <53CD8642.2050908@fecrd.cujae.edu.cu> Message-ID: <53CDEB2E.3060202@fecrd.cujae.edu.cu> On 21/07/14 23:02, adam vogt wrote: > If you instead use functional dependencies (FDs): > > class Complexable s cs | s -> cs > instance Complexable [e] [C e] > instance Complexable [C e] [C e] > > you can put these instances in separate modules. But the disadvantage > is that you have to deal with more type variables. Hi Adam, Actually, the Complexable class has a superclass, and the definition has a constraint like this: class (Signal s, ComplexSignal (ComplexSignalType s)) => Complexable s where type ComplexSignalType s ... Trying to use functional dependencies, I end refactoring the Complexable class to: class (ComplexSignal csx rsx cel rel) ? Complexable csx rsx cel rel | cel ? csx, rel ? rsx, rsx ? csx But these instances still conflicting: instance (RealFloat e) ? Complexable [? e] [e] (? e) e instance (RealFloat e) ? Complexable [? e] [? e] (? e) (? e) Thanks. -- Leza Morais Lutonda, Lemol-C http://lemol.github.io 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From tdammers at gmail.com Tue Jul 22 05:55:17 2014 From: tdammers at gmail.com (Tobias Dammers) Date: Tue, 22 Jul 2014 07:55:17 +0200 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: <20140721044913.GA12968@bento.takau.net> References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: Pandoc wouldn't affect popcon though, since it doesn't depend on ghc; it's a binary package, and iirc only depends on libgmp at runtime. On Jul 21, 2014 6:49 AM, "Phil Xiaojun Hu" wrote: > On Sun, Jul 20, 2014 at 06:05:28PM +0200, Joachim Breitner wrote: > > Hi, > > > > more numbers: Of the roughly 150k machines taking part in the Debian > > popularity contest, 4936 (3%) have GHC installed, and but only 898 (0.5% > > ) use it: https://qa.debian.org/popcon.php?package=ghc > > > > And that might include some xmonad users that you wouldn?t necessary > > consider Haskell programmers. > > Users of xmonad and pandoc certainly add up to that number. > Cabal-install would be a better reference than GHC, with 1467 (0.8%) users > have haskell-platform installed: > https://qa.debian.org/popcon.php?package=haskell-platform > > --- > Phil Xiaojun Hu > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From noteed at gmail.com Tue Jul 22 06:43:30 2014 From: noteed at gmail.com (Vo Minh Thu) Date: Tue, 22 Jul 2014 08:43:30 +0200 Subject: [Haskell-cafe] HTTP/2 implementation? In-Reply-To: <5F77AD1C-A9F0-493D-A807-C13FBC63B863@groovie.org> References: <5F77AD1C-A9F0-493D-A807-C13FBC63B863@groovie.org> Message-ID: 2014-07-20 21:11 GMT+02:00 Ben Bangert : > Has anyone started a HTTP/2 implementation in Haskell? > > I see there's a HPACK-08 Haskell implementation, but I haven't seen an actual HTTP/2 impl. I've been looking at starting some work on this and didn't want to replicate effort elsewhere that I may have missed. Certainly you have seen this package http://hackage.haskell.org/package/http2 ? That package was uploaded this month and there is a GitHub repository ; you could ask Kazu to join forces. From kazu at iij.ad.jp Tue Jul 22 07:19:37 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Tue, 22 Jul 2014 16:19:37 +0900 (JST) Subject: [Haskell-cafe] HTTP/2 implementation? In-Reply-To: References: <5F77AD1C-A9F0-493D-A807-C13FBC63B863@groovie.org> Message-ID: <20140722.161937.1350826873679140551.kazu@iij.ad.jp> Hi, >> I see there's a HPACK-08 Haskell implementation, but I haven't seen >> an actual HTTP/2 impl. I've been looking at starting some work on >> this and didn't want to replicate effort elsewhere that I may have >> missed. > > Certainly you have seen this package http://hackage.haskell.org/package/http2 ? This package implements HPACK only at this moment. I'm planning to implement HTTP/2 itself soon and integrate it into Warp. HTTP/2 is at the stage of IETF working group last call. The specs are being dynamically changed. For instance, it is just decided to remove referense set from HPACK finally. --Kazu From eir at cis.upenn.edu Tue Jul 22 11:58:33 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Tue, 22 Jul 2014 07:58:33 -0400 Subject: [Haskell-cafe] OverlappingInstances-extension-like for type families In-Reply-To: <53CD8642.2050908@fecrd.cujae.edu.cu> References: <53CD8642.2050908@fecrd.cujae.edu.cu> Message-ID: <268BA835-7856-4BD3-96BE-DDB814382964@cis.upenn.edu> Hi Leza, It's not clear that what you want to do is sound: according to your desired definitions, `ComplexSignalType [C Double]` would be *both* `[C (C Double)]` (from the first type instance) and `[C Double]` (from the second). How do you want to reconcile this? If you want to use the first instance only when the second doesn't match (which is what OverlappingInstances does, as the first is more general than the second), you'll want to use closed type families. If not, then I'm not sure what you want. Here the closed type families approach: type family ComplexSignalType e where ComplexSignalType [C e] = [C e] ComplexSignalType [e] = [C e] Now, the second equation will trigger only when GHC is sure that the first equation won't. I hope this helps! Richard On Jul 21, 2014, at 5:29 PM, Leza Morais Lutonda wrote: > > Hello haskell-caf?, > > I just started working with type families, and come with some difficulties. Now I have a class: > > class (...) ? Complexable s where > type ComplexSignalType s > ... > > Is there a possibility to have this two instances (in any way)? > > instance (RealFloat e) ? Complexable [e] where > type ComplexSignalType [e] = [? e] > > instance (RealFloat e) ? Complexable [? e] where > type ComplexSignalType [? e] = [? e] > > > Thanks. > -- > Leza Morais Lutonda, Lemol-C > http://lemol.github.io > > > > 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From stefan.wehr at gmail.com Tue Jul 22 12:40:04 2014 From: stefan.wehr at gmail.com (Stefan Wehr) Date: Tue, 22 Jul 2014 14:40:04 +0200 Subject: [Haskell-cafe] Call for participation: Haskell tutorial at CUFP on 4 Sep 2014 Message-ID: Dear Haskellers, I'll be giving an advanced Haskell tutorial as part of the CUFP 2014 workshop. * Date/time: 4 Sep 2014, 9:00 AM - 12:30 PM * Place: Gothenburg, Sweden (affiliated with ICFP 2014) * Early registration deadline: 3 Aug 2014! The tutorial teaches important techniques for writing correct, robust, scalable, and fast Haskell programs. The topics covered are: network programming, serialization, persistence, logging, performance, scalability, testing, and concurrency. The tutorial aims at programmers with some Haskell experience. It is not necessary to be an Haskell expert, but you should know how to write functions and data types. For more details, see http://cufp.org/2014/t2-stefan-wehr-haskell-in-the-real-world.html Registration page: https://regmaster4.com/2014conf/ICFP14/register.php Please distribute this call for participation. See you in Gothenburg! Stefan From vogt.adam at gmail.com Tue Jul 22 18:02:08 2014 From: vogt.adam at gmail.com (adam vogt) Date: Tue, 22 Jul 2014 14:02:08 -0400 Subject: [Haskell-cafe] OverlappingInstances-extension-like for type families In-Reply-To: <53CDEB2E.3060202@fecrd.cujae.edu.cu> References: <53CD8642.2050908@fecrd.cujae.edu.cu> <53CDEB2E.3060202@fecrd.cujae.edu.cu> Message-ID: On Tue, Jul 22, 2014 at 12:40 AM, Leza Morais Lutonda wrote: > Trying to use functional dependencies, I end refactoring the Complexable > class to: > > class (ComplexSignal csx rsx cel rel) ? Complexable csx rsx cel rel | cel ? > csx, rel ? rsx, rsx ? csx > > But these instances still conflicting: > > instance (RealFloat e) ? Complexable [? e] [e] (? e) e > instance (RealFloat e) ? Complexable [? e] [? e] (? e) (? e) Hi Leza, I believe those instances are accepted in ghc-7.6. In future ghcs, it looks like there will be an extension that allows them again: https://phabricator.haskell.org/D69 In the meantime you could add another parameter for the 'e': class Complexable csx rsx cel rel e | cel ? csx, rel ? rsx, e rsx ? csx, csx -> e instance (RealFloat e) ? Complexable [C e] [e] (C e) e e instance (RealFloat e) ? Complexable [C e] [C e] (C e) (C e) e Or you could keep the Complexable class as you had it, but write the instances for particular 'e' like: instance Complexable [C Double] [Double] (C Double) Double Regards, Adam From malcolm.wallace at me.com Wed Jul 23 10:57:39 2014 From: malcolm.wallace at me.com (Malcolm Wallace) Date: Wed, 23 Jul 2014 11:57:39 +0100 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: On 21 Jul 2014, at 06:27, Mike Izbicki wrote: > The lens package on hackage has almost 63000 downloads. I think this > is probably a good approximation to the number of serious haskell > *installations* because even people who don't like lens probably have > downloaded packages that depend on it. I suspect that very few > serious haskell programmers don't have lens installed. As with any large commercial organisation, we are not keen on our users each downloading the same software from external sites. We decide which Haskell packages will form part of our blessed install, and re-host them internally. Nevertheless, I can confidently say that none of the official Haskell installations we use at work has the lens package installed. We might not count as "serious" Haskell users though, since we only have about 300 kLoC. (Separately, our own internal Haskell dialect has > 1.5M LoC, but does not use the lens package either - although other forms of lens-like stuff are in heavy use.) I think there are no good proxy metrics for counting programmers, nor even setting upper bounds. There are just too many ways our activity can be hidden or disguised by innocent performance-optimisation, like internal caching. Regards, Malcolm From jan.stolarek at p.lodz.pl Wed Jul 23 11:57:00 2014 From: jan.stolarek at p.lodz.pl (Jan Stolarek) Date: Wed, 23 Jul 2014 13:57:00 +0200 Subject: [Haskell-cafe] Looking for list comprehensions use cases Message-ID: <201407231357.00773.jan.stolarek@p.lodz.pl> Haskellers, recently I've been looking into the possibility of creating some new optimisations for GHC. These would be mostly aimed at list comprehensions. Here's where I need your help: 1. Do you have complex list comprehensions usage examples from real code? By complex I mean nested list comprehensions, reading from more than one list ([ ...| x <- xs, y <- ys ... ]) etc. 2. Do you have list comprehensions code that you had to optimize by hand because GHC was unable to make them fast enough? Janek From johan.g.larson at gmail.com Wed Jul 23 14:49:14 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Wed, 23 Jul 2014 10:49:14 -0400 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: Are there many really large users of Haskell, organizations that are likely to have the sort of shared setups you describe? My impression is that most Haskell adoption has been by fairly small groups, either working independently or going their own way within larger organizations. On Wed, Jul 23, 2014 at 6:57 AM, Malcolm Wallace wrote: > > On 21 Jul 2014, at 06:27, Mike Izbicki wrote: > >> The lens package on hackage has almost 63000 downloads. I think this >> is probably a good approximation to the number of serious haskell >> *installations* because even people who don't like lens probably have >> downloaded packages that depend on it. I suspect that very few >> serious haskell programmers don't have lens installed. > > As with any large commercial organisation, we are not keen on our users each downloading the same software from external sites. We decide which Haskell packages will form part of our blessed install, and re-host them internally. > > Nevertheless, I can confidently say that none of the official Haskell installations we use at work has the lens package installed. We might not count as "serious" Haskell users though, since we only have about 300 kLoC. (Separately, our own internal Haskell dialect has > 1.5M LoC, but does not use the lens package either - although other forms of lens-like stuff are in heavy use.) > > I think there are no good proxy metrics for counting programmers, nor even setting upper bounds. There are just too many ways our activity can be hidden or disguised by innocent performance-optimisation, like internal caching. > > Regards, > Malcolm > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Johan Larson -- Toronto, Canada From tab at snarc.org Wed Jul 23 15:03:07 2014 From: tab at snarc.org (Vincent Hanquez) Date: Wed, 23 Jul 2014 08:03:07 -0700 Subject: [Haskell-cafe] How many Haskell programmers are there? In-Reply-To: References: <20140720145949.GA24120@sniper> <1405872328.13230.5.camel@joachim-breitner.de> <20140721044913.GA12968@bento.takau.net> Message-ID: <53CFCEAB.20709@snarc.org> On 23/07/2014 07:49, Johan Larson wrote: > Are there many really large users of Haskell, organizations that are > likely to have the sort of shared setups you describe? Yes, and many small users also have this setup too. Not only it's useful for caching (for Hackage BW, but also for the users BW), this is very important for security (Hackage is compromised, someone upload a package that contains holes or malware, etc) and reliability (Hackage is down). -- Vincent From trupill at gmail.com Wed Jul 23 18:48:06 2014 From: trupill at gmail.com (Alejandro Serrano Mena) Date: Wed, 23 Jul 2014 20:48:06 +0200 Subject: [Haskell-cafe] Retrieving information about type families Message-ID: Dear Caf?, My quest for obtaining information about type families continues. Now I have a simple question: how should I access the information about "type instance"s via the GHC API? My aim is to do so after type checking, that is, to get that information from a TypecheckedModule. However, I haven't yet been able to touch the right buttons to make it work ;( Thanks in advance, Alejandro -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Wed Jul 23 21:38:54 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Wed, 23 Jul 2014 17:38:54 -0400 Subject: [Haskell-cafe] Retrieving information about type families In-Reply-To: References: Message-ID: <51DC5BD6-6A19-4AB2-8E12-9AFC04A3678C@cis.upenn.edu> Does FamInstEnv.lookupFamInstEnv work for you? You will also probably want FamInst.tcGetFamInstEnvs. Richard On Jul 23, 2014, at 2:48 PM, Alejandro Serrano Mena wrote: > Dear Caf?, > My quest for obtaining information about type families continues. > Now I have a simple question: how should I access the information about "type instance"s via the GHC API? My aim is to do so after type checking, that is, to get that information from a TypecheckedModule. However, I haven't yet been able to touch the right buttons to make it work ;( > > Thanks in advance, > Alejandro > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From leza.ml at fecrd.cujae.edu.cu Wed Jul 23 21:55:17 2014 From: leza.ml at fecrd.cujae.edu.cu (Leza Morais Lutonda) Date: Wed, 23 Jul 2014 17:55:17 -0400 Subject: [Haskell-cafe] OverlappingInstances-extension-like for type families In-Reply-To: References: <53CD8642.2050908@fecrd.cujae.edu.cu> <53CDEB2E.3060202@fecrd.cujae.edu.cu> Message-ID: <53D02F45.8080801@fecrd.cujae.edu.cu> On 22/07/14 14:02, adam vogt wrote: > Hi Leza, > > I believe those instances are accepted in ghc-7.6. In future ghcs, it > looks like there will be an extension that allows them again: > https://phabricator.haskell.org/D69 > > In the meantime you could add another parameter for the 'e': > > class Complexable csx rsx cel rel e | cel ? csx, rel ? rsx, e rsx ? > csx, csx -> e > instance (RealFloat e) ? Complexable [C e] [e] (C e) e e > instance (RealFloat e) ? Complexable [C e] [C e] (C e) (C e) e > > > Or you could keep the Complexable class as you had it, but write the > instances for particular 'e' like: > > instance Complexable [C Double] [Double] (C Double) Double > > > Regards, > Adam > Ok Adam, I read more about this situation with type families and functional dependencies, and hope it will come soon to ghc. Meantime I will stay with type families and not to have these two instances simultaneously. Thanks. -- Leza Morais Lutonda, Lemol-C http://lemol.github.io 50 Aniversario de la Cujae. Inaugurada por Fidel el 2 de diciembre de 1964 http://cujae.edu.cu From haskell at nand.wakku.to Thu Jul 24 00:03:18 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Thu, 24 Jul 2014 02:03:18 +0200 Subject: [Haskell-cafe] Retrieving information about type families In-Reply-To: References: Message-ID: <20140724020318.GB17187@nanodesu.localdomain> On Wed, 23 Jul 2014 20:48:06 +0200, Alejandro Serrano Mena wrote: > Dear Caf?, > My quest for obtaining information about type families continues. > Now I have a simple question: how should I access the information about > "type instance"s via the GHC API? My aim is to do so after type checking, > that is, to get that information from a TypecheckedModule. However, I > haven't yet been able to touch the right buttons to make it work ;( > > Thanks in advance, > Alejandro In Haddock we get this information out of md_fam_insts, which you can get out of ModDetails - we access this from a TypecheckedModule using tm_internals_. I'm not sure if there's a cleaner way, but I couldn't find one and this seems to work. From wojciech.danilo at gmail.com Thu Jul 24 02:26:21 2014 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Thu, 24 Jul 2014 04:26:21 +0200 Subject: [Haskell-cafe] Haskell on JVM (using LLVM backend) Message-ID: Hello! I was recently discussing with some frients possibilities of running Haskell programs on JVM. I belive such possibility could be a breakdown for the popularity of Haskell and could be very interesting for new people and new usage-scenarios. I have seen some topics, like these: http://stackoverflow.com/questions/7261039/haskell-on-jvm http://www.haskell.org/haskellwiki/GHC/FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_the_JVM.3F http://www.haskell.org/pipermail/haskell-cafe/2009-June/063454.html but are a little old and do NOT mention the LLVM backend. If we've got the LLVM backend in GHC right now, why cannot we just use something like LLJVM to convert the LLVMIR into JVM bytecode? I understand that the LLVM bytecode (optained from GHC) has all the optimizations applied (including tail recursion expansion) so it **could** be possible to just run it on JVM? All the best, Wojciech Dani?o -------------- next part -------------- An HTML attachment was scrubbed... URL: From cpa at crans.org Thu Jul 24 02:29:35 2014 From: cpa at crans.org (Charles-Pierre Astolfi) Date: Wed, 23 Jul 2014 22:29:35 -0400 Subject: [Haskell-cafe] Markov Text Generator & Randomness Message-ID: Hi -cafe, I'm coding a Markov Text Generator (of order 1). Basically, you have a source text, and knowing the frequencies of pairs of consecutive words, you generate a somewhat syntactically correct text from this. Here's the link to my code and to a source text you can use as example. test.txt http://lpaste.net/raw/4004174907431714816 code http://lpaste.net/4147715261379641344 The kickers is that this code generates sentences with consecutive words that never appears next to each other in the source text. For example, the code generated "They sat over at because old those the lighted.", but "over at" never occurs in the source text, so it shouldn't occur in a generated sentence. The makeDb function gives is correct, so my problem actually lies in generate and/or in draw. I think there's something about RVar that I messed up, but I don't see the problem. Any ideas? Cheers, -- Charles-Pierre From ben at smart-cactus.org Thu Jul 24 02:39:56 2014 From: ben at smart-cactus.org (Ben Gamari) Date: Wed, 23 Jul 2014 22:39:56 -0400 Subject: [Haskell-cafe] Markov Text Generator & Randomness In-Reply-To: References: Message-ID: <8738driio3.fsf@gmail.com> Charles-Pierre Astolfi writes: > Hi -cafe, > > I'm coding a Markov Text Generator (of order 1). Basically, you have a > source text, and knowing the frequencies of pairs of consecutive > words, you generate a somewhat syntactically correct text from this. > > Here's the link to my code and to a source text you can use as example. > > test.txt > http://lpaste.net/raw/4004174907431714816 > code > http://lpaste.net/4147715261379641344 > > The kickers is that this code generates sentences with consecutive > words that never appears next to each other in the source text. > For example, the code generated "They sat over at because old those > the lighted.", but "over at" never occurs in the source text, so it > shouldn't occur in a generated sentence. > You mean like, "The old man looked from his glass across the square, then over at the waiters." Otherwise my cursory look turned up no bugs. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From erantapaa at gmail.com Thu Jul 24 08:29:03 2014 From: erantapaa at gmail.com (Erik Rantapaa) Date: Thu, 24 Jul 2014 01:29:03 -0700 (PDT) Subject: [Haskell-cafe] determining the origin of imported symbols Message-ID: Hi everyone, I looking for a way to analyze Haskell source to determine which module each imported symbol comes from. My goal is to transform source code like this: import Data.List ... main = do nums <- fmap (map read . words) getLine :: IO [Int] print $ sort nums to code like this: import qualified Prelude as B import qualified Data.List as A ... main = do nums <- B.fmap (B.map B.read B.. B.words) B.getLine :: B.IO [B.Int] B.print B.$ A.sort nums That is, I want to qualify all imported symbols with a module alias. Can anyone suggest modules or programs I should look at? Thanks, ER -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Thu Jul 24 09:11:07 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 24 Jul 2014 12:11:07 +0300 Subject: [Haskell-cafe] determining the origin of imported symbols In-Reply-To: References: Message-ID: <20140724091107.GB1664@sniper> Hi Erik, haskell-names (https://github.com/haskell-suite/haskell-names) will help you here. * Erik Rantapaa [2014-07-24 01:29:03-0700] > Hi everyone, > > I looking for a way to analyze Haskell source to determine which module > each imported symbol comes from. My goal is to transform source code like > this: > > import Data.List > ... > main = do > nums <- fmap (map read . words) getLine :: IO [Int] > print $ sort nums > > to code like this: > > import qualified Prelude as B > import qualified Data.List as A > ... > main = do > nums <- B.fmap (B.map B.read B.. B.words) B.getLine :: B.IO [B.Int] > B.print B.$ A.sort nums > > That is, I want to qualify all imported symbols with a module alias. > > Can anyone suggest modules or programs I should look at? > > Thanks, > ER > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From daniel.trstenjak at gmail.com Thu Jul 24 09:16:56 2014 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Thu, 24 Jul 2014 11:16:56 +0200 Subject: [Haskell-cafe] determining the origin of imported symbols In-Reply-To: References: Message-ID: <20140724091656.GA5037@machine> Hi Erik, > Can anyone suggest modules or programs I should look at? hsimport[1] and especially vim-hsimport[2] might be of help. Greetings, Daniel [1] https://github.com/dan-t/hsimport [2] https://github.com/dan-t/vim-hsimport From cpa at crans.org Thu Jul 24 12:24:33 2014 From: cpa at crans.org (Charles-Pierre Astolfi) Date: Thu, 24 Jul 2014 08:24:33 -0400 Subject: [Haskell-cafe] Markov Text Generator & Randomness In-Reply-To: <8738driio3.fsf@gmail.com> References: <8738driio3.fsf@gmail.com> Message-ID: > "The old man looked from his glass across the square, then over at the waiters." You're embarrassingly right! But then, "those the" definitely never appears, altough it does in my generated text. > Otherwise my cursory look turned up no bugs. Unfortunately there is :( -- Cp From noteed at gmail.com Thu Jul 24 13:20:15 2014 From: noteed at gmail.com (Vo Minh Thu) Date: Thu, 24 Jul 2014 15:20:15 +0200 Subject: [Haskell-cafe] Markov Text Generator & Randomness In-Reply-To: References: <8738driio3.fsf@gmail.com> Message-ID: Just a note: in the first "where" clause in `generate`, you don't need to pass around the `db` variable (it is visible to the "where" clause). I never used that `RVar` monad, but I guess that every time you run `rword` you might get a different result. So in your `go` function, once you have executed `word <- rword`, you should not pass `rword` down the `draw` function, but instead, say, `return word`. 2014-07-24 14:24 GMT+02:00 Charles-Pierre Astolfi : >> "The old man looked from his glass across the square, then over at the waiters." > You're embarrassingly right! But then, "those the" definitely never > appears, altough it does in my generated text. > >> Otherwise my cursory look turned up no bugs. > Unfortunately there is :( > > -- > Cp > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From ben at smart-cactus.org Thu Jul 24 13:55:42 2014 From: ben at smart-cactus.org (Ben Gamari) Date: Thu, 24 Jul 2014 09:55:42 -0400 Subject: [Haskell-cafe] Markov Text Generator & Randomness In-Reply-To: References: <8738driio3.fsf@gmail.com> Message-ID: <87tx66hndt.fsf@gmail.com> Charles-Pierre Astolfi writes: >> "The old man looked from his glass across the square, then over at the waiters." > You're embarrassingly right! But then, "those the" definitely never > appears, altough it does in my generated text. > >> Otherwise my cursory look turned up no bugs. > Unfortunately there is :( > Ahh yes, looking a bit more closely now I have a few points: 1. In `draw`: The first argument is an action which will return a new word. Instead of passing `rword :: RVar Word`, you presumably rather want to pass `word :: Word`. This is likely the cause of your bug. 2. In `draw`: Instead of `weightedSample` which produces a random shuffling of the entire list, you really just want to draw a single word. This is a categorical distribution; use `Data.Random.Categorical.fromList` to construct the distribution and `R.rvar` to draw a variate. Note that you may only want to avoid doing the former more than once as construction of the distribution requires sorting and normalizing. 3. `map (\(x,y)->(y,x))` is just `map swap` where `swap` is provided by `Data.Tuple`. My quick rework of your code can be found here [1]. Cheers, - Ben [1] http://lpaste.net/108025 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From erantapaa at gmail.com Thu Jul 24 17:56:14 2014 From: erantapaa at gmail.com (Erik Rantapaa) Date: Thu, 24 Jul 2014 10:56:14 -0700 (PDT) Subject: [Haskell-cafe] determining the origin of imported symbols In-Reply-To: References: Message-ID: <6134fea8-f8d7-421d-9d00-816577787301@googlegroups.com> Thanks, everyone, for all of the suggestions! On Thursday, July 24, 2014 5:53:59 AM UTC-5, Eyal Lotem wrote: > > There's also ghc's -ddump-minimal-imports which might help you. > > > On Thu, Jul 24, 2014 at 12:06 PM, JP Moresmau > wrote: > >> BuildWrapper doesn't do the transformation, but it resolves all symbols >> to build a usage map, so it would tell you that Data.List.sort is used at >> line xxx, using the GHC API. So have a look at around >> https://github.com/JPMoresmau/BuildWrapper/blob/master/src/Language/Haskell/BuildWrapper/API.hs#L239. >> BuildWrapper takes the GHC AST, transforms it into a JSON structure, and >> extracts all usage information. There is also an import reorganization >> function that may be useful. >> >> JP >> >> >> On Thu, Jul 24, 2014 at 10:29 AM, Erik Rantapaa > > wrote: >> >>> Hi everyone, >>> >>> I looking for a way to analyze Haskell source to determine which module >>> each imported symbol comes from. My goal is to transform source code like >>> this: >>> >>> import Data.List >>> ... >>> main = do >>> nums <- fmap (map read . words) getLine :: IO [Int] >>> print $ sort nums >>> >>> to code like this: >>> >>> import qualified Prelude as B >>> import qualified Data.List as A >>> ... >>> main = do >>> nums <- B.fmap (B.map B.read B.. B.words) B.getLine :: B.IO >>> [B.Int] >>> B.print B.$ A.sort nums >>> >>> That is, I want to qualify all imported symbols with a module alias. >>> >>> Can anyone suggest modules or programs I should look at? >>> >>> Thanks, >>> ER >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskel... at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> >> >> -- >> JP Moresmau >> http://jpmoresmau.blogspot.com/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Haskell-cafe" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to haskell-cafe... at googlegroups.com . >> To post to this group, send email to haskel... at googlegroups.com >> . >> Visit this group at http://groups.google.com/group/haskell-cafe. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Eyal > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tikhon at jelv.is Thu Jul 24 18:33:04 2014 From: tikhon at jelv.is (Tikhon Jelvis) Date: Thu, 24 Jul 2014 11:33:04 -0700 Subject: [Haskell-cafe] Haskell on JVM (using LLVM backend) In-Reply-To: References: Message-ID: I think almost all of the issues described in your second link[1] still apply. Using something like LLJVM takes care of generating native CLR IL or JVM bytecode, but that's just the first part of the equation. We'd still need to take care of interoperation and reimplementing either primops or parts of the standard library directly. On top of this, there's a good chance that it won't be very fast, even with GHC's optimizations. The JVM is not designed with functional programming in mind, so things like the garbage collector are tuned very differently from GHC's. I know that a lot of Scala programmers have run into problems with more advanced functional idioms performing slowly, so it's already tricky before considering how laziness will make Haskell's performance profile even more foreign to the JVM. I'm not saying that it's not worth doing, just that there are a lot of challenges to consider. Unfortunately, getting something usable will take more than just using LLJVM. It might make sense to have a Haskell-like language for the JVM that keeps Haskell's core essence (types, non-strictness, nicish semantics) but doesn't necessarily maintain complete backwards compatibility. I actually know of two such projects off-hand: Frege[2] and Ermine[3]. To my understanding, Frege tries to be pretty close to Haskell[4] while still being practical on the JVM. It's very similar to Haskell 2010, but with slight cosmetic differences, a few new features (records as namespaces) and a standard library (including primitive types like String) based on Java. Ermine is another JVM language with the "Haskell philosophy", developed at S&P Captial IQ to address some issues they had with functional programming in Scala. It introduces some interesting new type features (a neat extension to row polymorphism) and is generally more of its own language than a Haskell variant *per se*. Both of these are worth looking into if you're looking for a sane Haskell-like experience on the JVM. I think this sort of compromise?mostly like Haskell, but not striving for full compatibility?is the best option right now. It just feels like the additional costs involved in supporting all of Haskell, or even a sizable fraction, are too great, especially considering the additional changes to the language needed for interpolation with the rest of the JVM world. [1]: http://www.haskell.org/haskellwiki/GHC/FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_the_JVM.3F [2]: https://github.com/Frege/frege [3]: https://github.com/ermine-language/ermine [4]: https://github.com/Frege/frege/wiki/Differences-between-Frege-and-Haskell On Wed, Jul 23, 2014 at 7:26 PM, Wojciech Danilo wrote: > Hello! I was recently discussing with some frients possibilities of > running Haskell programs on JVM. > I belive such possibility could be a breakdown for the popularity of > Haskell and could be very interesting for new people and new > usage-scenarios. > > I have seen some topics, like these: > http://stackoverflow.com/questions/7261039/haskell-on-jvm > > http://www.haskell.org/haskellwiki/GHC/FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_the_JVM.3F > http://www.haskell.org/pipermail/haskell-cafe/2009-June/063454.html > > but are a little old and do NOT mention the LLVM backend. If we've got the > LLVM backend in GHC right now, why cannot we just use something like LLJVM > to convert the LLVMIR into JVM bytecode? > I understand that the LLVM bytecode (optained from GHC) has all the > optimizations applied (including tail recursion expansion) so it **could** > be possible to just run it on JVM? > > All the best, > Wojciech Dani?o > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Thu Jul 24 18:41:02 2014 From: martin.drautzburg at web.de (martin) Date: Thu, 24 Jul 2014 20:41:02 +0200 Subject: [Haskell-cafe] callCC inside expression Message-ID: <53D1533E.7090609@web.de> Hello all I recently saw a video on call/cc in Scheme, where call/cc was used inside an expression and call/cc faithfully figured out the rest of the computation. I tried the same in haskell, but was bitten badly. Then I looked at the type signature and learned that call/cc only works inside a continuation monad (if I am not mistaken). Is this correct and why is that so? Are scheme's call/cc and haskell's callCC semantically different? From danny.gratzer at gmail.com Thu Jul 24 19:08:43 2014 From: danny.gratzer at gmail.com (Danny Gratzer) Date: Thu, 24 Jul 2014 14:08:43 -0500 Subject: [Haskell-cafe] callCC inside expression In-Reply-To: <53D1533E.7090609@web.de> References: <53D1533E.7090609@web.de> Message-ID: <87zjfylglg.fsf@cmu.edu> > Is this correct and why is that so? Are scheme's call/cc and haskell's callCC semantically different? Yes, Haskell's `callCC` is a user defined function and Scheme's is a magical primitive. Under the hood Scheme should behave as if *every* expression lived inside the continuation monad. The Haskell equivalent would be something morally equivalent to foo :: Cont r Int foo = callCC $ \cont -> (+) <$> cont 1 <*> pure 1 Also, to do a lot of the fun games we can play with Scheme's call/cc, we need ContT r IO vs plain old Cont. For example, this program works "as expected" and returns 1 foo :: ContT r IO Int foo = do ref <- lift (newIORef undefined) result <- callCC $ \c -> lift (writeIORef ref c) >> pure False if not result then lift (readIORef ref) >>= ($ True) >> return 0 else return 1 From cpa at crans.org Thu Jul 24 21:35:59 2014 From: cpa at crans.org (Charles-Pierre Astolfi) Date: Thu, 24 Jul 2014 17:35:59 -0400 Subject: [Haskell-cafe] Markov Text Generator & Randomness In-Reply-To: <87tx66hndt.fsf@gmail.com> References: <8738driio3.fsf@gmail.com> <87tx66hndt.fsf@gmail.com> Message-ID: You're right Ben, changing the signature to Word instead of RVar Word did the trick. Stupid mistake. Thanks! -- Cp On Thu, Jul 24, 2014 at 9:55 AM, Ben Gamari wrote: > Charles-Pierre Astolfi writes: > >>> "The old man looked from his glass across the square, then over at the waiters." >> You're embarrassingly right! But then, "those the" definitely never >> appears, altough it does in my generated text. >> >>> Otherwise my cursory look turned up no bugs. >> Unfortunately there is :( >> > > Ahh yes, looking a bit more closely now I have a few points: > > 1. In `draw`: The first argument is an action which will return a new > word. Instead of passing `rword :: RVar Word`, you presumably rather want to > pass `word :: Word`. This is likely the cause of your bug. > > 2. In `draw`: Instead of `weightedSample` which produces a random shuffling of > the entire list, you really just want to draw a single word. This > is a categorical distribution; use `Data.Random.Categorical.fromList` > to construct the distribution and `R.rvar` to draw a variate. Note > that you may only want to avoid doing the former more than once as > construction of the distribution requires sorting and normalizing. > > 3. `map (\(x,y)->(y,x))` is just `map swap` where `swap` is provided > by `Data.Tuple`. > > My quick rework of your code can be found here [1]. > > Cheers, > > - Ben > > > [1] http://lpaste.net/108025 From johan.g.larson at gmail.com Thu Jul 24 22:44:03 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Thu, 24 Jul 2014 18:44:03 -0400 Subject: [Haskell-cafe] what is basic Haskell? Message-ID: What does a programmer need to know to be proficient in "basic Haskell"? For my money, basic programming skills are those that are required to write programs for simple tasks in the common idioms of the language. This means the practitioner should be able to read input from the terminal or files, select/combine/reformat data, and output a result. At this point, efficiency isn't really the point; only getting to a correct answer without writing anything really weird matters. In LYAH, I'd put the boundary at the end of chapter 9, which covers the IO monad. At that point the reader has studied functions, lists, tuples, types, recursion, higher order functions, four major modules, and algebraic data types. Actually, some of the later topics in chapter 8 (functors, kinds, recursive data structures) seem more like intermediate material. Thoughts? -- Johan Larson -- Toronto, Canada From wojciech.danilo at gmail.com Thu Jul 24 23:01:24 2014 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Fri, 25 Jul 2014 01:01:24 +0200 Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: This is **very** interesting question! When we recruit people to our company (we are working in Haskell everyday), we are basing on some classification between basic, intermediate and advanced stuff. These sections are shown below. I would love to hear what others are thinking about it and what from the below stuff would be widely considered as "basic Haskell knowledge", which would allow for full-time basic Haskell work. Basics 1. type classes 2. instances 3. functors, applicatives, monads, etc ( http://www.haskell.org/haskellwiki/Typeclassopedia) 4. functional dependencies 1. Patterson condition 2. Coverage condition 3. Liberal coverage condition 5. monad transformers Intermidiate 1. lens 2. arrows 3. free monads 4. GADTs 5. Type families 1. closed type families 6. existential datatypes 7. RankNTypes 8. church encoding Advanced 1. templateHaskell 2. generics 3. continuations 4. delimited continuations 2014-07-25 0:44 GMT+02:00 Johan Larson : > What does a programmer need to know to be proficient in "basic Haskell"? > > For my money, basic programming skills are those that are required to > write programs for simple tasks in the common idioms of the language. > This means the practitioner should be able to read input from the > terminal or files, select/combine/reformat data, and output a result. > At this point, efficiency isn't really the point; only getting to a > correct answer without writing anything really weird matters. > > In LYAH, I'd put the boundary at the end of chapter 9, which covers > the IO monad. At that point the reader has studied functions, lists, > tuples, types, recursion, higher order functions, four major modules, > and algebraic data types. Actually, some of the later topics in > chapter 8 (functors, kinds, recursive data structures) seem more like > intermediate material. > > Thoughts? > > -- > Johan Larson -- Toronto, Canada > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at lagoa.com Thu Jul 24 23:09:52 2014 From: alex at lagoa.com (Alexander Vieth) Date: Thu, 24 Jul 2014 19:09:52 -0400 Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: <51B7B8B5-A5E1-4098-8119-3B290BC02C64@lagoa.com> I'm curious to know why you have included functional dependencies under basics. I'd call that an advanced concept, since a Haskell programmer could be effective even without understanding it. Although, if your company makes heavy use of these, then I suppose you ought to consider it basic for new recruits. Alex On 2014-07-24, at 7:01 PM, Wojciech Danilo wrote: > This is **very** interesting question! > When we recruit people to our company (we are working in Haskell everyday), we are basing on some classification between basic, intermediate and advanced stuff. These sections are shown below. I would love to hear what others are thinking about it and what from the below stuff would be widely considered as "basic Haskell knowledge", which would allow for full-time basic Haskell work. > > Basics > type classes > instances > functors, applicatives, monads, etc (http://www.haskell.org/haskellwiki/Typeclassopedia) > functional dependencies > Patterson condition > Coverage condition > Liberal coverage condition > monad transformers > Intermidiate > lens > arrows > free monads > GADTs > Type families > closed type families > existential datatypes > RankNTypes > church encoding > Advanced > templateHaskell > generics > continuations > delimited continuations > > > 2014-07-25 0:44 GMT+02:00 Johan Larson : > What does a programmer need to know to be proficient in "basic Haskell"? > > For my money, basic programming skills are those that are required to > write programs for simple tasks in the common idioms of the language. > This means the practitioner should be able to read input from the > terminal or files, select/combine/reformat data, and output a result. > At this point, efficiency isn't really the point; only getting to a > correct answer without writing anything really weird matters. > > In LYAH, I'd put the boundary at the end of chapter 9, which covers > the IO monad. At that point the reader has studied functions, lists, > tuples, types, recursion, higher order functions, four major modules, > and algebraic data types. Actually, some of the later topics in > chapter 8 (functors, kinds, recursive data structures) seem more like > intermediate material. > > Thoughts? > > -- > Johan Larson -- Toronto, Canada > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.gibiansky at gmail.com Thu Jul 24 23:14:03 2014 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Thu, 24 Jul 2014 16:14:03 -0700 Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: The list there you have roughly corresponds to my intuitions, except for a few minor things: 1. Functional dependencies. --- I personally have used functional dependencies and wrestled with things like the coverage condition, and while I know I could easily look it up and would have no trouble understanding it, I doubt I could tell you what each of those is without looking it up. But I've never felt that knowing that is really worthwhile - they're just things the compiler will complain about if I run into them accidentally, and most programmers who have written enough of their own instances probably get them right anyways. So I'm not really sure that understanding those is necessary for being productive on a day-to-day basis, and they seem a bit out of place on that list. Do you have a particular reason they're there? 2. Arrows -- I've been programming Haskell for a few years now, and only run in to arrows *in practice* a few times. I've definitely seen a few libraries migrating away from arrows towards applicative or monadic interfaces instead. Do you use them often? I definitely feel like they're a bit more on the esoteric side, while GADTs, free monads, lenses, type families, and existential data types are things I encounter fairly frequently. On the other hand, they seem to be a good model for FRP and such, so maybe not. (Same goes for church encodings, but that's just a nice bit of CS that people should know a bit :) ) On the whole, looks like a pretty good list that I agree with. Of course, the "basic" list really includes a bunch more - knowledge of data types, syntax, functions, laziness, etc. -- Andrew On Thu, Jul 24, 2014 at 4:01 PM, Wojciech Danilo wrote: > This is **very** interesting question! > When we recruit people to our company (we are working in Haskell > everyday), we are basing on some classification between basic, intermediate > and advanced stuff. These sections are shown below. I would love to hear > what others are thinking about it and what from the below stuff would be > widely considered as "basic Haskell knowledge", which would allow for > full-time basic Haskell work. > > Basics > > 1. type classes > 2. instances > 3. functors, applicatives, monads, etc ( > http://www.haskell.org/haskellwiki/Typeclassopedia) > 4. functional dependencies > 1. Patterson condition > 2. Coverage condition > 3. Liberal coverage condition > 5. monad transformers > > Intermidiate > > 1. lens > 2. arrows > 3. free monads > 4. GADTs > 5. Type families > 1. closed type families > 6. existential datatypes > 7. RankNTypes > 8. church encoding > > Advanced > > 1. templateHaskell > 2. generics > 3. continuations > 4. delimited continuations > > > > 2014-07-25 0:44 GMT+02:00 Johan Larson : > > What does a programmer need to know to be proficient in "basic Haskell"? >> >> For my money, basic programming skills are those that are required to >> write programs for simple tasks in the common idioms of the language. >> This means the practitioner should be able to read input from the >> terminal or files, select/combine/reformat data, and output a result. >> At this point, efficiency isn't really the point; only getting to a >> correct answer without writing anything really weird matters. >> >> In LYAH, I'd put the boundary at the end of chapter 9, which covers >> the IO monad. At that point the reader has studied functions, lists, >> tuples, types, recursion, higher order functions, four major modules, >> and algebraic data types. Actually, some of the later topics in >> chapter 8 (functors, kinds, recursive data structures) seem more like >> intermediate material. >> >> Thoughts? >> >> -- >> Johan Larson -- Toronto, Canada >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wojciech.danilo at gmail.com Thu Jul 24 23:19:01 2014 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Fri, 25 Jul 2014 01:19:01 +0200 Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: Alex - we are making a very havy use of them (we are creating our own language, compiler and domain specific libraries) - but you are right - in other scenarios, they would be intermidiate (not advanced in my opinion). Andrew - I would disagree with point 1. If you are using OverlappingInstances and you are defining self-recursive instances, compiler will complain giving you no hints unless you know what you are doing (again, we are making ahvy use out of it, so I'm a little biased) Ad. 2) - you are right - they are in the intermediate section, because they are not hard to follow and understand. Additional, they are used a lot in reactive programming - but here I agree, they could go elsewhere. And of course you are right - there is a bunch of very busic stuff not covered by the list - maybe I should just add it there, to make this list more pure! :D 2014-07-25 1:14 GMT+02:00 Andrew Gibiansky : > The list there you have roughly corresponds to my intuitions, except for a > few minor things: > > 1. Functional dependencies. --- I personally have used functional > dependencies and wrestled with things like the coverage condition, and > while I know I could easily look it up and would have no trouble > understanding it, I doubt I could tell you what each of those is without > looking it up. But I've never felt that knowing that is really worthwhile - > they're just things the compiler will complain about if I run into them > accidentally, and most programmers who have written enough of their own > instances probably get them right anyways. So I'm not really sure that > understanding those is necessary for being productive on a day-to-day > basis, and they seem a bit out of place on that list. Do you have a > particular reason they're there? > > 2. Arrows -- I've been programming Haskell for a few years now, and only > run in to arrows *in practice* a few times. I've definitely seen a few > libraries migrating away from arrows towards applicative or monadic > interfaces instead. Do you use them often? I definitely feel like they're a > bit more on the esoteric side, while GADTs, free monads, lenses, type > families, and existential data types are things I encounter fairly > frequently. On the other hand, they seem to be a good model for FRP and > such, so maybe not. (Same goes for church encodings, but that's just a nice > bit of CS that people should know a bit :) ) > > On the whole, looks like a pretty good list that I agree with. Of course, > the "basic" list really includes a bunch more - knowledge of data types, > syntax, functions, laziness, etc. > > -- Andrew > > > > On Thu, Jul 24, 2014 at 4:01 PM, Wojciech Danilo < > wojciech.danilo at gmail.com> wrote: > >> This is **very** interesting question! >> When we recruit people to our company (we are working in Haskell >> everyday), we are basing on some classification between basic, intermediate >> and advanced stuff. These sections are shown below. I would love to hear >> what others are thinking about it and what from the below stuff would be >> widely considered as "basic Haskell knowledge", which would allow for >> full-time basic Haskell work. >> >> Basics >> >> 1. type classes >> 2. instances >> 3. functors, applicatives, monads, etc ( >> http://www.haskell.org/haskellwiki/Typeclassopedia) >> 4. functional dependencies >> 1. Patterson condition >> 2. Coverage condition >> 3. Liberal coverage condition >> 5. monad transformers >> >> Intermidiate >> >> 1. lens >> 2. arrows >> 3. free monads >> 4. GADTs >> 5. Type families >> 1. closed type families >> 6. existential datatypes >> 7. RankNTypes >> 8. church encoding >> >> Advanced >> >> 1. templateHaskell >> 2. generics >> 3. continuations >> 4. delimited continuations >> >> >> >> 2014-07-25 0:44 GMT+02:00 Johan Larson : >> >> What does a programmer need to know to be proficient in "basic Haskell"? >>> >>> For my money, basic programming skills are those that are required to >>> write programs for simple tasks in the common idioms of the language. >>> This means the practitioner should be able to read input from the >>> terminal or files, select/combine/reformat data, and output a result. >>> At this point, efficiency isn't really the point; only getting to a >>> correct answer without writing anything really weird matters. >>> >>> In LYAH, I'd put the boundary at the end of chapter 9, which covers >>> the IO monad. At that point the reader has studied functions, lists, >>> tuples, types, recursion, higher order functions, four major modules, >>> and algebraic data types. Actually, some of the later topics in >>> chapter 8 (functors, kinds, recursive data structures) seem more like >>> intermediate material. >>> >>> Thoughts? >>> >>> -- >>> Johan Larson -- Toronto, Canada >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.gibiansky at gmail.com Thu Jul 24 23:22:30 2014 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Thu, 24 Jul 2014 16:22:30 -0700 Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: Oh, that makes sense. If you regularly do stuff with OverlappingInstances, that can definitely bite you :) I did not think about that since I tend to avoid OverlappingInstances in my own work whenever possible. Makes sense, then! I think it might make sense to have a list like this on a wiki somewhere, honestly. Of course a lot of bikeshedding could go into the exact division of topics, but it'd still be useful for something like this to exist somewhere. On Thu, Jul 24, 2014 at 4:19 PM, Wojciech Danilo wrote: > Alex - we are making a very havy use of them (we are creating our own > language, compiler and domain specific libraries) - but you are right - in > other scenarios, they would be intermidiate (not advanced in my opinion). > > Andrew - I would disagree with point 1. If you are using > OverlappingInstances and you are defining self-recursive instances, > compiler will complain giving you no hints unless you know what you are > doing (again, we are making ahvy use out of it, so I'm a little biased) > Ad. 2) - you are right - they are in the intermediate section, because > they are not hard to follow and understand. Additional, they are used a lot > in reactive programming - but here I agree, they could go elsewhere. > > And of course you are right - there is a bunch of very busic stuff not > covered by the list - maybe I should just add it there, to make this list > more pure! :D > > > > > 2014-07-25 1:14 GMT+02:00 Andrew Gibiansky : > > The list there you have roughly corresponds to my intuitions, except for a >> few minor things: >> >> 1. Functional dependencies. --- I personally have used functional >> dependencies and wrestled with things like the coverage condition, and >> while I know I could easily look it up and would have no trouble >> understanding it, I doubt I could tell you what each of those is without >> looking it up. But I've never felt that knowing that is really worthwhile - >> they're just things the compiler will complain about if I run into them >> accidentally, and most programmers who have written enough of their own >> instances probably get them right anyways. So I'm not really sure that >> understanding those is necessary for being productive on a day-to-day >> basis, and they seem a bit out of place on that list. Do you have a >> particular reason they're there? >> >> 2. Arrows -- I've been programming Haskell for a few years now, and only >> run in to arrows *in practice* a few times. I've definitely seen a few >> libraries migrating away from arrows towards applicative or monadic >> interfaces instead. Do you use them often? I definitely feel like they're a >> bit more on the esoteric side, while GADTs, free monads, lenses, type >> families, and existential data types are things I encounter fairly >> frequently. On the other hand, they seem to be a good model for FRP and >> such, so maybe not. (Same goes for church encodings, but that's just a nice >> bit of CS that people should know a bit :) ) >> >> On the whole, looks like a pretty good list that I agree with. Of course, >> the "basic" list really includes a bunch more - knowledge of data types, >> syntax, functions, laziness, etc. >> >> -- Andrew >> >> >> >> On Thu, Jul 24, 2014 at 4:01 PM, Wojciech Danilo < >> wojciech.danilo at gmail.com> wrote: >> >>> This is **very** interesting question! >>> When we recruit people to our company (we are working in Haskell >>> everyday), we are basing on some classification between basic, intermediate >>> and advanced stuff. These sections are shown below. I would love to hear >>> what others are thinking about it and what from the below stuff would be >>> widely considered as "basic Haskell knowledge", which would allow for >>> full-time basic Haskell work. >>> >>> Basics >>> >>> 1. type classes >>> 2. instances >>> 3. functors, applicatives, monads, etc ( >>> http://www.haskell.org/haskellwiki/Typeclassopedia) >>> 4. functional dependencies >>> 1. Patterson condition >>> 2. Coverage condition >>> 3. Liberal coverage condition >>> 5. monad transformers >>> >>> Intermidiate >>> >>> 1. lens >>> 2. arrows >>> 3. free monads >>> 4. GADTs >>> 5. Type families >>> 1. closed type families >>> 6. existential datatypes >>> 7. RankNTypes >>> 8. church encoding >>> >>> Advanced >>> >>> 1. templateHaskell >>> 2. generics >>> 3. continuations >>> 4. delimited continuations >>> >>> >>> >>> 2014-07-25 0:44 GMT+02:00 Johan Larson : >>> >>> What does a programmer need to know to be proficient in "basic Haskell"? >>>> >>>> For my money, basic programming skills are those that are required to >>>> write programs for simple tasks in the common idioms of the language. >>>> This means the practitioner should be able to read input from the >>>> terminal or files, select/combine/reformat data, and output a result. >>>> At this point, efficiency isn't really the point; only getting to a >>>> correct answer without writing anything really weird matters. >>>> >>>> In LYAH, I'd put the boundary at the end of chapter 9, which covers >>>> the IO monad. At that point the reader has studied functions, lists, >>>> tuples, types, recursion, higher order functions, four major modules, >>>> and algebraic data types. Actually, some of the later topics in >>>> chapter 8 (functors, kinds, recursive data structures) seem more like >>>> intermediate material. >>>> >>>> Thoughts? >>>> >>>> -- >>>> Johan Larson -- Toronto, Canada >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.solla at gmail.com Thu Jul 24 23:55:57 2014 From: alex.solla at gmail.com (Alexander Solla) Date: Thu, 24 Jul 2014 16:55:57 -0700 Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: On Thu, Jul 24, 2014 at 3:44 PM, Johan Larson wrote: > What does a programmer need to know to be proficient in "basic Haskell"? > > For my money, basic programming skills are those that are required to > write programs for simple tasks in the common idioms of the language. > This means the practitioner should be able to read input from the > terminal or files, select/combine/reformat data, and output a result. > At this point, efficiency isn't really the point; only getting to a > correct answer without writing anything really weird matters. > > In LYAH, I'd put the boundary at the end of chapter 9, which covers > the IO monad. At that point the reader has studied functions, lists, > tuples, types, recursion, higher order functions, four major modules, > and algebraic data types. Actually, some of the later topics in > chapter 8 (functors, kinds, recursive data structures) seem more like > intermediate material. > I won't try to categorize. Here's a very handy reference: http://dev.stephendiehl.com/hask/ (What I wish I knew when learning Haskell) -------------- next part -------------- An HTML attachment was scrubbed... URL: From donn at avvanta.com Fri Jul 25 00:39:38 2014 From: donn at avvanta.com (Donn Cave) Date: Thu, 24 Jul 2014 17:39:38 -0700 (PDT) Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: <20140725003938.30FDB93C2E@mail.avvanta.com> > Oh, that makes sense. If you regularly do stuff with OverlappingInstances, ... which you wouldn't, at a basic level? Rather than split off a whole set of basic categories like - basic Haskell - really basic Haskell - really, really basic Haskell ... it makes sense to me to distinguish "basic" from "what we use all the time at our shop." Basic would be, as Johan Larson proposed, the things you'd really need to write in Haskell, with fundamental properties of the language that contribute to reusability, type safety etc. We could reasonably put type classes at that level, for example, if for no other reason than it's hard to make any sense out of the platform libraries without knowing about classes and instances etc. But language features that aren't even supported by default? Is that even Haskell, as opposed to GHC? Donn From johan.g.larson at gmail.com Fri Jul 25 01:53:24 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Thu, 24 Jul 2014 21:53:24 -0400 Subject: [Haskell-cafe] what is basic Haskell? In-Reply-To: References: Message-ID: That's setting the bar rather high, isn't it? I appreciate that you are talking about professionals, but working professionals whose domain is Haskell programming should have long since mastered basic Haskell, whatever we call "basic". Their daily work is intermediate Haskell, with occasional detours into the advanced. On Thu, Jul 24, 2014 at 7:01 PM, Wojciech Danilo wrote: > This is **very** interesting question! > When we recruit people to our company (we are working in Haskell everyday), > we are basing on some classification between basic, intermediate and > advanced stuff. These sections are shown below. I would love to hear what > others are thinking about it and what from the below stuff would be widely > considered as "basic Haskell knowledge", which would allow for full-time > basic Haskell work. > > Basics > > type classes > instances > functors, applicatives, monads, etc > (http://www.haskell.org/haskellwiki/Typeclassopedia) > functional dependencies > > Patterson condition > Coverage condition > Liberal coverage condition > > monad transformers > > Intermidiate > > lens > arrows > free monads > GADTs > Type families > > closed type families > > existential datatypes > RankNTypes > church encoding > > Advanced > > templateHaskell > generics > continuations > delimited continuations > > > > 2014-07-25 0:44 GMT+02:00 Johan Larson : >> >> What does a programmer need to know to be proficient in "basic Haskell"? >> >> For my money, basic programming skills are those that are required to >> write programs for simple tasks in the common idioms of the language. >> This means the practitioner should be able to read input from the >> terminal or files, select/combine/reformat data, and output a result. >> At this point, efficiency isn't really the point; only getting to a >> correct answer without writing anything really weird matters. >> >> In LYAH, I'd put the boundary at the end of chapter 9, which covers >> the IO monad. At that point the reader has studied functions, lists, >> tuples, types, recursion, higher order functions, four major modules, >> and algebraic data types. Actually, some of the later topics in >> chapter 8 (functors, kinds, recursive data structures) seem more like >> intermediate material. >> >> Thoughts? >> >> -- >> Johan Larson -- Toronto, Canada >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Johan Larson -- Toronto, Canada From mbrock at goula.sh Fri Jul 25 10:04:48 2014 From: mbrock at goula.sh (Mikael Brockman) Date: Fri, 25 Jul 2014 12:04:48 +0200 Subject: [Haskell-cafe] callCC inside expression References: <53D1533E.7090609@web.de> Message-ID: martin writes: > Hello all > > I recently saw a video on call/cc in Scheme, where call/cc was used > inside an expression and call/cc faithfully figured out the rest of > the computation. > > I tried the same in haskell, but was bitten badly. Then I looked at > the type signature and learned that call/cc only works inside a > continuation monad (if I am not mistaken). > > Is this correct and why is that so? Are scheme's call/cc and haskell's > callCC semantically different? The ContT monad transformer provides "delimited continuations," aka "composable continuations" or "partial continuations." These are much easier to use and reason about than global continuations. A continuation reified by callCC can be reused as a regular monadic action; it won't disrupt the entire program's evaluation. There's an Oleg article [1] that argues against Scheme's call/cc as a "bad abstraction" for numerous reasons. I believe it's good Scheme coding practice to avoid this operator in favor of some construction for delimited continuations, such as shift & reset, though standard Scheme only specifies call/cc. Oleg says: | Undelimited continuations by themselves seem to have no practical use: | at least noone has shown me a practical application of just call/cc, | which I have been asking for a long time. To my knowledge, in all | practical programs call/cc emulates, to the extent possible, some sort | of a delimited control operation, often as simple as exceptions or | generators. Scheme seems to retain call/cc mostly by inertia. [1]: http://okmij.org/ftp/continuations/against-callcc.html From marat61 at gmail.com Fri Jul 25 11:25:25 2014 From: marat61 at gmail.com (=?UTF-8?B?0JfQsNC60LjRgNC+0LIg0JzQsNGA0LDRgg==?=) Date: Fri, 25 Jul 2014 15:25:25 +0400 Subject: [Haskell-cafe] support request Message-ID: Hi All! I need to convince group of managers that Haskell is cool. Could you please share some links, presentations, data and maybe experience? Thanks in advance... -- Regards, Marat. ? ????????? ?????. From nukasu.kanaka at gmail.com Fri Jul 25 12:05:02 2014 From: nukasu.kanaka at gmail.com (Nikita Volkov) Date: Fri, 25 Jul 2014 16:05:02 +0400 Subject: [Haskell-cafe] support request In-Reply-To: References: Message-ID: To convince managers I believe you should emphasize at the language?s practical potential. Nowadays there?s nothing as important as software scalability, and you have a beautiful story to tell: the scalable and composable concurrency using the Software Transactional Memory model, the semi-implicit and explicit parallelism, the distributed systems programming (e.g., clusters) using Cloud Haskell. There also are thousands of open-source libraries in the every growing central repo. The community is eager to help . There are lots of video presentations covering the topics I mention. I recommend walking thru the ones by Simon Peyton Jones for a start. ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.g.larson at gmail.com Fri Jul 25 12:30:15 2014 From: johan.g.larson at gmail.com (Johan Larson) Date: Fri, 25 Jul 2014 08:30:15 -0400 Subject: [Haskell-cafe] support request In-Reply-To: References: Message-ID: "What it's Like to Use Haskell" is a good place to start. It addresses many practical concerns about using the language, and is based on the author's experience in a pilot project in industry. It's also short enough that your manager might read it start to finish. http://engineering.imvu.com/2014/03/24/what-its-like-to-use-haskell/ On Fri, Jul 25, 2014 at 7:25 AM, ??????? ????? wrote: > Hi All! > > I need to convince group of managers that Haskell is cool. Could you > please share some links, presentations, data and maybe experience? > > Thanks in advance... > > -- > Regards, Marat. > ? ????????? ?????. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Johan Larson -- Toronto, Canada From allbery.b at gmail.com Fri Jul 25 14:57:54 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 25 Jul 2014 10:57:54 -0400 Subject: [Haskell-cafe] support request In-Reply-To: References: Message-ID: On Fri, Jul 25, 2014 at 7:25 AM, ??????? ????? wrote: > I need to convince group of managers that Haskell is cool. This sounds like getting off on the wrong foot from the start; managers don't care about cool, they care about getting stuff done. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Fri Jul 25 15:55:08 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 25 Jul 2014 11:55:08 -0400 Subject: [Haskell-cafe] support request In-Reply-To: References: Message-ID: Well said. If using a tool makes cheaper / faster to deliver a given set of features/level of quality, next week, business won't care how, just that it is. On Friday, July 25, 2014, Brandon Allbery wrote: > On Fri, Jul 25, 2014 at 7:25 AM, ??????? ????? > wrote: > >> I need to convince group of managers that Haskell is cool. > > > This sounds like getting off on the wrong foot from the start; managers > don't care about cool, they care about getting stuff done. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From trupill at gmail.com Fri Jul 25 16:12:56 2014 From: trupill at gmail.com (Alejandro Serrano Mena) Date: Fri, 25 Jul 2014 18:12:56 +0200 Subject: [Haskell-cafe] Retrieving information about type families In-Reply-To: <51DC5BD6-6A19-4AB2-8E12-9AFC04A3678C@cis.upenn.edu> References: <51DC5BD6-6A19-4AB2-8E12-9AFC04A3678C@cis.upenn.edu> Message-ID: Thanks for the help! At the end I'm trying to get the information from a RenamedSource (so I can still get source locations) and then get type information using TcHsType. I haven't succedeed yet, but I think I'm on the way! 2014-07-23 23:38 GMT+02:00 Richard Eisenberg : > Does FamInstEnv.lookupFamInstEnv work for you? You will also probably want > FamInst.tcGetFamInstEnvs. > > Richard > > On Jul 23, 2014, at 2:48 PM, Alejandro Serrano Mena > wrote: > > > Dear Caf?, > > My quest for obtaining information about type families continues. > > Now I have a simple question: how should I access the information about > "type instance"s via the GHC API? My aim is to do so after type checking, > that is, to get that information from a TypecheckedModule. However, I > haven't yet been able to touch the right buttons to make it work ;( > > > > Thanks in advance, > > Alejandro > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at groovie.org Fri Jul 25 16:50:28 2014 From: ben at groovie.org (Ben Bangert) Date: Fri, 25 Jul 2014 09:50:28 -0700 Subject: [Haskell-cafe] HTTP/2 implementation? In-Reply-To: <20140722.161937.1350826873679140551.kazu@iij.ad.jp> References: <5F77AD1C-A9F0-493D-A807-C13FBC63B863@groovie.org> <20140722.161937.1350826873679140551.kazu@iij.ad.jp> Message-ID: <63215CF4-2403-4E70-A458-6A89D861456C@groovie.org> On Jul 22, 2014, at 12:19 AM, Kazu Yamamoto (????) wrote: > This package implements HPACK only at this moment. I'm planning to > implement HTTP/2 itself soon and integrate it into Warp. > > HTTP/2 is at the stage of IETF working group last call. The specs are > being dynamically changed. For instance, it is just decided to remove > referense set from HPACK finally. I've forked your HTTP/2 package and implemented the HTTP/2 frame parsers along with some basic checks using draft14. While having Warp support it would definitely help, I'm actually planning on implementing a complete HTTP/2 proxy (HTTP/2 from clients, consolidated down to multiple HTTP/2 connections to backend app servers). This type of work requires rather direct access to the entirety of the frame processing and stream handling aspects, while I'd imagine Warp would generally only expose a WAI interface. I'm a bit new to Haskell yet, so any thoughts or input would be greatly appreciated. Cheers, Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From tikhon at jelv.is Fri Jul 25 17:46:51 2014 From: tikhon at jelv.is (Tikhon Jelvis) Date: Fri, 25 Jul 2014 10:46:51 -0700 Subject: [Haskell-cafe] support request In-Reply-To: References: Message-ID: That's what they *say*, anyhow. In practice though, most managers have all sorts of other concerns, some of which are blown way out of proportion or sometimes completely irrational. The trick is to address these too. One of the biggest things is the manager's version of premature optimization: worrying about scale way too early. Not just scaling technologically (although that might come up) but also hiring and training lots of developers. All too often, they think that training developers in a new language will be too difficult and that they need a market of developers comparable to Java to be able to hire for their team. The funny thing is that this is almost the opposite of what happens in practice: using a language like Haskell actually makes it *easier* to hire good developers. Haskell motivates programmers to apply more actively and self-select, which is nice. This thread[1] has some testimony that might be useful to show that hiring Haskellers is actually easy. As far as training goes, it's also not too difficult. The IMVU blog post mentioned earlier covers this: > "Today, training an engineer to be productive in our Haskell code is not much harder than training someone to be productive in our PHP environment. People who have prior functional programming knowledge seem to find their stride in just a few days." Their experience is that Haskell is actually pretty easy to teach if you have strong opinions about style, idioms, libraries, extensions and so on. The clear plan for what to cover is important. They covered this idea in their BayHac[2] talk, which might be worth a look. [1]: https://groups.google.com/forum/#!topic/haskell-cafe/-HzmH5CVehM [2]: https://www.youtube.com/watch?v=gl3expkos4Q#t=483 On Fri, Jul 25, 2014 at 8:55 AM, Carter Schonwald < carter.schonwald at gmail.com> wrote: > Well said. If using a tool makes cheaper / faster to deliver a given set > of features/level of quality, next week, business won't care how, just that > it is. > > > On Friday, July 25, 2014, Brandon Allbery wrote: > >> On Fri, Jul 25, 2014 at 7:25 AM, ??????? ????? wrote: >> >>> I need to convince group of managers that Haskell is cool. >> >> >> This sounds like getting off on the wrong foot from the start; managers >> don't care about cool, they care about getting stuff done. >> >> -- >> brandon s allbery kf8nh sine nomine >> associates >> allbery.b at gmail.com >> ballbery at sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad >> http://sinenomine.net >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Jul 25 18:07:27 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 25 Jul 2014 14:07:27 -0400 Subject: [Haskell-cafe] support request In-Reply-To: References: Message-ID: On Fri, Jul 25, 2014 at 1:46 PM, Tikhon Jelvis wrote: > The funny thing is that this is almost the opposite of what happens in > practice: using a language like Haskell actually makes it *easier* to hire > good developers. Haskell motivates programmers to apply more actively and > self-select, which is nice. Sometimes. I note that the recent thread about "basic Haskell" convinced me that I should *not* apply for any Haskell jobs (not that I'm looking at the moment). -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremy at n-heptane.com Fri Jul 25 18:31:58 2014 From: jeremy at n-heptane.com (Jeremy Shaw) Date: Fri, 25 Jul 2014 13:31:58 -0500 Subject: [Haskell-cafe] support request In-Reply-To: References: Message-ID: You'll never win with logic! Just start writing Haskell, and then they'll be stuck with it whether they want it or not. I suspect that is how most Haskell in the industry got started. - jeremy On Fri, Jul 25, 2014 at 6:25 AM, ??????? ????? wrote: > Hi All! > > I need to convince group of managers that Haskell is cool. Could you > please share some links, presentations, data and maybe experience? > > Thanks in advance... > > -- > Regards, Marat. > ? ????????? ?????. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From agocorona at gmail.com Sat Jul 26 01:34:17 2014 From: agocorona at gmail.com (Alberto G. Corona ) Date: Sat, 26 Jul 2014 03:34:17 +0200 Subject: [Haskell-cafe] ANNOUNCE: hplayground: haskell client-side web framework Message-ID: hplayground [1] is a haskell framework that compiles to JavaScript with the haste [5] compiler. It handles reactive effects under a applicative-monad that controls the modifications of the user interface. It is quite easy to create dynamic, composable applications using ordinary, beatiful, idiomatic haskell without special constructions. Rather than a framework, it is an EDSL. Full reinversion of control avoid spagetty event handlers and the monad confines the events and their effects to the subtree where they appear avoiding the problems of declarative reactive frameworks. There are examples running[4] the source code is in [1] And there is a todo reference application [3] running [2] too. There is also a blog post about that[7] Additionally, the syntax is almost identical to the formlet widgets in MFlow[6]. So most of the hplaygroud code could run also in a server if javascript is disabled. But MFlow and hplayground are completely independent projects. I hope that you enjoy it as much as I enjoyed the development of it. A big thanks to Anton Ekblad for his wonderful Haste compiler. [1] https://github.com/agocorona/hplayground [2] http://mflowdemo.herokuapp.com/todo.html [3] https://github.com/agocorona/hplay-todo [4] http://mflowdemo.herokuapp.com/noscript/wiki/browserwidgets [5] http://http://haste-lang.org/ [6] http://hackage.haskell.org/package/MFlow [7] http://haskell-web.blogspot.com.es/2014/07/hplayground-translate-your-console.html -- Alberto. From kazu at iij.ad.jp Sat Jul 26 01:45:41 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Sat, 26 Jul 2014 10:45:41 +0900 (JST) Subject: [Haskell-cafe] HTTP/2 implementation? In-Reply-To: <63215CF4-2403-4E70-A458-6A89D861456C@groovie.org> References: <20140722.161937.1350826873679140551.kazu@iij.ad.jp> <63215CF4-2403-4E70-A458-6A89D861456C@groovie.org> Message-ID: <20140726.104541.1571881280641961670.kazu@iij.ad.jp> Hi Ben, > I've forked your HTTP/2 package and implemented the HTTP/2 frame > parsers along with some basic checks using draft14. While having > Warp support it would definitely help, I'm actually planning on > implementing a complete HTTP/2 proxy (HTTP/2 from clients, > consolidated down to multiple HTTP/2 connections to backend app > servers). I would be nice if we can work together. Mighty is a web server based on Warp. Currently, Mighty implements reverse proxy only. I'm planning to implement (forward) proxy and supports HTTP/2 in forward/reverse proxy. > This type of work requires rather direct access to the entirety of > the frame processing and stream handling aspects, while I'd imagine > Warp would generally only expose a WAI interface. I don't understand this problem yet due to the lack of experience. But if direct access is really necessary, you can propose to extend WAI. I think that web-devel at haskell.org is a proper place to discuss this. --Kazu From ben at groovie.org Sat Jul 26 04:00:31 2014 From: ben at groovie.org (Ben Bangert) Date: Fri, 25 Jul 2014 21:00:31 -0700 Subject: [Haskell-cafe] HTTP/2 implementation? In-Reply-To: <20140726.104541.1571881280641961670.kazu@iij.ad.jp> References: <20140722.161937.1350826873679140551.kazu@iij.ad.jp> <63215CF4-2403-4E70-A458-6A89D861456C@groovie.org> <20140726.104541.1571881280641961670.kazu@iij.ad.jp> Message-ID: <7AA603E0-FDF1-430B-A267-ED2FB14DD0F0@groovie.org> On Jul 25, 2014, at 6:45 PM, Kazu Yamamoto (????) wrote: > I would be nice if we can work together. Absolutely! I definitely would prefer not to do this by myself. :) > Mighty is a web server based on Warp. Currently, Mighty implements > reverse proxy only. I'm planning to implement (forward) proxy and > supports HTTP/2 in forward/reverse proxy. Cool! From my evaluation, HTTP/2 proxy is going to be very very different from HTTP/1. In HTTP/1 every request/response cycle is a separate TCP connection, while proxying in HTTP/2 to a single authority server can multiplex (or use multiple multiplexed connections). A server that knows its being proxied to will require very different settings (with much higher max concurrent streams) than a server expected to handle public requests. I've been trying to determine the various requirements and config options needed. I've also been considering the ability to 'replay' specific streams for fail-over. For example, if a stream enter half-closed (remote), and nothing except perhaps push promise frames have been sent before the server being proxied to dies, then the proxy can replay the headers needed to restore that state to a new app-server. > I don't understand this problem yet due to the lack of experience. But > if direct access is really necessary, you can propose to extend WAI. In my case, after a client does a GET to a specific URI, I don't want to send any content. I want to keep the connection open indefinitely and occasionally send PUSH PROMISE frames down to send messages, per the new HTTP/2 PUSH spec: http://tools.ietf.org/html/draft-thomson-webpush-http2-00 This requires the ability in a request handler to send push promise frames and write the content for the newly allocated streams, all without fully returning (and thus ending) the request/response stream that started it. The node-http2 API implemented a special command to enable this. > I think that web-devel at haskell.org is a proper place to discuss this. Ah, thanks, I didn't know that list existed. :) Cheers, Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 841 bytes Desc: Message signed with OpenPGP using GPGMail URL: From trupill at gmail.com Sat Jul 26 08:57:37 2014 From: trupill at gmail.com (Alejandro Serrano Mena) Date: Sat, 26 Jul 2014 10:57:37 +0200 Subject: [Haskell-cafe] Retrieving information about type families In-Reply-To: References: <51DC5BD6-6A19-4AB2-8E12-9AFC04A3678C@cis.upenn.edu> Message-ID: I'm still struggling with getting the right information. My aim is to know the kind of a specific variable in a type instance defintion. For example, if I get: type family F (x :: Bool) type instance F y = () ^ where ^ marks the point from where I want the information, I want to get "y has kind Bool". The approach I'm taking is obtaining the LHsType Name from the specific position in the RenamedSource of the file. Then, I'm trying to convert that LHsType Name to a Type using functions in HscTypes, but I always get complaints about not existing variables. In the past, I implemented something similar for normal functions. However, in that case I could get the information directly from TypecheckedSource, by querying for a pattern variable with the right location. However, in the TypecheckedSource there's no information about type families at all :( My other possibility seems to use the ModuleInfo, but in those places there's no information of location :( Is there any way to achieve what I'm trying to do (get the kind of a specific type variable in the LHS of a type family instance, where the variable is given by its position in the source code)? Thanks in advance. 2014-07-25 18:12 GMT+02:00 Alejandro Serrano Mena : > Thanks for the help! At the end I'm trying to get the information from a > RenamedSource (so I can still get source locations) and then get type > information using TcHsType. I haven't succedeed yet, but I think I'm on the > way! > > > 2014-07-23 23:38 GMT+02:00 Richard Eisenberg : > > Does FamInstEnv.lookupFamInstEnv work for you? You will also probably want >> FamInst.tcGetFamInstEnvs. >> >> Richard >> >> On Jul 23, 2014, at 2:48 PM, Alejandro Serrano Mena >> wrote: >> >> > Dear Caf?, >> > My quest for obtaining information about type families continues. >> > Now I have a simple question: how should I access the information about >> "type instance"s via the GHC API? My aim is to do so after type checking, >> that is, to get that information from a TypecheckedModule. However, I >> haven't yet been able to touch the right buttons to make it work ;( >> > >> > Thanks in advance, >> > Alejandro >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at nh2.me Sat Jul 26 19:39:01 2014 From: mail at nh2.me (=?UTF-8?B?TmlrbGFzIEhhbWLDvGNoZW4=?=) Date: Sat, 26 Jul 2014 21:39:01 +0200 Subject: [Haskell-cafe] [] \\ [1..] diverges - intended? Message-ID: <53D403D5.1070604@nh2.me> Hi, I just noticed that import Data.List [] \\ [1..] diverges, although technically it doesn't have to (the docs suggest to me that it could just be [], and a non-diverging implementation is possible). Same for [1,2] \\ [1..] of course. Was this intended? From hjgtuyl at chello.nl Sat Jul 26 20:55:05 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sat, 26 Jul 2014 22:55:05 +0200 Subject: [Haskell-cafe] [] \\ [1..] diverges - intended? In-Reply-To: <53D403D5.1070604@nh2.me> References: <53D403D5.1070604@nh2.me> Message-ID: On Sat, 26 Jul 2014 21:39:01 +0200, Niklas Hamb?chen wrote: > Hi, > > I just noticed that > > import Data.List > [] \\ [1..] > > diverges, although technically it doesn't have to (the docs suggest to > me that it could just be [], and a non-diverging implementation is > possible). > > Same for [1,2] \\ [1..] of course. > You can define (\\) as follows, terminating in case of the samples you gave: (\\) :: (Eq a) => [a] -> [a] -> [a] (\\) [] _ = [] (\\) _ [] = [] (\\) xs (y : ys) = delete y xs \\ ys but this will not terminate in cases like: [0] \\ [1..] I don't think there is a way to get this terminating for all cases. Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From mail at nh2.me Sat Jul 26 22:03:57 2014 From: mail at nh2.me (=?ISO-8859-15?Q?Niklas_Hamb=FCchen?=) Date: Sun, 27 Jul 2014 00:03:57 +0200 Subject: [Haskell-cafe] [] \\ [1..] diverges - intended? In-Reply-To: References: <53D403D5.1070604@nh2.me> Message-ID: <53D425CD.9060707@nh2.me> On 26/07/14 22:55, Henk-Jan van Tuyl wrote: > You can define (\\) as follows, terminating in case of the samples you > gave: Yes, that's what I mean. Why is it not defined like that? > but this will not terminate in cases like: > [0] \\ [1..] Yes, this of course not terminate because it has to search for a 0 in the second list, which takes forever. But my question was about the first case: Was it intended (or is it specified) that (\\) cannot work on infinite lists? Otherwise maybe your implementation should replace the current one? From martin.drautzburg at web.de Sun Jul 27 10:44:05 2014 From: martin.drautzburg at web.de (martin) Date: Sun, 27 Jul 2014 12:44:05 +0200 Subject: [Haskell-cafe] Intuition to understand poor man's concurrency Message-ID: <53D4D7F5.5090904@web.de> Hello all, I am trying to understand the ideas of Koen Klaessen, published in Functional Pearls: "A poor man's concurrency" (1993). The code in the paper doesn't compile. E.g. uses "lambda dot" instead of "labmda arrow", i.e. the way the labmda calculus guys write things. Was that ever legal haskell or is this the result of some lhs2lex pretty printer? Anyways, I believe I was able to convert that into modern haskell syntax - at least it compiles. But I have trouble to understand the Monad instance presented there. Could anyobody walk me through the bind function? But even more important: how do you guys develop an intuition about what the bind operator does in a specific monad. I saw a Google tech talk where Douglas Crockford explains mondads in terms of Objects in javascript (https://www.youtube.com/watch?v=b0EF0VTs9Dc), which was certainly enlightening, but I couldn't apply it to this particular modad. I also tried using something like Data Flow Diagrams. This kinda works for simple Mondads such as the state mondad, but I couldn't apply it to the concurrency mondad. In general DFDs are not very good when it comes to higher order functions. In any case here is the code. I made it more verbose than necessary in order to understand it (bind was originally just one line), but to no avail. newtype C m a = C ((a -> Action m) -> Action m) instance Monad m => Monad (C m) where (C m) >>= k = C cont where cont c = m (\a -> let C h = k a in h c) return x = C $ \c -> c x data Action m = Atom (m (Action m)) | Fork (Action m) (Action m) | Stop From lambda.fairy at gmail.com Sun Jul 27 11:30:19 2014 From: lambda.fairy at gmail.com (Chris Wong) Date: Sun, 27 Jul 2014 23:30:19 +1200 Subject: [Haskell-cafe] Intuition to understand poor man's concurrency In-Reply-To: <53D4D7F5.5090904@web.de> References: <53D4D7F5.5090904@web.de> Message-ID: That looks like a continuation monad to me. `C m a` can also be expressed as `Cont (Action m) a`, where Cont is from the transformers library. In this case, I suggest looking at how the C type is used, rather than focusing on the Monad instance. Since it's all bog standard continuation passing so far, most likely the interesting part is elsewhere. I'm on my phone so I can't supply links, but I hope this helps a bit. On Jul 27, 2014 10:48 PM, "martin" wrote: > Hello all, > > I am trying to understand the ideas of Koen Klaessen, published in > Functional Pearls: "A poor man's concurrency" (1993). > > The code in the paper doesn't compile. E.g. uses "lambda dot" instead of > "labmda arrow", i.e. the way the labmda > calculus guys write things. Was that ever legal haskell or is this the > result of some lhs2lex pretty printer? > > Anyways, I believe I was able to convert that into modern haskell syntax - > at least it compiles. But I have trouble to > understand the Monad instance presented there. Could anyobody walk me > through the bind function? > > But even more important: how do you guys develop an intuition about what > the bind operator does in a specific monad. I > saw a Google tech talk where Douglas Crockford explains mondads in terms > of Objects in javascript > (https://www.youtube.com/watch?v=b0EF0VTs9Dc), which was certainly > enlightening, but I couldn't apply it to this > particular modad. > > I also tried using something like Data Flow Diagrams. This kinda works for > simple Mondads such as the state mondad, but > I couldn't apply it to the concurrency mondad. In general DFDs are not > very good when it comes to higher order functions. > > In any case here is the code. I made it more verbose than necessary in > order to understand it (bind was originally just > one line), but to no avail. > > > newtype C m a = C ((a -> Action m) -> Action m) > > instance Monad m => Monad (C m) where > (C m) >>= k = C cont > where > cont c = m (\a -> > let C h = k a > in h c) > return x = C $ \c -> c x > > > data Action m = > Atom (m (Action m)) > | Fork (Action m) (Action m) > | Stop > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Sun Jul 27 14:01:16 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Sun, 27 Jul 2014 10:01:16 -0400 Subject: [Haskell-cafe] Retrieving information about type families In-Reply-To: References: <51DC5BD6-6A19-4AB2-8E12-9AFC04A3678C@cis.upenn.edu> Message-ID: <48318BB6-282E-420B-9D1D-F42F58554E67@cis.upenn.edu> Ah, yes, that is a harder nut to crack. You would need to bring the type variables in type patterns into scope before typechecking. See the code for tc_fam_ty_pats in TcTyClsDecls for how this is done normally, but it's rather involved. As for querying existing structures, you may have a hard time. The problem is that types are handled differently from terms. Terms are typechecked and converted from HsExpr Name to HsExpr Id. The HsExpr Id has been typechecked and thus has stable type information. But, because it's a variant of HsExpr, it still has location information. HsExpr Id is then desugared into CoreExpr, which has no location information. Types, on the other hand, are checked and desugared simultaneously. This is necessary because typechecking needs to be able to compare types, and we wouldn't want to try to compare HsTypes for equality. So, instead of going through an HsType Id formation, the typechecker goes straight from HsType Name to Type (the Core type type). `Type`, of course, has no location information. So, you won't be able to query by location. But, I just thought of a way out: type family instances are compiled into CoAxioms, which *do* store location information. The list of CoAxioms should be available from the ModuleInfo via modInfoTyThings. Or, you can get a CoAxiom out of a FamInst if you have that handy. An open type family instance's CoAxiom will have one branch. Then, you can look at the tyvars (cab_tvs) and types (cab_lhs) to triangulate to the bit that you want. It's quite possible that the `Name`s of the tyvars have the location you're looking for. Be careful, because the list of tyvars includes kind variables here, which are omitted in the source. isKindVar should be helpful in filtering these out. I hope this helps! Richard On Jul 26, 2014, at 4:57 AM, Alejandro Serrano Mena wrote: > I'm still struggling with getting the right information. My aim is to know the kind of a specific variable in a type instance defintion. For example, if I get: > > type family F (x :: Bool) > type instance F y = () > ^ > > where ^ marks the point from where I want the information, I want to get "y has kind Bool". > > The approach I'm taking is obtaining the LHsType Name from the specific position in the RenamedSource of the file. Then, I'm trying to convert that LHsType Name to a Type using functions in HscTypes, but I always get complaints about not existing variables. > > In the past, I implemented something similar for normal functions. However, in that case I could get the information directly from TypecheckedSource, by querying for a pattern variable with the right location. However, in the TypecheckedSource there's no information about type families at all :( My other possibility seems to use the ModuleInfo, but in those places there's no information of location :( > > Is there any way to achieve what I'm trying to do (get the kind of a specific type variable in the LHS of a type family instance, where the variable is given by its position in the source code)? > > Thanks in advance. > > > 2014-07-25 18:12 GMT+02:00 Alejandro Serrano Mena : > Thanks for the help! At the end I'm trying to get the information from a RenamedSource (so I can still get source locations) and then get type information using TcHsType. I haven't succedeed yet, but I think I'm on the way! > > > 2014-07-23 23:38 GMT+02:00 Richard Eisenberg : > > Does FamInstEnv.lookupFamInstEnv work for you? You will also probably want FamInst.tcGetFamInstEnvs. > > Richard > > On Jul 23, 2014, at 2:48 PM, Alejandro Serrano Mena wrote: > > > Dear Caf?, > > My quest for obtaining information about type families continues. > > Now I have a simple question: how should I access the information about "type instance"s via the GHC API? My aim is to do so after type checking, that is, to get that information from a TypecheckedModule. However, I haven't yet been able to touch the right buttons to make it work ;( > > > > Thanks in advance, > > Alejandro > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jochen.keil at gmail.com Sun Jul 27 19:22:41 2014 From: jochen.keil at gmail.com (Jochen Keil) Date: Sun, 27 Jul 2014 21:22:41 +0200 Subject: [Haskell-cafe] Intuition to understand poor man's concurrency In-Reply-To: References: <53D4D7F5.5090904@web.de> Message-ID: <53D55181.6020904@gmail.com> On 27.07.2014 13:30, Chris Wong wrote: > That looks like a continuation monad to me. `C m a` can also be expressed > as `Cont (Action m) a`, where Cont is from the transformers library. I'm not sure if this fits properly here, but Continuation + Concurrency reminded me of a blog post by Neil Mitchell [1]. > On Jul 27, 2014 10:48 PM, "martin" wrote: >> Anyways, I believe I was able to convert that into modern haskell syntax - >> at least it compiles. But I have trouble to >> understand the Monad instance presented there. Could anyobody walk me >> through the bind function? In case it's the Continuation monad Chris mentioned (and I think he's right), you might enjoy Gabriel Gonzale's blog post about the Continuation monad [2], where he gives motivation, walks through the monad itself step by step and finally gives some examples. [1] http://neilmitchell.blogspot.com.es/2014/06/optimisation-with-continuations.html [2] http://www.haskellforall.com/2012/12/the-continuation-monad.html HTH, Jochen -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: OpenPGP digital signature URL: From trupill at gmail.com Sun Jul 27 20:23:11 2014 From: trupill at gmail.com (Alejandro Serrano Mena) Date: Sun, 27 Jul 2014 22:23:11 +0200 Subject: [Haskell-cafe] Retrieving information about type families In-Reply-To: <48318BB6-282E-420B-9D1D-F42F58554E67@cis.upenn.edu> References: <51DC5BD6-6A19-4AB2-8E12-9AFC04A3678C@cis.upenn.edu> <48318BB6-282E-420B-9D1D-F42F58554E67@cis.upenn.edu> Message-ID: Thanks for such a detailed answer :) I'll try to put this in practice as soon as possible 2014-07-27 16:01 GMT+02:00 Richard Eisenberg : > Ah, yes, that is a harder nut to crack. You would need to bring the type > variables in type patterns into scope before typechecking. See the code for > tc_fam_ty_pats in TcTyClsDecls for how this is done normally, but it's > rather involved. > > As for querying existing structures, you may have a hard time. The problem > is that types are handled differently from terms. Terms are typechecked and > converted from HsExpr Name to HsExpr Id. The HsExpr Id has been typechecked > and thus has stable type information. But, because it's a variant of > HsExpr, it still has location information. HsExpr Id is then desugared into > CoreExpr, which has no location information. > > Types, on the other hand, are checked and desugared simultaneously. This > is necessary because typechecking needs to be able to compare types, and we > wouldn't want to try to compare HsTypes for equality. So, instead of going > through an HsType Id formation, the typechecker goes straight from HsType > Name to Type (the Core type type). `Type`, of course, has no location > information. So, you won't be able to query by location. > > But, I just thought of a way out: type family instances are compiled into > CoAxioms, which *do* store location information. The list of CoAxioms > should be available from the ModuleInfo via modInfoTyThings. Or, you can > get a CoAxiom out of a FamInst if you have that handy. An open type family > instance's CoAxiom will have one branch. Then, you can look at the tyvars > (cab_tvs) and types (cab_lhs) to triangulate to the bit that you want. It's > quite possible that the `Name`s of the tyvars have the location you're > looking for. Be careful, because the list of tyvars includes kind variables > here, which are omitted in the source. isKindVar should be helpful in > filtering these out. > > I hope this helps! > Richard > > On Jul 26, 2014, at 4:57 AM, Alejandro Serrano Mena > wrote: > > I'm still struggling with getting the right information. My aim is to know > the kind of a specific variable in a type instance defintion. For example, > if I get: > > type family F (x :: Bool) > type instance F y = () > ^ > > where ^ marks the point from where I want the information, I want to get " > y has kind Bool". > > The approach I'm taking is obtaining the LHsType Name from the specific > position in the RenamedSource of the file. Then, I'm trying to convert > that LHsType Name to a Type using functions in HscTypes, but I always get > complaints about not existing variables. > > In the past, I implemented something similar for normal functions. > However, in that case I could get the information directly from > TypecheckedSource, by querying for a pattern variable with the right > location. However, in the TypecheckedSource there's no information about > type families at all :( My other possibility seems to use the ModuleInfo, > but in those places there's no information of location :( > > Is there any way to achieve what I'm trying to do (get the kind of a > specific type variable in the LHS of a type family instance, where the > variable is given by its position in the source code)? > > Thanks in advance. > > > 2014-07-25 18:12 GMT+02:00 Alejandro Serrano Mena : > >> Thanks for the help! At the end I'm trying to get the information from a >> RenamedSource (so I can still get source locations) and then get type >> information using TcHsType. I haven't succedeed yet, but I think I'm on the >> way! >> >> >> 2014-07-23 23:38 GMT+02:00 Richard Eisenberg : >> >> Does FamInstEnv.lookupFamInstEnv work for you? You will also probably >>> want FamInst.tcGetFamInstEnvs. >>> >>> Richard >>> >>> On Jul 23, 2014, at 2:48 PM, Alejandro Serrano Mena >>> wrote: >>> >>> > Dear Caf?, >>> > My quest for obtaining information about type families continues. >>> > Now I have a simple question: how should I access the information >>> about "type instance"s via the GHC API? My aim is to do so after type >>> checking, that is, to get that information from a TypecheckedModule. >>> However, I haven't yet been able to touch the right buttons to make it work >>> ;( >>> > >>> > Thanks in advance, >>> > Alejandro >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Mon Jul 28 05:46:53 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Mon, 28 Jul 2014 13:46:53 +0800 Subject: [Haskell-cafe] Problem with existential type and instance. Message-ID: Hi, For code like below, how to make it compilable? data EventHandlers = forall m. MonadIO m => EventHandlers { onDeleteWindow :: Maybe (m ()) } instance Default EventHandlers where def = EventHandlers Nothing -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Mon Jul 28 07:47:34 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Mon, 28 Jul 2014 10:47:34 +0300 Subject: [Haskell-cafe] Problem with existential type and instance. In-Reply-To: References: Message-ID: <20140728074734.GA4884@sniper> * Magicloud Magiclouds [2014-07-28 13:46:53+0800] > Hi, > > For code like below, how to make it compilable? > > data EventHandlers = forall m. MonadIO m => EventHandlers { onDeleteWindow > :: Maybe (m ()) } > instance Default EventHandlers where > def = EventHandlers Nothing GHC has to store some MonadIO dictionary in the existential type, but it cannot figure out which dictionary to store (it can be any). You can tell it which one to use by supplying a type annotation, e.g.: def = EventHandlers (Nothing :: Maybe (IO ())) Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From magicloud.magiclouds at gmail.com Mon Jul 28 07:50:05 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Mon, 28 Jul 2014 15:50:05 +0800 Subject: [Haskell-cafe] Problem with existential type and instance. In-Reply-To: <20140728074734.GA4884@sniper> References: <20140728074734.GA4884@sniper> Message-ID: I see. Thank you. Any anyway I could use (MonadIO m) here, in Nothing data type? On Mon, Jul 28, 2014 at 3:47 PM, Roman Cheplyaka wrote: > * Magicloud Magiclouds [2014-07-28 > 13:46:53+0800] > > Hi, > > > > For code like below, how to make it compilable? > > > > data EventHandlers = forall m. MonadIO m => EventHandlers { > onDeleteWindow > > :: Maybe (m ()) } > > instance Default EventHandlers where > > def = EventHandlers Nothing > > GHC has to store some MonadIO dictionary in the existential type, but it > cannot > figure out which dictionary to store (it can be any). > > You can tell it which one to use by supplying a type annotation, e.g.: > > def = EventHandlers (Nothing :: Maybe (IO ())) > > Roman > -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Mon Jul 28 08:04:56 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Mon, 28 Jul 2014 11:04:56 +0300 Subject: [Haskell-cafe] Problem with existential type and instance. In-Reply-To: References: <20140728074734.GA4884@sniper> Message-ID: <20140728080456.GA5789@sniper> What do you mean? MonadIO m is a constraint. You have to supply some type that satisfies this constraint. IO is one such type; you could use any other. Alternatively, if you *don't* want to store a MonadIO dictionary in the Nothing case, create your own Maybe type: data MaybeMonadIO = NoMonadIO | forall m . MonadIO m => JustMonadIO (m ()) newtype EventHandlers = EventHandlers { onDeleteWindow :: MaybeMonadIO } * Magicloud Magiclouds [2014-07-28 15:50:05+0800] > I see. Thank you. > > Any anyway I could use (MonadIO m) here, in Nothing data type? > > > On Mon, Jul 28, 2014 at 3:47 PM, Roman Cheplyaka wrote: > > > * Magicloud Magiclouds [2014-07-28 > > 13:46:53+0800] > > > Hi, > > > > > > For code like below, how to make it compilable? > > > > > > data EventHandlers = forall m. MonadIO m => EventHandlers { > > onDeleteWindow > > > :: Maybe (m ()) } > > > instance Default EventHandlers where > > > def = EventHandlers Nothing > > > > GHC has to store some MonadIO dictionary in the existential type, but it > > cannot > > figure out which dictionary to store (it can be any). > > > > You can tell it which one to use by supplying a type annotation, e.g.: > > > > def = EventHandlers (Nothing :: Maybe (IO ())) > > > > Roman > > > > > > -- > ??????? > ??????? > > And for G+, please use magiclouds#gmail.com. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From magicloud.magiclouds at gmail.com Mon Jul 28 08:13:40 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Mon, 28 Jul 2014 16:13:40 +0800 Subject: [Haskell-cafe] Problem with existential type and instance. In-Reply-To: <20140728080456.GA5789@sniper> References: <20140728074734.GA4884@sniper> <20140728080456.GA5789@sniper> Message-ID: I think that is what I need. Thanks. On Mon, Jul 28, 2014 at 4:04 PM, Roman Cheplyaka wrote: > What do you mean? MonadIO m is a constraint. You have to supply some type > that > satisfies this constraint. IO is one such type; you could use any other. > > Alternatively, if you *don't* want to store a MonadIO dictionary in the > Nothing > case, create your own Maybe type: > > data MaybeMonadIO > = NoMonadIO > | forall m . MonadIO m => JustMonadIO (m ()) > > newtype EventHandlers = EventHandlers { onDeleteWindow :: MaybeMonadIO } > > * Magicloud Magiclouds [2014-07-28 > 15:50:05+0800] > > I see. Thank you. > > > > Any anyway I could use (MonadIO m) here, in Nothing data type? > > > > > > On Mon, Jul 28, 2014 at 3:47 PM, Roman Cheplyaka > wrote: > > > > > * Magicloud Magiclouds [2014-07-28 > > > 13:46:53+0800] > > > > Hi, > > > > > > > > For code like below, how to make it compilable? > > > > > > > > data EventHandlers = forall m. MonadIO m => EventHandlers { > > > onDeleteWindow > > > > :: Maybe (m ()) } > > > > instance Default EventHandlers where > > > > def = EventHandlers Nothing > > > > > > GHC has to store some MonadIO dictionary in the existential type, but > it > > > cannot > > > figure out which dictionary to store (it can be any). > > > > > > You can tell it which one to use by supplying a type annotation, e.g.: > > > > > > def = EventHandlers (Nothing :: Maybe (IO ())) > > > > > > Roman > > > > > > > > > > > -- > > ??????? > > ??????? > > > > And for G+, please use magiclouds#gmail.com. > -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Mon Jul 28 08:19:05 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Mon, 28 Jul 2014 11:19:05 +0300 Subject: [Haskell-cafe] Problem with existential type and instance. In-Reply-To: References: <20140728074734.GA4884@sniper> <20140728080456.GA5789@sniper> Message-ID: <20140728081905.GA6307@sniper> On a second thought, you don't have to recreate Maybe; you can get away with a simple wrapper data SomeMonadIO = forall m . MonadIO m => SomeMonadIO (m ()) newtype EventHandlers = EventHandlers { onDeleteWindow :: Maybe SomeMonadIO } Roman * Magicloud Magiclouds [2014-07-28 16:13:40+0800] > I think that is what I need. Thanks. > > > On Mon, Jul 28, 2014 at 4:04 PM, Roman Cheplyaka wrote: > > > What do you mean? MonadIO m is a constraint. You have to supply some type > > that > > satisfies this constraint. IO is one such type; you could use any other. > > > > Alternatively, if you *don't* want to store a MonadIO dictionary in the > > Nothing > > case, create your own Maybe type: > > > > data MaybeMonadIO > > = NoMonadIO > > | forall m . MonadIO m => JustMonadIO (m ()) > > > > newtype EventHandlers = EventHandlers { onDeleteWindow :: MaybeMonadIO } > > > > * Magicloud Magiclouds [2014-07-28 > > 15:50:05+0800] > > > I see. Thank you. > > > > > > Any anyway I could use (MonadIO m) here, in Nothing data type? > > > > > > > > > On Mon, Jul 28, 2014 at 3:47 PM, Roman Cheplyaka > > wrote: > > > > > > > * Magicloud Magiclouds [2014-07-28 > > > > 13:46:53+0800] > > > > > Hi, > > > > > > > > > > For code like below, how to make it compilable? > > > > > > > > > > data EventHandlers = forall m. MonadIO m => EventHandlers { > > > > onDeleteWindow > > > > > :: Maybe (m ()) } > > > > > instance Default EventHandlers where > > > > > def = EventHandlers Nothing > > > > > > > > GHC has to store some MonadIO dictionary in the existential type, but > > it > > > > cannot > > > > figure out which dictionary to store (it can be any). > > > > > > > > You can tell it which one to use by supplying a type annotation, e.g.: > > > > > > > > def = EventHandlers (Nothing :: Maybe (IO ())) > > > > > > > > Roman > > > > > > > > > > > > > > > > -- > > > ??????? > > > ??????? > > > > > > And for G+, please use magiclouds#gmail.com. > > > > > > -- > ??????? > ??????? > > And for G+, please use magiclouds#gmail.com. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From difrumin at gmail.com Mon Jul 28 14:10:38 2014 From: difrumin at gmail.com (Daniil Frumin) Date: Mon, 28 Jul 2014 18:10:38 +0400 Subject: [Haskell-cafe] [] \\ [1..] diverges - intended? In-Reply-To: References: <53D403D5.1070604@nh2.me> Message-ID: Hi! On Sun, Jul 27, 2014 at 12:55 AM, Henk-Jan van Tuyl wrote: > On Sat, 26 Jul 2014 21:39:01 +0200, Niklas Hamb?chen wrote: > >> Hi, >> >> I just noticed that >> >> import Data.List >> [] \\ [1..] >> >> diverges, although technically it doesn't have to (the docs suggest to >> me that it could just be [], and a non-diverging implementation is >> possible). >> >> Same for [1,2] \\ [1..] of course. >> > > You can define (\\) as follows, terminating in case of the samples you gave: > > (\\) :: (Eq a) => [a] -> [a] -> [a] > (\\) [] _ = [] > (\\) _ [] = [] > (\\) xs (y : ys) = delete y xs \\ ys > Is this actually correct? Shouldn't the second line be (\\) x [] = x ? > but this will not terminate in cases like: > [0] \\ [1..] > > I don't think there is a way to get this terminating for all cases. > > Regards, > Henk-Jan van Tuyl > > > -- > Folding at home > What if you could share your unused computer power to help find a cure? In > just 5 minutes you can join the world's biggest networked computer and get > us closer sooner. Watch the video. > http://folding.stanford.edu/ > > > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Sincerely yours, -- Daniil From eir at cis.upenn.edu Mon Jul 28 14:27:17 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Mon, 28 Jul 2014 10:27:17 -0400 Subject: [Haskell-cafe] =?utf-8?q?Hac_=CF=86_=28Philadelphia=29=3A_Oct_17-?= =?utf-8?q?19=2C_2014?= Message-ID: Hac ?, the annual Haskell Hackathon held in Philadelphia, PA, USA, will take place Fri-Sun, Oct. 17-19, 2014. Registration is free, and all levels of Haskellers are welcome. Come join us for a weekend of programming and camaraderie. Bring your own project to work on or organize on the wiki page to join another's project. All the info, including registration link, is here: http://www.haskell.org/haskellwiki/Hac_Phi Professional Haskellers: if you work for an organization that might want to help sponsor this event, please email me. Note: This event has previously taken place during summer, but will be in October this year. Hope to see you in Philly this fall! Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at functionaljobs.com Mon Jul 28 16:00:01 2014 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 28 Jul 2014 12:00:01 -0400 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <53d67384f2709@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Senior Haskell Developer at Plow Technologies http://functionaljobs.com/jobs/8726-senior-haskell-developer-at-plow-technologies CTO / Tech Co-Founder at Capital Match http://functionaljobs.com/jobs/8725-cto-tech-co-founder-at-capital-match Cheers, Sean Murphy FunctionalJobs.com From hjgtuyl at chello.nl Mon Jul 28 16:31:50 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Mon, 28 Jul 2014 18:31:50 +0200 Subject: [Haskell-cafe] [] \\ [1..] diverges - intended? In-Reply-To: References: <53D403D5.1070604@nh2.me> Message-ID: On Mon, 28 Jul 2014 16:10:38 +0200, Daniil Frumin wrote: > Hi! > > On Sun, Jul 27, 2014 at 12:55 AM, Henk-Jan van Tuyl > wrote: >> (\\) :: (Eq a) => [a] -> [a] -> [a] >> (\\) [] _ = [] >> (\\) _ [] = [] >> (\\) xs (y : ys) = delete y xs \\ ys >> > > Is this actually correct? Shouldn't the second line be > > (\\) x [] = x > > ? You are right; as it was just to prove a point I didn't spend enough time reviewing/testing it. My life would have been much easier if I had chosen an area of expertise where showing my diploma was enough to prove that I am right. Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From martin.drautzburg at web.de Mon Jul 28 19:22:31 2014 From: martin.drautzburg at web.de (martin) Date: Mon, 28 Jul 2014 21:22:31 +0200 Subject: [Haskell-cafe] Intuition to understand ... In-Reply-To: <53D55181.6020904@gmail.com> References: <53D4D7F5.5090904@web.de> <53D55181.6020904@gmail.com> Message-ID: <53D6A2F7.7040004@web.de> Am 07/27/2014 09:22 PM, schrieb Jochen Keil: > In case it's the Continuation monad Chris mentioned (and I think he's right) I believe so too. But I still have trouble understanding it. Let's forget about this particular monad for a while and focus on intuition in general. I managed to dissect the continuation monad and write the bind operator correctly. But it took me hours and the train of thought is very elusive. I wouldn't call this "understanding". When I truly understand things I can come up with analogies, counter examples and the like. I can draw diagrams to visualize the thing. I can embed the new thing into a world of old things. But I cannot do any of these things with the Continuation Monad. Right now I am trying to get there by staring at it, asking myself questions, trying to write bind in different ways - hoping that one day it will click. Someone on the web said that this (hard work) is the only way. Douglas Crockford said that monads come with a curse, that is as soon as you understand them you loose the ability to explain them to anyone else. Someone else said, the way to a monad's heart is through its Kleisli arrow. So I wonder what you guys do to develop intuition about tricky haskell things, such as the Continuation monad. From hoerdegen at funktional.info Mon Jul 28 20:10:13 2014 From: hoerdegen at funktional.info (=?ISO-8859-15?Q?Heinrich_H=F6rdegen?=) Date: Mon, 28 Jul 2014 22:10:13 +0200 Subject: [Haskell-cafe] Munich Haskell Meeting Message-ID: <53D6AE25.7050202@funktional.info> Dear all, on Wednesday, 30th of July, once again our monthly Haskell Meeting takes place. We meet at 19h30 at Max-Emanuel-Brauerei in Munich. If you plan to join, please go here to find the details and don't forget to click the button: http://www.haskell-munich.de/dates Have a nice evening, Heinrich From mark.lentczner at gmail.com Tue Jul 29 03:31:48 2014 From: mark.lentczner at gmail.com (Mark Lentczner) Date: Mon, 28 Jul 2014 20:31:48 -0700 Subject: [Haskell-cafe] early adopters rejoyce! Haskell Platform 2014.2.0.0 Release Candidate 2 Message-ID: The long anticipated Haskell Platform 2014.2 release, including GHC 7.8.3, and numerous updated packages, is almost here! We have created "Release Candidate 2" installers for OS X and Windows, and believe, barring show stopper issues, creepers exploding, or unexpected trips to the nether, these will likely be blessed as the final by the end of the week. If you would like to be an early adopter, please try 'em out... - source tarball: haskell-platform-2014.2.0.0-RC2.tar.gz - source repo: haskell/haskell-platform at 2014.2.0.0-RC2 - windows 32bit: hskellPlatform-2014.2.0.0-i386-RC2-setup.exe - windows 64bit:hskellPlatform-2014.2.0.0-x86_64-RC2-setup.exe - os x 64bit: Haskell Platform 2014.2.0.0 64bit RC2.signed.pkg - travis-ci build: haskell/haskell-platform *Short Notes for RC2, read these if nothing else:* *General* - includes GHC 7.8.3 - includes long awaited updates to OpenGL & GLUT packages - most other packages brought up to date (or nearly so) - website is still woefully out of date... will work on it this week *Windows* *Extra thanks to Randy Polen for burning the midnight-oil to get ths out* - removed unneeded python (et al) files from the GHC bindist for 64-bit Windows (referenced in GHC ticket #9014 ) - added HTML "view source" pages for the GHC packages that was missing from the GHC bindist for both 32- and 64-bit Windows. *Mac OS X* *If you installed RC1 or older versions of the platform, you can remove them first with the command *sudo uninstall-hs only 7.8.3 --remove *Run it without *--remove* to see what it will do first, it if you like. You can also just install this one right on top of RC1. If you have older 7.8.3 installs from other distributions (bindist, built from src, etc...) you may want to manually remove them first... YMMV.**. Yoda says: "When doubt you have, the $PATH examine, you must!"* - works on 10.6! and 10.7, 10.8, and 10.9; with gcc or clang based Xcodes - works on 10.10!!! (Yosemite, developer preview 4 release) - works with clang out of the box, and haddock build issues with clang, fixed. *N.B.: If you have hand installed cabal 1.20, please be sure it uses Cabal 1.20.0.2 to fix the haddock issue. The platform on OS X includes cabal 1.18, using 1.18.1.4, which fixes the problem.* *Source tarball* - uses new build machinery... all the kinks may not be worked out, and not all build featuers (notably a --prefix command) are implemented yet. This doesn't affect the content of the Platform, though. - generic *nix builds, and specific distribution builds are forth coming (though feel free to chip in and help!) *Longer Notes for RC2:* *General* - Built with the new shake based build system - cgi package not included as it doesn't build under 7.8, and no word from the maintainer in quite some time - hscolour is included as a tool, mostly as it is used to build the platform itself on win and mac... but technically it isn't part of the platform - the haskell-platform package itself is not in these releases... it never contained anything other than dependencies. *Windows* - The Haskell Platform now provides a native Windows 64-bit installation (haskell-platform issue #54 ) - All included packages built without --enable-split-objs (GHC 7.8 FAQ ) - All included packages built without --enable-shared (GHC ticket #8228 ) - If other Haskell Platform installations are detected during the installation of Haskell Platform 2014.2.0.0, a warning is displayed to the user that this is not recommended since problems will arise due to how the PATH is used in many cases to find ancillary build tools - Using ghci to build an executable that links against a DLL may result in numerous warnings about symbols (GHC ticket #9297 ) - The Haskell Platform for Windows, both 32-bit and 64-bit, now includes an updated version of the OpenGL Utility Toolkit (GLUT) from the FreeGLUT project, utilizing the pre-built distribution from http://www.transmissionzero.co.uk/software/freeglut-devel/ with the MinGW build (freeglut-MinGW-2.8.1-1.mp.zip). (haskell-platform issue #81 ) *Mac OS X* - file layout on the Mac has improved. In particular, executables are now installed directly in $prefix/bin dirs, rather than within the package dir - Distributed with a build of 7.8.3 that differs from the released bindist in two ways: a) it was built split-objs for smaller resulting executables, b) it includes Cabal-1.18.1.4 which fixes a particularly nasty problem with haddock, -XCPP, and clang based systems. This ghc-7.8.3 bindist is available as well: - ghc-7.8.3-x86_64-apple-darwin-r3.tar.bz2 - haddocks finally cross link between packages correctly - includes a new experimental activate-hs command that can switch between multiple installed versions of the platform - includes a slightly updated uninstall-hs command - the cabal command is wrapped to provide a smoother file layout on the Mac... the wrapping only updates the ~/.cabal/config file the first time you run it.. please pay attention to its output - if you have a custom config file, you'll want to update it, as Cabal's defaults have changed *Timetable* - End of this week (from my vacation, I'll point out), we'll declare success and rename the files. ? Mark *SHA-256 sums :* 62f39246ad95dd2aed6ece5138f6297f945d2b450f215d074820294310e0c48a Haskell Platform 2014.2.0.0 64bit RC2.signed.pkg 7c7d3585e89e1407461efea29dcaa9628c3be3c47d93a13b5a4978046375e4fd haskell-platform-2014.2.0.0-RC2.tar.gz 6eedd76aafb266d9a09baff80cd2973498ab59195c771f7cd64425d40be29c49 hskellPlatform-2014.2.0.0-i386-RC2-setup.exe b22115ed84d1f7e747d7f0b47e32e1489e4a24613d69c91df4ae32052f88b130 hskellPlatform-2014.2.0.0-x86_64-RC2-setup.exe -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell.ye.yan at gmail.com Tue Jul 29 05:52:39 2014 From: haskell.ye.yan at gmail.com (ye yan) Date: Mon, 28 Jul 2014 22:52:39 -0700 (PDT) Subject: [Haskell-cafe] How to update a cabal dependency automatically Message-ID: <39801184-f9e5-47ac-9638-a3361fc60187@googlegroups.com> I have been working on a haskell scotty project recently. I have just added configuration support for the project, which added an extra dependency of Control.Lens. My question is: is there a way update .cabal file automatically, just like cabal init but without recreate .cabal file? Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Tue Jul 29 06:29:29 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Tue, 29 Jul 2014 14:29:29 +0800 Subject: [Haskell-cafe] Deduce issue. Message-ID: Hi, I have code like follow. And compiling gave me error as the last part. What should I do? ``` class WidgetClass w data Widget = forall a. WidgetClass a => Widget a instance WidgetClass Widget lookupWin :: (WidgetClass w) => WINDOW -> w -> Maybe w lookupWin xwin widget = if widgetWindowId widget == xwin then Just widget else foldl (\a (Widget b) -> maybe (lookupWin xwin b) Just a ) Nothing $ widgetChildren widget ``` --- ``` Graphics/HUI/Widget.hs:15:23: Could not deduce (w ~ a) from the context (WidgetClass w) bound by the type signature for lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w at Graphics/HUI/Widget.hs:10:14-54 or from (WidgetClass a) bound by a pattern with constructor Widget :: forall a. WidgetClass a => a -> Widget, in a lambda abstraction at Graphics/HUI/Widget.hs:14:19-26 ?w? is a rigid type variable bound by the type signature for lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w at Graphics/HUI/Widget.hs:10:14 ?a? is a rigid type variable bound by a pattern with constructor Widget :: forall a. WidgetClass a => a -> Widget, in a lambda abstraction at Graphics/HUI/Widget.hs:14:19 Expected type: Maybe w Actual type: Maybe a Relevant bindings include b :: a (bound at Graphics/HUI/Widget.hs:14:26) a :: Maybe w (bound at Graphics/HUI/Widget.hs:14:16) widget :: w (bound at Graphics/HUI/Widget.hs:11:16) lookupWin :: WINDOW -> w -> Maybe w (bound at Graphics/HUI/Widget.hs:11:1) In the first argument of ?maybe?, namely ?(lookupWin xwin b)? In the expression: maybe (lookupWin xwin b) Just a ``` -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Tue Jul 29 06:31:03 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Tue, 29 Jul 2014 14:31:03 +0800 Subject: [Haskell-cafe] Deduce issue. In-Reply-To: References: Message-ID: Sorry, missed a line of `class WidgetClass w`. ``` class WidgetClass w where widgetChildren :: w -> [Widget] ``` On Tue, Jul 29, 2014 at 2:29 PM, Magicloud Magiclouds < magicloud.magiclouds at gmail.com> wrote: > Hi, > > I have code like follow. And compiling gave me error as the last part. > What should I do? > > ``` > class WidgetClass w > data Widget = forall a. WidgetClass a => Widget a > instance WidgetClass Widget > > lookupWin :: (WidgetClass w) => WINDOW -> w -> Maybe w > lookupWin xwin widget = > if widgetWindowId widget == xwin > then Just widget > else foldl (\a (Widget b) -> > maybe (lookupWin xwin b) Just a > ) Nothing $ widgetChildren widget > ``` > --- > ``` > Graphics/HUI/Widget.hs:15:23: > Could not deduce (w ~ a) > from the context (WidgetClass w) > bound by the type signature for > lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w > at Graphics/HUI/Widget.hs:10:14-54 > or from (WidgetClass a) > bound by a pattern with constructor > Widget :: forall a. WidgetClass a => a -> Widget, > in a lambda abstraction > at Graphics/HUI/Widget.hs:14:19-26 > ?w? is a rigid type variable bound by > the type signature for > lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w > at Graphics/HUI/Widget.hs:10:14 > ?a? is a rigid type variable bound by > a pattern with constructor > Widget :: forall a. WidgetClass a => a -> Widget, > in a lambda abstraction > at Graphics/HUI/Widget.hs:14:19 > Expected type: Maybe w > Actual type: Maybe a > Relevant bindings include > b :: a (bound at Graphics/HUI/Widget.hs:14:26) > a :: Maybe w (bound at Graphics/HUI/Widget.hs:14:16) > widget :: w (bound at Graphics/HUI/Widget.hs:11:16) > lookupWin :: WINDOW -> w -> Maybe w > (bound at Graphics/HUI/Widget.hs:11:1) > In the first argument of ?maybe?, namely ?(lookupWin xwin b)? > In the expression: maybe (lookupWin xwin b) Just a > ``` > -- > ??????? > ??????? > > And for G+, please use magiclouds#gmail.com. > -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Tue Jul 29 07:04:10 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Tue, 29 Jul 2014 15:04:10 +0800 Subject: [Haskell-cafe] Deduce issue. In-Reply-To: References: Message-ID: I can see this is because of existential type used in Widget. But removing it would make a lot of other types using a type var for no reason. On Tue, Jul 29, 2014 at 2:31 PM, Magicloud Magiclouds < magicloud.magiclouds at gmail.com> wrote: > Sorry, missed a line of `class WidgetClass w`. > > ``` > class WidgetClass w where > widgetChildren :: w -> [Widget] > ``` > > > On Tue, Jul 29, 2014 at 2:29 PM, Magicloud Magiclouds < > magicloud.magiclouds at gmail.com> wrote: > >> Hi, >> >> I have code like follow. And compiling gave me error as the last part. >> What should I do? >> >> ``` >> class WidgetClass w >> data Widget = forall a. WidgetClass a => Widget a >> instance WidgetClass Widget >> >> lookupWin :: (WidgetClass w) => WINDOW -> w -> Maybe w >> lookupWin xwin widget = >> if widgetWindowId widget == xwin >> then Just widget >> else foldl (\a (Widget b) -> >> maybe (lookupWin xwin b) Just a >> ) Nothing $ widgetChildren widget >> ``` >> --- >> ``` >> Graphics/HUI/Widget.hs:15:23: >> Could not deduce (w ~ a) >> from the context (WidgetClass w) >> bound by the type signature for >> lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w >> at Graphics/HUI/Widget.hs:10:14-54 >> or from (WidgetClass a) >> bound by a pattern with constructor >> Widget :: forall a. WidgetClass a => a -> Widget, >> in a lambda abstraction >> at Graphics/HUI/Widget.hs:14:19-26 >> ?w? is a rigid type variable bound by >> the type signature for >> lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w >> at Graphics/HUI/Widget.hs:10:14 >> ?a? is a rigid type variable bound by >> a pattern with constructor >> Widget :: forall a. WidgetClass a => a -> Widget, >> in a lambda abstraction >> at Graphics/HUI/Widget.hs:14:19 >> Expected type: Maybe w >> Actual type: Maybe a >> Relevant bindings include >> b :: a (bound at Graphics/HUI/Widget.hs:14:26) >> a :: Maybe w (bound at Graphics/HUI/Widget.hs:14:16) >> widget :: w (bound at Graphics/HUI/Widget.hs:11:16) >> lookupWin :: WINDOW -> w -> Maybe w >> (bound at Graphics/HUI/Widget.hs:11:1) >> In the first argument of ?maybe?, namely ?(lookupWin xwin b)? >> In the expression: maybe (lookupWin xwin b) Just a >> ``` >> -- >> ??????? >> ??????? >> >> And for G+, please use magiclouds#gmail.com. >> > > > > -- > ??????? > ??????? > > And for G+, please use magiclouds#gmail.com. > -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From magicloud.magiclouds at gmail.com Tue Jul 29 08:44:47 2014 From: magicloud.magiclouds at gmail.com (Magicloud Magiclouds) Date: Tue, 29 Jul 2014 16:44:47 +0800 Subject: [Haskell-cafe] Deduce issue. In-Reply-To: References: Message-ID: I should just use Widget I defined. Why not before.... But then I am confused on type cast again. How to extract the existential type inside Widget? On Tue, Jul 29, 2014 at 3:04 PM, Magicloud Magiclouds < magicloud.magiclouds at gmail.com> wrote: > I can see this is because of existential type used in Widget. But removing > it would make a lot of other types using a type var for no reason. > > > On Tue, Jul 29, 2014 at 2:31 PM, Magicloud Magiclouds < > magicloud.magiclouds at gmail.com> wrote: > >> Sorry, missed a line of `class WidgetClass w`. >> >> ``` >> class WidgetClass w where >> widgetChildren :: w -> [Widget] >> ``` >> >> >> On Tue, Jul 29, 2014 at 2:29 PM, Magicloud Magiclouds < >> magicloud.magiclouds at gmail.com> wrote: >> >>> Hi, >>> >>> I have code like follow. And compiling gave me error as the last part. >>> What should I do? >>> >>> ``` >>> class WidgetClass w >>> data Widget = forall a. WidgetClass a => Widget a >>> instance WidgetClass Widget >>> >>> lookupWin :: (WidgetClass w) => WINDOW -> w -> Maybe w >>> lookupWin xwin widget = >>> if widgetWindowId widget == xwin >>> then Just widget >>> else foldl (\a (Widget b) -> >>> maybe (lookupWin xwin b) Just a >>> ) Nothing $ widgetChildren widget >>> ``` >>> --- >>> ``` >>> Graphics/HUI/Widget.hs:15:23: >>> Could not deduce (w ~ a) >>> from the context (WidgetClass w) >>> bound by the type signature for >>> lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w >>> at Graphics/HUI/Widget.hs:10:14-54 >>> or from (WidgetClass a) >>> bound by a pattern with constructor >>> Widget :: forall a. WidgetClass a => a -> Widget, >>> in a lambda abstraction >>> at Graphics/HUI/Widget.hs:14:19-26 >>> ?w? is a rigid type variable bound by >>> the type signature for >>> lookupWin :: WidgetClass w => WINDOW -> w -> Maybe w >>> at Graphics/HUI/Widget.hs:10:14 >>> ?a? is a rigid type variable bound by >>> a pattern with constructor >>> Widget :: forall a. WidgetClass a => a -> Widget, >>> in a lambda abstraction >>> at Graphics/HUI/Widget.hs:14:19 >>> Expected type: Maybe w >>> Actual type: Maybe a >>> Relevant bindings include >>> b :: a (bound at Graphics/HUI/Widget.hs:14:26) >>> a :: Maybe w (bound at Graphics/HUI/Widget.hs:14:16) >>> widget :: w (bound at Graphics/HUI/Widget.hs:11:16) >>> lookupWin :: WINDOW -> w -> Maybe w >>> (bound at Graphics/HUI/Widget.hs:11:1) >>> In the first argument of ?maybe?, namely ?(lookupWin xwin b)? >>> In the expression: maybe (lookupWin xwin b) Just a >>> ``` >>> -- >>> ??????? >>> ??????? >>> >>> And for G+, please use magiclouds#gmail.com. >>> >> >> >> >> -- >> ??????? >> ??????? >> >> And for G+, please use magiclouds#gmail.com. >> > > > > -- > ??????? > ??????? > > And for G+, please use magiclouds#gmail.com. > -- ??????? ??????? And for G+, please use magiclouds#gmail.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chriswarbo at googlemail.com Tue Jul 29 09:09:44 2014 From: chriswarbo at googlemail.com (Chris Warburton) Date: Tue, 29 Jul 2014 10:09:44 +0100 Subject: [Haskell-cafe] Intuition to understand ... In-Reply-To: <53D6A2F7.7040004@web.de> (martin's message of "Mon, 28 Jul 2014 21:22:31 +0200") References: <53D4D7F5.5090904@web.de> <53D55181.6020904@gmail.com> <53D6A2F7.7040004@web.de> Message-ID: <86bns8bkfb.fsf@gmail.com> martin writes: > Let's forget about this particular monad for a while and focus on > intuition in general. > > I managed to dissect the continuation monad and write the bind > operator correctly. But it took me hours and the train of thought is > very elusive. I wouldn't call this "understanding". > > When I truly understand things I can come up with analogies, counter > examples and the like. I can draw diagrams to visualize the thing. I > can embed the new thing into a world of old things. > > But I cannot do any of these things with the Continuation Monad. Right > now I am trying to get there by staring at it, asking myself > questions, trying to write bind in different ways - hoping that one > day it will click. > > So I wonder what you guys do to develop intuition about tricky haskell > things, such as the Continuation monad. Bind can often be a bit tricky. I usually find it easier to define bind as: > x >>= f = join (fmap f x) Then ignore it and focus on fmap and join instead. This is a 'divide and conquer' approach. > fmap :: (Functor f) => (a -> b) -> f a -> f b This is the usual Functor method. We can ignore all the monadic stuff when defining it, which makes our life easier. With fmap defined, we can turn "f :: a -> m b" and "x :: m a" into "fmap f x :: m (m b)" > join :: (Monad m) => m (m a) -> m a This needs to turn two nested monadic "wrappers" into one, using some logic specific to our monad. I find this easier to think about than bind since we're now only dealing with one argument. Cheers, Chris From alexander at plaimi.net Tue Jul 29 11:47:49 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Tue, 29 Jul 2014 13:47:49 +0200 Subject: [Haskell-cafe] How to update a cabal dependency automatically In-Reply-To: <39801184-f9e5-47ac-9638-a3361fc60187@googlegroups.com> References: <39801184-f9e5-47ac-9638-a3361fc60187@googlegroups.com> Message-ID: <53D789E5.6020709@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 29/07/14 07:52, ye yan wrote: > I have been working on a haskell scotty project recently. I have > just added configuration support for the project, which added an > extra dependency of Control.Lens. My question is: is there a way > update .cabal file automatically, just like cabal init but without > recreate .cabal file? No. I've been planning to work on that, but haven't had the time yet. Thanks for the reminder. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlPXieUACgkQRtClrXBQc7VsQQD+PB/Tyr7S/a5SGE+aN0CgKWHu RFcn35Eqi8jgsaPs/rAA/3/IqdT9DyFZGiYZXHm4m7ndSQyQvy8CZ5pVv+5QlcDN =h5Ex -----END PGP SIGNATURE----- From haskell.ye.yan at gmail.com Tue Jul 29 12:32:54 2014 From: haskell.ye.yan at gmail.com (ye yan) Date: Tue, 29 Jul 2014 05:32:54 -0700 (PDT) Subject: [Haskell-cafe] How to update a cabal dependency automatically In-Reply-To: <53D789E5.6020709@plaimi.net> References: <39801184-f9e5-47ac-9638-a3361fc60187@googlegroups.com> <53D789E5.6020709@plaimi.net> Message-ID: Thanks for replying. I will be using cabal init --overwrite until the new feature is complete :D On Tuesday, July 29, 2014 9:18:09 PM UTC+9:30, Alexander Berntsen wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 29/07/14 07:52, ye yan wrote: > > I have been working on a haskell scotty project recently. I have > > just added configuration support for the project, which added an > > extra dependency of Control.Lens. My question is: is there a way > > update .cabal file automatically, just like cabal init but without > > recreate .cabal file? > No. I've been planning to work on that, but haven't had the time yet. > Thanks for the reminder. > - -- > Alexander > alex... at plaimi.net > https://secure.plaimi.net/~alexander > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iF4EAREIAAYFAlPXieUACgkQRtClrXBQc7VsQQD+PB/Tyr7S/a5SGE+aN0CgKWHu > RFcn35Eqi8jgsaPs/rAA/3/IqdT9DyFZGiYZXHm4m7ndSQyQvy8CZ5pVv+5QlcDN > =h5Ex > -----END PGP SIGNATURE----- > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From maydwell at gmail.com Wed Jul 30 00:01:16 2014 From: maydwell at gmail.com (Lyndon Maydwell) Date: Wed, 30 Jul 2014 10:01:16 +1000 Subject: [Haskell-cafe] How to update a cabal dependency automatically In-Reply-To: References: <39801184-f9e5-47ac-9638-a3361fc60187@googlegroups.com> <53D789E5.6020709@plaimi.net> Message-ID: If your project is in git you might be able to take advantage of `git add -p` in combination with `cabal init --overwrite`. On Tue, Jul 29, 2014 at 10:32 PM, ye yan wrote: > Thanks for replying. I will be using cabal init --overwrite until the new > feature is complete :D > > > On Tuesday, July 29, 2014 9:18:09 PM UTC+9:30, Alexander Berntsen wrote: >> >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> On 29/07/14 07:52, ye yan wrote: >> > I have been working on a haskell scotty project recently. I have >> > just added configuration support for the project, which added an >> > extra dependency of Control.Lens. My question is: is there a way >> > update .cabal file automatically, just like cabal init but without >> > recreate .cabal file? >> No. I've been planning to work on that, but haven't had the time yet. >> Thanks for the reminder. >> - -- >> Alexander >> alex... at plaimi.net >> https://secure.plaimi.net/~alexander >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v2 >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ >> >> iF4EAREIAAYFAlPXieUACgkQRtClrXBQc7VsQQD+PB/Tyr7S/a5SGE+aN0CgKWHu >> RFcn35Eqi8jgsaPs/rAA/3/IqdT9DyFZGiYZXHm4m7ndSQyQvy8CZ5pVv+5QlcDN >> =h5Ex >> -----END PGP SIGNATURE----- >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskel... at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From haskell.ye.yan at gmail.com Wed Jul 30 07:54:30 2014 From: haskell.ye.yan at gmail.com (ye yan) Date: Wed, 30 Jul 2014 00:54:30 -0700 (PDT) Subject: [Haskell-cafe] How to update a cabal dependency automatically In-Reply-To: References: <39801184-f9e5-47ac-9638-a3361fc60187@googlegroups.com> <53D789E5.6020709@plaimi.net> Message-ID: <1d549fa2-bb6e-403a-b7ce-e012104828e4@googlegroups.com> git add -p works very good in this case, thank you for your advise. Just wondering how does cabal solve dependencies? I updated my cabal file. ghci works find with my development box. but when I checkout with other computer I got a dependency error. It seems cabal failed to detect the correct library version I am using in ghci. Or just because for parsec library I have multiple versions installed? On Wednesday, July 30, 2014 9:31:52 AM UTC+9:30, Lyndon Maydwell wrote: > > If your project is in git you might be able to take advantage of `git > add -p` in combination with `cabal init --overwrite`. > > On Tue, Jul 29, 2014 at 10:32 PM, ye yan > wrote: > > Thanks for replying. I will be using cabal init --overwrite until the > new > > feature is complete :D > > > > > > On Tuesday, July 29, 2014 9:18:09 PM UTC+9:30, Alexander Berntsen wrote: > >> > >> -----BEGIN PGP SIGNED MESSAGE----- > >> Hash: SHA256 > >> > >> On 29/07/14 07:52, ye yan wrote: > >> > I have been working on a haskell scotty project recently. I have > >> > just added configuration support for the project, which added an > >> > extra dependency of Control.Lens. My question is: is there a way > >> > update .cabal file automatically, just like cabal init but without > >> > recreate .cabal file? > >> No. I've been planning to work on that, but haven't had the time yet. > >> Thanks for the reminder. > >> - -- > >> Alexander > >> alex... at plaimi.net > >> https://secure.plaimi.net/~alexander > >> -----BEGIN PGP SIGNATURE----- > >> Version: GnuPG v2 > >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > >> > >> iF4EAREIAAYFAlPXieUACgkQRtClrXBQc7VsQQD+PB/Tyr7S/a5SGE+aN0CgKWHu > >> RFcn35Eqi8jgsaPs/rAA/3/IqdT9DyFZGiYZXHm4m7ndSQyQvy8CZ5pVv+5QlcDN > >> =h5Ex > >> -----END PGP SIGNATURE----- > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskel... at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskel... at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jyotirmoy at jyotirmoy.net Wed Jul 30 08:24:37 2014 From: jyotirmoy at jyotirmoy.net (Jyotirmoy Bhattacharya) Date: Wed, 30 Jul 2014 13:54:37 +0530 Subject: [Haskell-cafe] redundant loads and saves in code generated for recursive functions? Message-ID: Dear All, I am new to Haskell so please forgive me if I am asking about something already well-understood. I was trying to understand the performance of my Haskell program compiled with the LLVM backend. I used -ddump-llvm to dump the LLVM assembly and then ran llc -O3 on the resulting file to look at the native assembly. One of the generated function starts off with s5BH_info: # @s5BH_info # BB#0: subq $208, %rsp movq %r13, 200(%rsp) movq %rbp, 192(%rsp) movq %r12, 184(%rsp) movq %rbx, 176(%rsp) movq %r14, 168(%rsp) movq %rsi, 160(%rsp) movq %rdi, 152(%rsp) movq %r8, 144(%rsp) movq %r9, 136(%rsp) movq %r15, 128(%rsp) movss %xmm1, 124(%rsp) movss %xmm2, 120(%rsp) movss %xmm3, 116(%rsp) movss %xmm4, 112(%rsp) movsd %xmm5, 104(%rsp) movsd %xmm6, 96(%rsp) At some point down the line the function makes a tail call to itself and this is the code generated movq %r14, 168(%rsp) movq 200(%rsp), %r13 movq 192(%rsp), %rbp movq 184(%rsp), %r12 movq 176(%rsp), %rbx movq 128(%rsp), %r15 movsd 104(%rsp), %xmm5 addq $208, %rsp jmp s5BH_info So it looks like some values are being moved from registers to the stack only to be immediately moved from the stack to the register on entry to the function. It should be possible to eliminate both the load and the stores. Is this behaviour due to LLVM or GHC? If it is GHC, it this an optimization a newcomer can attempt to implement or are there deep issues here? Jyotirmoy Bhattacharya -------------- next part -------------- An HTML attachment was scrubbed... URL: From apfelmus at quantentunnel.de Wed Jul 30 08:47:31 2014 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Wed, 30 Jul 2014 10:47:31 +0200 Subject: [Haskell-cafe] Intuition to understand poor man's concurrency In-Reply-To: <53D4D7F5.5090904@web.de> References: <53D4D7F5.5090904@web.de> Message-ID: martin wrote: > > I am trying to understand the ideas of Koen Klaessen, published in > Functional Pearls: "A poor man's concurrency" (1993). > > The code in the paper doesn't compile. E.g. uses "lambda dot" instead > of "labmda arrow", i.e. the way the labmda calculus guys write > things. Was that ever legal haskell or is this the result of some > lhs2lex pretty printer? > > Anyways, I believe I was able to convert that into modern haskell > syntax - at least it compiles. But I have trouble to understand the > Monad instance presented there. Could anyobody walk me through the > bind function? > > But even more important: how do you guys develop an intuition about > what the bind operator does in a specific monad. I find it very helpful to think of monads as "lists of instructions". I have written a thorough and hopefully accessible explanation here http://apfelmus.nfshost.com/articles/operational-monad.html which also discusses a transparent implementation Koen Classen's parser combinators. From this point of view, the continuation monad corresponds to a particular list implementation, namely "difference lists". If you have trouble understanding the continuation monad, I would recommend to go via the "list of instructions" route, as it involves only functions of a less higher order. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From jyotirmoy at jyotirmoy.net Wed Jul 30 10:03:48 2014 From: jyotirmoy at jyotirmoy.net (Jyotirmoy Bhattacharya) Date: Wed, 30 Jul 2014 15:33:48 +0530 Subject: [Haskell-cafe] redundant loads and saves in code generated for recursive functions? In-Reply-To: References: Message-ID: On reading this again I realise that I got the order of loads and stores wrong. The arguments are being stored on entering the function and loaded before the call. But still, is there a chance of eliminating this redundancy? Jyotirmoy On Wed, Jul 30, 2014 at 1:54 PM, Jyotirmoy Bhattacharya < jyotirmoy at jyotirmoy.net> wrote: > Dear All, > > I am new to Haskell so please forgive me if I am asking about something > already well-understood. > > I was trying to understand the performance of my Haskell program compiled > with the LLVM backend. I used -ddump-llvm to dump the LLVM assembly and > then ran llc -O3 on the resulting file to look at the native assembly. > > One of the generated function starts off with > s5BH_info: # @s5BH_info > # BB#0: > subq $208, %rsp > movq %r13, 200(%rsp) > movq %rbp, 192(%rsp) > movq %r12, 184(%rsp) > movq %rbx, 176(%rsp) > movq %r14, 168(%rsp) > movq %rsi, 160(%rsp) > movq %rdi, 152(%rsp) > movq %r8, 144(%rsp) > movq %r9, 136(%rsp) > movq %r15, 128(%rsp) > movss %xmm1, 124(%rsp) > movss %xmm2, 120(%rsp) > movss %xmm3, 116(%rsp) > movss %xmm4, 112(%rsp) > movsd %xmm5, 104(%rsp) > movsd %xmm6, 96(%rsp) > > At some point down the line the function makes a tail call to itself and > this is the code generated > movq %r14, 168(%rsp) > movq 200(%rsp), %r13 > movq 192(%rsp), %rbp > movq 184(%rsp), %r12 > movq 176(%rsp), %rbx > movq 128(%rsp), %r15 > movsd 104(%rsp), %xmm5 > addq $208, %rsp > jmp s5BH_info > > So it looks like some values are being moved from registers to the stack > only to be immediately moved from the stack to the register on entry to the > function. It should be possible to eliminate both the load and the stores. > > Is this behaviour due to LLVM or GHC? If it is GHC, it this an > optimization a newcomer can attempt to implement or are there deep issues > here? > > Jyotirmoy Bhattacharya > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Wed Jul 30 10:44:33 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Wed, 30 Jul 2014 12:44:33 +0200 Subject: [Haskell-cafe] redundant loads and saves in code generated for recursive functions? In-Reply-To: References: Message-ID: Hi Jyotirmoy, I didn't read your assembly carefully, but it sounds similar to https://ghc.haskell.org/trac/ghc/ticket/8905, which is not fixed yet. On Wed, Jul 30, 2014 at 12:03 PM, Jyotirmoy Bhattacharya wrote: > On reading this again I realise that I got the order of loads and stores > wrong. The arguments are being stored on entering the function and loaded > before the call. But still, is there a chance of eliminating this > redundancy? > > Jyotirmoy > > > On Wed, Jul 30, 2014 at 1:54 PM, Jyotirmoy Bhattacharya > wrote: >> >> Dear All, >> >> I am new to Haskell so please forgive me if I am asking about something >> already well-understood. >> >> I was trying to understand the performance of my Haskell program compiled >> with the LLVM backend. I used -ddump-llvm to dump the LLVM assembly and then >> ran llc -O3 on the resulting file to look at the native assembly. >> >> One of the generated function starts off with >> s5BH_info: # @s5BH_info >> # BB#0: >> subq $208, %rsp >> movq %r13, 200(%rsp) >> movq %rbp, 192(%rsp) >> movq %r12, 184(%rsp) >> movq %rbx, 176(%rsp) >> movq %r14, 168(%rsp) >> movq %rsi, 160(%rsp) >> movq %rdi, 152(%rsp) >> movq %r8, 144(%rsp) >> movq %r9, 136(%rsp) >> movq %r15, 128(%rsp) >> movss %xmm1, 124(%rsp) >> movss %xmm2, 120(%rsp) >> movss %xmm3, 116(%rsp) >> movss %xmm4, 112(%rsp) >> movsd %xmm5, 104(%rsp) >> movsd %xmm6, 96(%rsp) >> >> At some point down the line the function makes a tail call to itself and >> this is the code generated >> movq %r14, 168(%rsp) >> movq 200(%rsp), %r13 >> movq 192(%rsp), %rbp >> movq 184(%rsp), %r12 >> movq 176(%rsp), %rbx >> movq 128(%rsp), %r15 >> movsd 104(%rsp), %xmm5 >> addq $208, %rsp >> jmp s5BH_info >> >> So it looks like some values are being moved from registers to the stack >> only to be immediately moved from the stack to the register on entry to the >> function. It should be possible to eliminate both the load and the stores. >> >> Is this behaviour due to LLVM or GHC? If it is GHC, it this an >> optimization a newcomer can attempt to implement or are there deep issues >> here? >> >> Jyotirmoy Bhattacharya >> >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From benjamin.franksen at helmholtz-berlin.de Wed Jul 30 11:49:32 2014 From: benjamin.franksen at helmholtz-berlin.de (Benjamin Franksen) Date: Wed, 30 Jul 2014 13:49:32 +0200 Subject: [Haskell-cafe] Intuition to understand poor man's concurrency References: <53D4D7F5.5090904@web.de> Message-ID: martin wrote: > I am trying to understand the ideas of Koen Klaessen, published in > Functional Pearls: "A poor man's concurrency" (1993). > > Anyways, I believe I was able to convert that into modern haskell syntax - > at least it compiles. But I have trouble to understand the Monad instance > presented there. Could anyobody walk me through the bind function? > > newtype C m a = C ((a -> Action m) -> Action m) > > instance Monad m => Monad (C m) where > (C m) >>= k = C cont > where > cont c = m (\a -> > let C h = k a > in h c) > return x = C $ \c -> c x > > > data Action m = > Atom (m (Action m)) > | Fork (Action m) (Action m) > | Stop I find it easier to think about continuations when I remove the wrapping and unwrapping of the newtype. To further simplify things, we note that the above code makes no use whatsoever of the structure of 'Action m'. (In particular, the 'Monad m' constraint is not needed.) This means we can replace 'Action m' by a simple type variable 'w': type C w a = (a -> w) -> w The definition of >>= can then almost be derived from the types alone: m >>= k = ... We have m :: (a -> w) -> w and k :: a -> (b -> w) -> w, so m >>= k :: (b -> w) -> w We are given an f :: b -> w as argument and the only function we have that takes such a thing as an argument is k, which additionally has the right return type (namely w). We could be tempted to try r = k x f where ... with some x :: a as its first argument. However, we do not have a function that gives us an x :: a as result. Instead, let's take a look at what we do have. We already used the k, but not yet the m. The type of m tells us that it takes a function of type a -> w and returns some x :: w. With a bit of squinting, one sees that, if we abstract out the x from k x f, we get exactly what m takes as input: \x -> k x f :: a -> w and so the solution is clear: we apply the given m to this function, resulting in: m >>= k = \f -> m (\x -> k x f) If you re-add the newtype wrapping and unwrapping, this is exactly the same as your definition above. This is one answer to the question of how one can arrive at a suitable definition of >>= for the continuation monad. But it does not tell us anything about how to arrive at an intuition about what this implementation really does. Maybe someone else can explain this... Cheers Ben -- "Make it so they have to reboot after every typo." ??? Scott Adams From jyotirmoy at jyotirmoy.net Wed Jul 30 12:10:56 2014 From: jyotirmoy at jyotirmoy.net (Jyotirmoy Bhattacharya) Date: Wed, 30 Jul 2014 17:40:56 +0530 Subject: [Haskell-cafe] redundant loads and saves in code generated for recursive functions? In-Reply-To: References: Message-ID: Hi, It doesn't seem the same to me. Unlike the bug you point to, the C-- does not have any extra stores. The stores and loads appear first in the LLVM. I am attaching the C--, LLVM and assembly codes for the function. The real missed opportunity seems to me the absence of a recognition that we are in fact making a tail call to ourselves. Recognizing that might allow jumping to some point after the initial stores. Jyotirmoy Bhattacharya On Wed, Jul 30, 2014 at 4:14 PM, Johan Tibell wrote: > Hi Jyotirmoy, > > I didn't read your assembly carefully, but it sounds similar to > https://ghc.haskell.org/trac/ghc/ticket/8905, which is not fixed yet. > > On Wed, Jul 30, 2014 at 12:03 PM, Jyotirmoy Bhattacharya > wrote: > > On reading this again I realise that I got the order of loads and stores > > wrong. The arguments are being stored on entering the function and loaded > > before the call. But still, is there a chance of eliminating this > > redundancy? > > > > Jyotirmoy > > > > > > On Wed, Jul 30, 2014 at 1:54 PM, Jyotirmoy Bhattacharya > > wrote: > >> > >> Dear All, > >> > >> I am new to Haskell so please forgive me if I am asking about something > >> already well-understood. > >> > >> I was trying to understand the performance of my Haskell program > compiled > >> with the LLVM backend. I used -ddump-llvm to dump the LLVM assembly and > then > >> ran llc -O3 on the resulting file to look at the native assembly. > >> > >> One of the generated function starts off with > >> s5BH_info: # @s5BH_info > >> # BB#0: > >> subq $208, %rsp > >> movq %r13, 200(%rsp) > >> movq %rbp, 192(%rsp) > >> movq %r12, 184(%rsp) > >> movq %rbx, 176(%rsp) > >> movq %r14, 168(%rsp) > >> movq %rsi, 160(%rsp) > >> movq %rdi, 152(%rsp) > >> movq %r8, 144(%rsp) > >> movq %r9, 136(%rsp) > >> movq %r15, 128(%rsp) > >> movss %xmm1, 124(%rsp) > >> movss %xmm2, 120(%rsp) > >> movss %xmm3, 116(%rsp) > >> movss %xmm4, 112(%rsp) > >> movsd %xmm5, 104(%rsp) > >> movsd %xmm6, 96(%rsp) > >> > >> At some point down the line the function makes a tail call to itself and > >> this is the code generated > >> movq %r14, 168(%rsp) > >> movq 200(%rsp), %r13 > >> movq 192(%rsp), %rbp > >> movq 184(%rsp), %r12 > >> movq 176(%rsp), %rbx > >> movq 128(%rsp), %r15 > >> movsd 104(%rsp), %xmm5 > >> addq $208, %rsp > >> jmp s5BH_info > >> > >> So it looks like some values are being moved from registers to the stack > >> only to be immediately moved from the stack to the register on entry to > the > >> function. It should be possible to eliminate both the load and the > stores. > >> > >> Is this behaviour due to LLVM or GHC? If it is GHC, it this an > >> optimization a newcomer can attempt to implement or are there deep > issues > >> here? > >> > >> Jyotirmoy Bhattacharya > >> > >> > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- define internal cc 10 void @s5BH_info(i64* noalias nocapture %Base_Arg, i64* noalias nocapture %Sp_Arg, i64* noalias nocapture %Hp_Arg, i64 %R1_Arg, i64 %R2_Arg, i64 %R3_Arg, i64 %R4_Arg, i64 %R5_Arg, i64 %R6_Arg, i64 %SpLim_Arg, float %F1_Arg, float %F2_Arg, float %F3_Arg, float %F4_Arg, double %D1_Arg, double %D2_Arg) align 8 nounwind section "X98A__STRIP,__me1" { c6f9: %Base_Var = alloca i64*, i32 1 store i64* %Base_Arg, i64** %Base_Var %Sp_Var = alloca i64*, i32 1 store i64* %Sp_Arg, i64** %Sp_Var %Hp_Var = alloca i64*, i32 1 store i64* %Hp_Arg, i64** %Hp_Var %R1_Var = alloca i64, i32 1 store i64 %R1_Arg, i64* %R1_Var %R2_Var = alloca i64, i32 1 store i64 %R2_Arg, i64* %R2_Var %R3_Var = alloca i64, i32 1 store i64 %R3_Arg, i64* %R3_Var %R4_Var = alloca i64, i32 1 store i64 %R4_Arg, i64* %R4_Var %R5_Var = alloca i64, i32 1 store i64 %R5_Arg, i64* %R5_Var %R6_Var = alloca i64, i32 1 store i64 %R6_Arg, i64* %R6_Var %SpLim_Var = alloca i64, i32 1 store i64 %SpLim_Arg, i64* %SpLim_Var %F1_Var = alloca float, i32 1 store float %F1_Arg, float* %F1_Var %F2_Var = alloca float, i32 1 store float %F2_Arg, float* %F2_Var %F3_Var = alloca float, i32 1 store float %F3_Arg, float* %F3_Var %F4_Var = alloca float, i32 1 store float %F4_Arg, float* %F4_Var %D1_Var = alloca double, i32 1 store double %D1_Arg, double* %D1_Var %D2_Var = alloca double, i32 1 store double %D2_Arg, double* %D2_Var %lc6ea = alloca i64, i32 1 %ls5B7 = alloca i64, i32 1 %ls5B9 = alloca i64, i32 1 %ls5Bb = alloca i64, i32 1 %ls5Ba = alloca i64, i32 1 %ls5Bf = alloca i64, i32 1 %ls5Bh = alloca i64, i32 1 %ls5Bj = alloca i64, i32 1 %ls5Bi = alloca i64, i32 1 %ls5Bm = alloca i64, i32 1 %ls5Bo = alloca i64, i32 1 %ls5FB = alloca i64, i32 1 %ls5Bq = alloca i64, i32 1 %ls5FA = alloca i64, i32 1 %ls5Bz = alloca double, i32 1 %ls5Fz = alloca i64, i32 1 %ls5Bv = alloca i64, i32 1 %ls5Fy = alloca i64, i32 1 %ls5BA = alloca double, i32 1 %ls5BB = alloca double, i32 1 %lc6eQ = alloca i64, i32 1 %ls5BE = alloca double, i32 1 %lc6eW = alloca i64, i32 1 %ls5Fx = alloca i64, i32 1 %lc6eZ = alloca i64, i32 1 %ls5FK = alloca i64, i32 1 %ls5FL = alloca i64, i32 1 %ls5FM = alloca i64, i32 1 %ln9iC = load i64* %R2_Var %ln9iD = load i64* %R1_Var %ln9iE = add i64 %ln9iD, 30 %ln9iF = inttoptr i64 %ln9iE to i64* %ln9iG = load i64* %ln9iF, !tbaa !3 %ln9iH = icmp sge i64 %ln9iC, %ln9iG %ln9iI = zext i1 %ln9iH to i64 store i64 %ln9iI, i64* %lc6ea %ln9iJ = load i64* %lc6ea %ln9iK = icmp uge i64 %ln9iJ, 1 br i1 %ln9iK, label %c6fb, label %n9iL n9iL: %ln9iM = load i64* %R2_Var %ln9iN = load i64* %R1_Var %ln9iO = add i64 %ln9iN, 22 %ln9iP = inttoptr i64 %ln9iO to i64* %ln9iQ = load i64* %ln9iP, !tbaa !3 %ln9iR = sdiv i64 %ln9iM, %ln9iQ store i64 %ln9iR, i64* %ls5B7 %ln9iS = load i64* %R2_Var %ln9iT = load i64* %R1_Var %ln9iU = add i64 %ln9iT, 22 %ln9iV = inttoptr i64 %ln9iU to i64* %ln9iW = load i64* %ln9iV, !tbaa !3 %ln9iX = srem i64 %ln9iS, %ln9iW store i64 %ln9iX, i64* %ls5B9 %ln9iY = load i64* %ls5B7 %ln9iZ = load i64* %R1_Var %ln9j0 = add i64 %ln9iZ, 22 %ln9j1 = inttoptr i64 %ln9j0 to i64* %ln9j2 = load i64* %ln9j1, !tbaa !3 %ln9j3 = mul i64 %ln9iY, %ln9j2 store i64 %ln9j3, i64* %ls5Bb %ln9j4 = load i64* %ls5Bb %ln9j5 = load i64* %ls5B9 %ln9j6 = add i64 %ln9j4, %ln9j5 store i64 %ln9j6, i64* %ls5Ba %ln9j7 = load i64* %ls5Ba %ln9j8 = load i64* %R1_Var %ln9j9 = add i64 %ln9j8, 22 %ln9ja = inttoptr i64 %ln9j9 to i64* %ln9jb = load i64* %ln9ja, !tbaa !3 %ln9jc = sdiv i64 %ln9j7, %ln9jb store i64 %ln9jc, i64* %ls5Bf %ln9jd = load i64* %ls5Ba %ln9je = load i64* %R1_Var %ln9jf = add i64 %ln9je, 22 %ln9jg = inttoptr i64 %ln9jf to i64* %ln9jh = load i64* %ln9jg, !tbaa !3 %ln9ji = srem i64 %ln9jd, %ln9jh store i64 %ln9ji, i64* %ls5Bh %ln9jj = load i64* %ls5Bf %ln9jk = load i64* %R1_Var %ln9jl = add i64 %ln9jk, 22 %ln9jm = inttoptr i64 %ln9jl to i64* %ln9jn = load i64* %ln9jm, !tbaa !3 %ln9jo = mul i64 %ln9jj, %ln9jn store i64 %ln9jo, i64* %ls5Bj %ln9jp = load i64* %ls5Bj %ln9jq = load i64* %ls5Bh %ln9jr = add i64 %ln9jp, %ln9jq store i64 %ln9jr, i64* %ls5Bi %ln9js = load i64* %ls5Bi %ln9jt = load i64* %R1_Var %ln9ju = add i64 %ln9jt, 22 %ln9jv = inttoptr i64 %ln9ju to i64* %ln9jw = load i64* %ln9jv, !tbaa !3 %ln9jx = sdiv i64 %ln9js, %ln9jw store i64 %ln9jx, i64* %ls5Bm %ln9jy = load i64* %ls5Bi %ln9jz = load i64* %R1_Var %ln9jA = add i64 %ln9jz, 22 %ln9jB = inttoptr i64 %ln9jA to i64* %ln9jC = load i64* %ln9jB, !tbaa !3 %ln9jD = srem i64 %ln9jy, %ln9jC store i64 %ln9jD, i64* %ls5Bo %ln9jE = load i64* %ls5Bm %ln9jF = load i64* %R1_Var %ln9jG = add i64 %ln9jF, 46 %ln9jH = inttoptr i64 %ln9jG to i64* %ln9jI = load i64* %ln9jH, !tbaa !3 %ln9jJ = mul i64 %ln9jE, %ln9jI store i64 %ln9jJ, i64* %ls5FB %ln9jK = load i64* %ls5FB %ln9jL = load i64* %ls5Bo %ln9jM = add i64 %ln9jK, %ln9jL store i64 %ln9jM, i64* %ls5Bq %ln9jN = load i64* %R1_Var %ln9jO = add i64 %ln9jN, 38 %ln9jP = inttoptr i64 %ln9jO to i64* %ln9jQ = load i64* %ln9jP, !tbaa !3 %ln9jR = load i64* %ls5Bq %ln9jS = add i64 %ln9jQ, %ln9jR store i64 %ln9jS, i64* %ls5FA %ln9jT = load i64* %R1_Var %ln9jU = add i64 %ln9jT, 6 %ln9jV = inttoptr i64 %ln9jU to i64* %ln9jW = load i64* %ln9jV, !tbaa !3 %ln9jX = add i64 %ln9jW, 16 %ln9jY = load i64* %ls5FA %ln9jZ = shl i64 %ln9jY, 3 %ln9k0 = add i64 %ln9jX, %ln9jZ %ln9k1 = inttoptr i64 %ln9k0 to double* %ln9k2 = load double* %ln9k1, !tbaa !5 store double %ln9k2, double* %ls5Bz %ln9k3 = load i64* %ls5Bm %ln9k4 = load i64* %R1_Var %ln9k5 = add i64 %ln9k4, 62 %ln9k6 = inttoptr i64 %ln9k5 to i64* %ln9k7 = load i64* %ln9k6, !tbaa !3 %ln9k8 = mul i64 %ln9k3, %ln9k7 store i64 %ln9k8, i64* %ls5Fz %ln9k9 = load i64* %ls5Fz %ln9ka = load i64* %ls5Bo %ln9kb = add i64 %ln9k9, %ln9ka store i64 %ln9kb, i64* %ls5Bv %ln9kc = load i64* %R1_Var %ln9kd = add i64 %ln9kc, 54 %ln9ke = inttoptr i64 %ln9kd to i64* %ln9kf = load i64* %ln9ke, !tbaa !3 %ln9kg = load i64* %ls5Bv %ln9kh = add i64 %ln9kf, %ln9kg store i64 %ln9kh, i64* %ls5Fy %ln9ki = load i64* %R1_Var %ln9kj = add i64 %ln9ki, 14 %ln9kk = inttoptr i64 %ln9kj to i64* %ln9kl = load i64* %ln9kk, !tbaa !3 %ln9km = add i64 %ln9kl, 16 %ln9kn = load i64* %ls5Fy %ln9ko = shl i64 %ln9kn, 3 %ln9kp = add i64 %ln9km, %ln9ko %ln9kq = inttoptr i64 %ln9kp to double* %ln9kr = load double* %ln9kq, !tbaa !5 store double %ln9kr, double* %ls5BA %ln9ks = load double* %ls5Bz %ln9kt = load double* %ls5BA %ln9ku = fsub double %ln9ks, %ln9kt store double %ln9ku, double* %ls5BB %ln9kv = load double* %ls5BB %ln9kw = fcmp oge double %ln9kv, 0x0000000000000000 %ln9kx = zext i1 %ln9kw to i64 store i64 %ln9kx, i64* %lc6eQ %ln9ky = load i64* %lc6eQ %ln9kz = icmp uge i64 %ln9ky, 1 br i1 %ln9kz, label %c6fd, label %n9kA n9kA: %ln9kB = load double* %ls5BB %ln9kC = fsub double 0x8000000000000000, %ln9kB store double %ln9kC, double* %ls5BE %ln9kD = load double* %ls5BE %ln9kE = load double* %D1_Var %ln9kF = fcmp ole double %ln9kD, %ln9kE %ln9kG = zext i1 %ln9kF to i64 store i64 %ln9kG, i64* %lc6eW %ln9kH = load i64* %lc6eW %ln9kI = icmp uge i64 %ln9kH, 1 br i1 %ln9kI, label %c6fg, label %n9kJ n9kJ: %ln9kK = load i64* %R2_Var %ln9kL = add i64 %ln9kK, 1 store i64 %ln9kL, i64* %ls5Fx %ln9kM = load i64* %ls5Fx store i64 %ln9kM, i64* %R2_Var %ln9kN = load double* %ls5BE store double %ln9kN, double* %D1_Var %ln9kO = load i64** %Base_Var %ln9kP = load i64** %Sp_Var %ln9kQ = load i64** %Hp_Var %ln9kR = load i64* %R1_Var %ln9kS = load i64* %R2_Var %ln9kT = load i64* %SpLim_Var %ln9kU = load double* %D1_Var tail call cc 10 void (i64*,i64*,i64*,i64,i64,i64,i64,i64,i64,i64,float,float,float,float,double,double)* @s5BH_info( i64* %ln9kO, i64* %ln9kP, i64* %ln9kQ, i64 %ln9kR, i64 %ln9kS, i64 undef, i64 undef, i64 undef, i64 undef, i64 %ln9kT, float undef, float undef, float undef, float undef, double %ln9kU, double undef ) nounwind ret void c6fb: %ln9kV = load double* %D1_Var store double %ln9kV, double* %D1_Var %ln9kW = load i64** %Sp_Var %ln9kX = getelementptr inbounds i64* %ln9kW, i32 0 %ln9kY = bitcast i64* %ln9kX to i64* %ln9kZ = load i64* %ln9kY, !tbaa !1 %ln9l0 = inttoptr i64 %ln9kZ to void (i64*, i64*, i64*, i64, i64, i64, i64, i64, i64, i64, float, float, float, float, double, double)* %ln9l1 = load i64** %Base_Var %ln9l2 = load i64** %Sp_Var %ln9l3 = load i64** %Hp_Var %ln9l4 = load i64* %R1_Var %ln9l5 = load i64* %SpLim_Var %ln9l6 = load double* %D1_Var tail call cc 10 void (i64*,i64*,i64*,i64,i64,i64,i64,i64,i64,i64,float,float,float,float,double,double)* %ln9l0( i64* %ln9l1, i64* %ln9l2, i64* %ln9l3, i64 %ln9l4, i64 undef, i64 undef, i64 undef, i64 undef, i64 undef, i64 %ln9l5, float undef, float undef, float undef, float undef, double %ln9l6, double undef ) nounwind ret void c6fd: %ln9l7 = load double* %ls5BB %ln9l8 = load double* %D1_Var %ln9l9 = fcmp ole double %ln9l7, %ln9l8 %ln9la = zext i1 %ln9l9 to i64 store i64 %ln9la, i64* %lc6eZ %ln9lb = load i64* %lc6eZ %ln9lc = icmp uge i64 %ln9lb, 1 br i1 %ln9lc, label %c6fj, label %n9ld n9ld: %ln9le = load i64* %R2_Var %ln9lf = add i64 %ln9le, 1 store i64 %ln9lf, i64* %ls5FK %ln9lg = load i64* %ls5FK store i64 %ln9lg, i64* %R2_Var %ln9lh = load double* %ls5BB store double %ln9lh, double* %D1_Var %ln9li = load i64** %Base_Var %ln9lj = load i64** %Sp_Var %ln9lk = load i64** %Hp_Var %ln9ll = load i64* %R1_Var %ln9lm = load i64* %R2_Var %ln9ln = load i64* %SpLim_Var %ln9lo = load double* %D1_Var tail call cc 10 void (i64*,i64*,i64*,i64,i64,i64,i64,i64,i64,i64,float,float,float,float,double,double)* @s5BH_info( i64* %ln9li, i64* %ln9lj, i64* %ln9lk, i64 %ln9ll, i64 %ln9lm, i64 undef, i64 undef, i64 undef, i64 undef, i64 %ln9ln, float undef, float undef, float undef, float undef, double %ln9lo, double undef ) nounwind ret void c6fj: %ln9lp = load i64* %R2_Var %ln9lq = add i64 %ln9lp, 1 store i64 %ln9lq, i64* %ls5FL %ln9lr = load i64* %ls5FL store i64 %ln9lr, i64* %R2_Var %ln9ls = load i64** %Base_Var %ln9lt = load i64** %Sp_Var %ln9lu = load i64** %Hp_Var %ln9lv = load i64* %R1_Var %ln9lw = load i64* %R2_Var %ln9lx = load i64* %SpLim_Var %ln9ly = load double* %D1_Var tail call cc 10 void (i64*,i64*,i64*,i64,i64,i64,i64,i64,i64,i64,float,float,float,float,double,double)* @s5BH_info( i64* %ln9ls, i64* %ln9lt, i64* %ln9lu, i64 %ln9lv, i64 %ln9lw, i64 undef, i64 undef, i64 undef, i64 undef, i64 %ln9lx, float undef, float undef, float undef, float undef, double %ln9ly, double undef ) nounwind ret void c6fg: %ln9lz = load i64* %R2_Var %ln9lA = add i64 %ln9lz, 1 store i64 %ln9lA, i64* %ls5FM %ln9lB = load i64* %ls5FM store i64 %ln9lB, i64* %R2_Var %ln9lC = load i64** %Base_Var %ln9lD = load i64** %Sp_Var %ln9lE = load i64** %Hp_Var %ln9lF = load i64* %R1_Var %ln9lG = load i64* %R2_Var %ln9lH = load i64* %SpLim_Var %ln9lI = load double* %D1_Var tail call cc 10 void (i64*,i64*,i64*,i64,i64,i64,i64,i64,i64,i64,float,float,float,float,double,double)* @s5BH_info( i64* %ln9lC, i64* %ln9lD, i64* %ln9lE, i64 %ln9lF, i64 %ln9lG, i64 undef, i64 undef, i64 undef, i64 undef, i64 %ln9lH, float undef, float undef, float undef, float undef, double %ln9lI, double undef ) nounwind ret void } -------------- next part -------------- s5BH_info: # @s5BH_info # BB#0: # %c6f9 subq $208, %rsp movq %r13, 200(%rsp) movq %rbp, 192(%rsp) movq %r12, 184(%rsp) movq %rbx, 176(%rsp) movq %r14, 168(%rsp) movq %rsi, 160(%rsp) movq %rdi, 152(%rsp) movq %r8, 144(%rsp) movq %r9, 136(%rsp) movq %r15, 128(%rsp) movss %xmm1, 124(%rsp) movss %xmm2, 120(%rsp) movss %xmm3, 116(%rsp) movss %xmm4, 112(%rsp) movsd %xmm5, 104(%rsp) movsd %xmm6, 96(%rsp) movq 168(%rsp), %rax movq 176(%rsp), %rcx cmpq 30(%rcx), %rax setge %al movzbl %al, %eax movq %rax, 88(%rsp) jl .LBB99_1 # BB#5: # %c6fb movsd 104(%rsp), %xmm5 movq 192(%rsp), %rbp movq (%rbp), %rax movq 200(%rsp), %r13 movq 184(%rsp), %r12 movq 176(%rsp), %rbx movq 128(%rsp), %r15 addq $208, %rsp jmpq *%rax # TAILCALL .LBB99_1: # %n9iL movq 168(%rsp), %rax movq 176(%rsp), %rcx cqto idivq 22(%rcx) movq %rax, 80(%rsp) movq 168(%rsp), %rax movq 176(%rsp), %rcx cqto idivq 22(%rcx) movq %rdx, 72(%rsp) movq 80(%rsp), %rax movq 176(%rsp), %rcx imulq 22(%rcx), %rax movq %rax, 64(%rsp) addq 72(%rsp), %rax movq %rax, 56(%rsp) movq 176(%rsp), %rcx cqto idivq 22(%rcx) movq %rax, 48(%rsp) movq 56(%rsp), %rax movq 176(%rsp), %rcx cqto idivq 22(%rcx) movq %rdx, 40(%rsp) movq 48(%rsp), %rax movq 176(%rsp), %rcx imulq 22(%rcx), %rax movq %rax, 32(%rsp) addq 40(%rsp), %rax movq %rax, 24(%rsp) movq 176(%rsp), %rcx cqto idivq 22(%rcx) movq %rax, 16(%rsp) movq 24(%rsp), %rax movq 176(%rsp), %rcx cqto idivq 22(%rcx) movq %rdx, 8(%rsp) movq 16(%rsp), %rax movq 176(%rsp), %rcx imulq 46(%rcx), %rax movq %rax, (%rsp) addq 8(%rsp), %rax movq %rax, -8(%rsp) movq 176(%rsp), %rcx addq 38(%rcx), %rax movq %rax, -16(%rsp) movq 176(%rsp), %rcx movq 6(%rcx), %rcx movsd 16(%rcx,%rax,8), %xmm0 movsd %xmm0, -24(%rsp) movq 16(%rsp), %rax movq 176(%rsp), %rcx imulq 62(%rcx), %rax movq %rax, -32(%rsp) addq 8(%rsp), %rax movq %rax, -40(%rsp) movq 176(%rsp), %rcx addq 54(%rcx), %rax movq %rax, -48(%rsp) movq 176(%rsp), %rcx movq 14(%rcx), %rcx movsd 16(%rcx,%rax,8), %xmm0 movsd %xmm0, -56(%rsp) movsd -24(%rsp), %xmm1 subsd %xmm0, %xmm1 xorps %xmm0, %xmm0 ucomisd %xmm0, %xmm1 movsd %xmm1, -64(%rsp) setae %al movzbl %al, %eax movq %rax, -72(%rsp) jb .LBB99_2 # BB#6: # %c6fd movsd 104(%rsp), %xmm0 ucomisd -64(%rsp), %xmm0 setae %al movzbl %al, %eax movq %rax, -104(%rsp) jb .LBB99_7 # BB#8: # %c6fj movq 168(%rsp), %r14 incq %r14 movq %r14, -120(%rsp) jmp .LBB99_9 .LBB99_2: # %n9kA movsd -64(%rsp), %xmm0 xorpd .LCPI99_0(%rip), %xmm0 movsd %xmm0, -80(%rsp) movsd 104(%rsp), %xmm1 ucomisd %xmm0, %xmm1 setae %al movzbl %al, %eax movq %rax, -88(%rsp) jb .LBB99_3 # BB#10: # %c6fg movq 168(%rsp), %r14 incq %r14 movq %r14, -128(%rsp) .LBB99_9: # %c6fj movq %r14, 168(%rsp) movq 200(%rsp), %r13 movq 192(%rsp), %rbp movq 184(%rsp), %r12 movq 176(%rsp), %rbx movq 128(%rsp), %r15 movsd 104(%rsp), %xmm5 addq $208, %rsp jmp s5BH_info # TAILCALL .LBB99_7: # %n9ld movq 168(%rsp), %rax incq %rax movq %rax, -112(%rsp) movq %rax, 168(%rsp) movsd -64(%rsp), %xmm5 jmp .LBB99_4 .LBB99_3: # %n9kJ movq 168(%rsp), %rax incq %rax movq %rax, -96(%rsp) movq %rax, 168(%rsp) movsd -80(%rsp), %xmm5 .LBB99_4: # %n9kJ movsd %xmm5, 104(%rsp) movq 200(%rsp), %r13 movq 192(%rsp), %rbp movq 184(%rsp), %r12 movq 176(%rsp), %rbx movq 168(%rsp), %r14 movq 128(%rsp), %r15 addq $208, %rsp jmp s5BH_info # TAILCALL -------------- next part -------------- iter_s5BH_info() { label: iter_s5BH_info rep:HeapRep 2 ptrs 6 nonptrs { Fun {arity: 2 fun_type: ArgGen [True, True]} } } c6f9: _c6ea::I64 = %MO_S_Ge_W64(R2, I64[R1 + 30]); ; if (_c6ea::I64 >= 1) goto c6fb; _s5B7::I64 = %MO_S_Quot_W64(R2, I64[R1 + 22]); _s5B9::I64 = %MO_S_Rem_W64(R2, I64[R1 + 22]); _s5Bb::I64 = _s5B7::I64 * I64[R1 + 22]; _s5Ba::I64 = _s5Bb::I64 + _s5B9::I64; _s5Bf::I64 = %MO_S_Quot_W64(_s5Ba::I64, I64[R1 + 22]); _s5Bh::I64 = %MO_S_Rem_W64(_s5Ba::I64, I64[R1 + 22]); _s5Bj::I64 = _s5Bf::I64 * I64[R1 + 22]; _s5Bi::I64 = _s5Bj::I64 + _s5Bh::I64; _s5Bm::I64 = %MO_S_Quot_W64(_s5Bi::I64, I64[R1 + 22]); _s5Bo::I64 = %MO_S_Rem_W64(_s5Bi::I64, I64[R1 + 22]); _s5FB::I64 = _s5Bm::I64 * I64[R1 + 46]; _s5Bq::I64 = _s5FB::I64 + _s5Bo::I64; _s5FA::I64 = I64[R1 + 38] + _s5Bq::I64; _s5Bz::F64 = F64[I64[R1 + 6] + 16 + (_s5FA::I64 << 3)]; _s5Fz::I64 = _s5Bm::I64 * I64[R1 + 62]; _s5Bv::I64 = _s5Fz::I64 + _s5Bo::I64; _s5Fy::I64 = I64[R1 + 54] + _s5Bv::I64; _s5BA::F64 = F64[I64[R1 + 14] + 16 + (_s5Fy::I64 << 3)]; _s5BB::F64 = %MO_F_Sub_W64(_s5Bz::F64, _s5BA::F64); _c6eQ::I64 = %MO_F_Ge_W64(_s5BB::F64, 0.0 :: W64); ; if (_c6eQ::I64 >= 1) goto c6fd; _s5BE::F64 = %MO_F_Neg_W64(_s5BB::F64); _c6eW::I64 = %MO_F_Le_W64(_s5BE::F64, D1); ; if (_c6eW::I64 >= 1) goto c6fg; _s5Fx::I64 = R2 + 1; R2 = _s5Fx::I64; D1 = _s5BE::F64; jump iter_s5BH_info; // [R1, D1, R2] c6fb: D1 = D1; jump (I64[Sp + 0]); // [D1] c6fd: _c6eZ::I64 = %MO_F_Le_W64(_s5BB::F64, D1); ; if (_c6eZ::I64 >= 1) goto c6fj; _s5FK::I64 = R2 + 1; R2 = _s5FK::I64; D1 = _s5BB::F64; jump iter_s5BH_info; // [R1, D1, R2] c6fj: _s5FL::I64 = R2 + 1; R2 = _s5FL::I64; jump iter_s5BH_info; // [R1, D1, R2] c6fg: _s5FM::I64 = R2 + 1; R2 = _s5FM::I64; jump iter_s5BH_info; // [R1, D1, R2] }, From johan.tibell at gmail.com Wed Jul 30 12:33:54 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Wed, 30 Jul 2014 14:33:54 +0200 Subject: [Haskell-cafe] redundant loads and saves in code generated for recursive functions? In-Reply-To: References: Message-ID: I see. I think this is worthwhile to file a bug for. Please include the cmm, asm, and llvm as attachedment (and perhaps a short Haskell program that show the issue). On Wed, Jul 30, 2014 at 2:10 PM, Jyotirmoy Bhattacharya wrote: > Hi, > > It doesn't seem the same to me. > > Unlike the bug you point to, the C-- does not have any extra stores. The > stores and loads appear first in the LLVM. I am attaching the C--, LLVM and > assembly codes for the function. > > The real missed opportunity seems to me the absence of a recognition that we > are in fact making a tail call to ourselves. Recognizing that might allow > jumping to some point after the initial stores. > > Jyotirmoy Bhattacharya > > > On Wed, Jul 30, 2014 at 4:14 PM, Johan Tibell > wrote: >> >> Hi Jyotirmoy, >> >> I didn't read your assembly carefully, but it sounds similar to >> https://ghc.haskell.org/trac/ghc/ticket/8905, which is not fixed yet. >> >> On Wed, Jul 30, 2014 at 12:03 PM, Jyotirmoy Bhattacharya >> wrote: >> > On reading this again I realise that I got the order of loads and stores >> > wrong. The arguments are being stored on entering the function and >> > loaded >> > before the call. But still, is there a chance of eliminating this >> > redundancy? >> > >> > Jyotirmoy >> > >> > >> > On Wed, Jul 30, 2014 at 1:54 PM, Jyotirmoy Bhattacharya >> > wrote: >> >> >> >> Dear All, >> >> >> >> I am new to Haskell so please forgive me if I am asking about something >> >> already well-understood. >> >> >> >> I was trying to understand the performance of my Haskell program >> >> compiled >> >> with the LLVM backend. I used -ddump-llvm to dump the LLVM assembly and >> >> then >> >> ran llc -O3 on the resulting file to look at the native assembly. >> >> >> >> One of the generated function starts off with >> >> s5BH_info: # @s5BH_info >> >> # BB#0: >> >> subq $208, %rsp >> >> movq %r13, 200(%rsp) >> >> movq %rbp, 192(%rsp) >> >> movq %r12, 184(%rsp) >> >> movq %rbx, 176(%rsp) >> >> movq %r14, 168(%rsp) >> >> movq %rsi, 160(%rsp) >> >> movq %rdi, 152(%rsp) >> >> movq %r8, 144(%rsp) >> >> movq %r9, 136(%rsp) >> >> movq %r15, 128(%rsp) >> >> movss %xmm1, 124(%rsp) >> >> movss %xmm2, 120(%rsp) >> >> movss %xmm3, 116(%rsp) >> >> movss %xmm4, 112(%rsp) >> >> movsd %xmm5, 104(%rsp) >> >> movsd %xmm6, 96(%rsp) >> >> >> >> At some point down the line the function makes a tail call to itself >> >> and >> >> this is the code generated >> >> movq %r14, 168(%rsp) >> >> movq 200(%rsp), %r13 >> >> movq 192(%rsp), %rbp >> >> movq 184(%rsp), %r12 >> >> movq 176(%rsp), %rbx >> >> movq 128(%rsp), %r15 >> >> movsd 104(%rsp), %xmm5 >> >> addq $208, %rsp >> >> jmp s5BH_info >> >> >> >> So it looks like some values are being moved from registers to the >> >> stack >> >> only to be immediately moved from the stack to the register on entry to >> >> the >> >> function. It should be possible to eliminate both the load and the >> >> stores. >> >> >> >> Is this behaviour due to LLVM or GHC? If it is GHC, it this an >> >> optimization a newcomer can attempt to implement or are there deep >> >> issues >> >> here? >> >> >> >> Jyotirmoy Bhattacharya >> >> >> >> >> > >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > From mbrock at goula.sh Wed Jul 30 12:56:01 2014 From: mbrock at goula.sh (Mikael Brockman) Date: Wed, 30 Jul 2014 14:56:01 +0200 Subject: [Haskell-cafe] Intuition to understand poor man's concurrency References: <53D4D7F5.5090904@web.de> Message-ID: Benjamin Franksen writes: > martin wrote: >> I am trying to understand the ideas of Koen Klaessen, published in >> Functional Pearls: "A poor man's concurrency" (1993). > > [...] > > m >>= k = \f -> m (\x -> k x f) > > If you re-add the newtype wrapping and unwrapping, this is exactly the > same as your definition above. > > This is one answer to the question of how one can arrive at a suitable > definition of >>= for the continuation monad. But it does not tell us > anything about how to arrive at an intuition about what this > implementation really does. Maybe someone else can explain this... Values of `Cont a` are functions in continuation-passing style. That is, they are functions that hand their results to a continuation passing function, instead of returning. I think the trickiness of this stuff has more to do with continuation-passing style in general and less to do with any inherent abstruseness of monadic bind. With some CPS familiarity, you can see that `m` is just a function that accepts a continuation, and `k` is a function that accepts the intermediate result and the next continuation. We know that our new CPS function is going to accept a continuation argument. We also know -- by the semantics of CPS -- that this continuation will be handed to `k`. So this CPS function \f -> m (\x -> k x f) says: given a continuation `f`, invoke `m` with a continuation that hands the intermediate result to `k` with the continuation `f`. You can see how a chain like (given the actual Monad instance) do x <- m1 y <- m2 x m3 y will expand into a CPS function that passes along the continuation such that `m3` is finally invoked with the continuation of the entire block. And then, the presence of the Monad constraint just makes it obvious that this can be used as a monad transformer. -- Mikael Brockman mikael at silk.co From mbrock at goula.sh Wed Jul 30 13:10:21 2014 From: mbrock at goula.sh (Mikael Brockman) Date: Wed, 30 Jul 2014 15:10:21 +0200 Subject: [Haskell-cafe] Intuition to understand poor man's concurrency References: <53D4D7F5.5090904@web.de> Message-ID: Mikael Brockman writes: > Values of `Cont a` are functions in continuation-passing style. That > is, they are functions that hand their results to a continuation passing > function, instead of returning. Ehh, this should be something like "hand their results to explicitly passed continuation functions." Sorry for the confusion. :) From tikhon at jelv.is Wed Jul 30 17:31:00 2014 From: tikhon at jelv.is (Tikhon Jelvis) Date: Wed, 30 Jul 2014 10:31:00 -0700 Subject: [Haskell-cafe] How to update a cabal dependency automatically In-Reply-To: <1d549fa2-bb6e-403a-b7ce-e012104828e4@googlegroups.com> References: <39801184-f9e5-47ac-9638-a3361fc60187@googlegroups.com> <53D789E5.6020709@plaimi.net> <1d549fa2-bb6e-403a-b7ce-e012104828e4@googlegroups.com> Message-ID: Do you have a copy of the error message we can look at? It's hard to say anything without that. If the output is long, it might be better to put it up on http://lpaste.net/ instead of including it right in the email. On Wed, Jul 30, 2014 at 12:54 AM, ye yan wrote: > git add -p works very good in this case, thank you for your advise. Just > wondering how does cabal solve dependencies? > > I updated my cabal file. ghci works find with my development box. but when > I checkout with other computer I got a dependency error. It seems cabal > failed to detect the correct library version I am using in ghci. Or just > because for parsec library I have multiple versions installed? > > On Wednesday, July 30, 2014 9:31:52 AM UTC+9:30, Lyndon Maydwell wrote: > >> If your project is in git you might be able to take advantage of `git >> add -p` in combination with `cabal init --overwrite`. >> >> On Tue, Jul 29, 2014 at 10:32 PM, ye yan wrote: >> > Thanks for replying. I will be using cabal init --overwrite until the >> new >> > feature is complete :D >> > >> > >> > On Tuesday, July 29, 2014 9:18:09 PM UTC+9:30, Alexander Berntsen >> wrote: >> >> >> >> -----BEGIN PGP SIGNED MESSAGE----- >> >> Hash: SHA256 >> >> >> >> On 29/07/14 07:52, ye yan wrote: >> >> > I have been working on a haskell scotty project recently. I have >> >> > just added configuration support for the project, which added an >> >> > extra dependency of Control.Lens. My question is: is there a way >> >> > update .cabal file automatically, just like cabal init but without >> >> > recreate .cabal file? >> >> No. I've been planning to work on that, but haven't had the time yet. >> >> Thanks for the reminder. >> >> - -- >> >> Alexander >> >> alex... at plaimi.net >> >> https://secure.plaimi.net/~alexander >> >> -----BEGIN PGP SIGNATURE----- >> >> Version: GnuPG v2 >> >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ >> >> >> >> iF4EAREIAAYFAlPXieUACgkQRtClrXBQc7VsQQD+PB/Tyr7S/a5SGE+aN0CgKWHu >> >> RFcn35Eqi8jgsaPs/rAA/3/IqdT9DyFZGiYZXHm4m7ndSQyQvy8CZ5pVv+5QlcDN >> >> =h5Ex >> >> -----END PGP SIGNATURE----- >> >> _______________________________________________ >> >> Haskell-Cafe mailing list >> >> Haskel... at haskell.org >> >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskel... at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskel... at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jyotirmoy at jyotirmoy.net Wed Jul 30 17:37:15 2014 From: jyotirmoy at jyotirmoy.net (Jyotirmoy Bhattacharya) Date: Wed, 30 Jul 2014 23:07:15 +0530 Subject: [Haskell-cafe] redundant loads and saves in code generated for recursive functions? In-Reply-To: References: Message-ID: I have filed a bug https://ghc.haskell.org/trac/ghc/ticket/9387 On Wed, Jul 30, 2014 at 6:03 PM, Johan Tibell wrote: > I see. I think this is worthwhile to file a bug for. Please include > the cmm, asm, and llvm as attachedment (and perhaps a short Haskell > program that show the issue). > > On Wed, Jul 30, 2014 at 2:10 PM, Jyotirmoy Bhattacharya > wrote: > > Hi, > > > > It doesn't seem the same to me. > > > > Unlike the bug you point to, the C-- does not have any extra stores. The > > stores and loads appear first in the LLVM. I am attaching the C--, LLVM > and > > assembly codes for the function. > > > > The real missed opportunity seems to me the absence of a recognition > that we > > are in fact making a tail call to ourselves. Recognizing that might allow > > jumping to some point after the initial stores. > > > > Jyotirmoy Bhattacharya > > > > > > On Wed, Jul 30, 2014 at 4:14 PM, Johan Tibell > > wrote: > >> > >> Hi Jyotirmoy, > >> > >> I didn't read your assembly carefully, but it sounds similar to > >> https://ghc.haskell.org/trac/ghc/ticket/8905, which is not fixed yet. > >> > >> On Wed, Jul 30, 2014 at 12:03 PM, Jyotirmoy Bhattacharya > >> wrote: > >> > On reading this again I realise that I got the order of loads and > stores > >> > wrong. The arguments are being stored on entering the function and > >> > loaded > >> > before the call. But still, is there a chance of eliminating this > >> > redundancy? > >> > > >> > Jyotirmoy > >> > > >> > > >> > On Wed, Jul 30, 2014 at 1:54 PM, Jyotirmoy Bhattacharya > >> > wrote: > >> >> > >> >> Dear All, > >> >> > >> >> I am new to Haskell so please forgive me if I am asking about > something > >> >> already well-understood. > >> >> > >> >> I was trying to understand the performance of my Haskell program > >> >> compiled > >> >> with the LLVM backend. I used -ddump-llvm to dump the LLVM assembly > and > >> >> then > >> >> ran llc -O3 on the resulting file to look at the native assembly. > >> >> > >> >> One of the generated function starts off with > >> >> s5BH_info: # @s5BH_info > >> >> # BB#0: > >> >> subq $208, %rsp > >> >> movq %r13, 200(%rsp) > >> >> movq %rbp, 192(%rsp) > >> >> movq %r12, 184(%rsp) > >> >> movq %rbx, 176(%rsp) > >> >> movq %r14, 168(%rsp) > >> >> movq %rsi, 160(%rsp) > >> >> movq %rdi, 152(%rsp) > >> >> movq %r8, 144(%rsp) > >> >> movq %r9, 136(%rsp) > >> >> movq %r15, 128(%rsp) > >> >> movss %xmm1, 124(%rsp) > >> >> movss %xmm2, 120(%rsp) > >> >> movss %xmm3, 116(%rsp) > >> >> movss %xmm4, 112(%rsp) > >> >> movsd %xmm5, 104(%rsp) > >> >> movsd %xmm6, 96(%rsp) > >> >> > >> >> At some point down the line the function makes a tail call to itself > >> >> and > >> >> this is the code generated > >> >> movq %r14, 168(%rsp) > >> >> movq 200(%rsp), %r13 > >> >> movq 192(%rsp), %rbp > >> >> movq 184(%rsp), %r12 > >> >> movq 176(%rsp), %rbx > >> >> movq 128(%rsp), %r15 > >> >> movsd 104(%rsp), %xmm5 > >> >> addq $208, %rsp > >> >> jmp s5BH_info > >> >> > >> >> So it looks like some values are being moved from registers to the > >> >> stack > >> >> only to be immediately moved from the stack to the register on entry > to > >> >> the > >> >> function. It should be possible to eliminate both the load and the > >> >> stores. > >> >> > >> >> Is this behaviour due to LLVM or GHC? If it is GHC, it this an > >> >> optimization a newcomer can attempt to implement or are there deep > >> >> issues > >> >> here? > >> >> > >> >> Jyotirmoy Bhattacharya > >> >> > >> >> > >> > > >> > > >> > _______________________________________________ > >> > Haskell-Cafe mailing list > >> > Haskell-Cafe at haskell.org > >> > http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Wed Jul 30 18:00:13 2014 From: martin.drautzburg at web.de (martin) Date: Wed, 30 Jul 2014 20:00:13 +0200 Subject: [Haskell-cafe] Intuition to understand ... In-Reply-To: <86bns8bkfb.fsf@gmail.com> References: <53D4D7F5.5090904@web.de> <53D55181.6020904@gmail.com> <53D6A2F7.7040004@web.de> <86bns8bkfb.fsf@gmail.com> Message-ID: <53D932AD.9020801@web.de> Am 07/29/2014 11:09 AM, schrieb Chris Warburton: > Bind can often be a bit tricky. I usually find it easier to define bind > as: > >> x >>= f = join (fmap f x) > > Then ignore it and focus on fmap and join instead. This is a 'divide and > conquer' approach. So you're really throwing symbols around? When I do math, I do similar things. Particularly in algebra I don't ask myself what e.g. a cubic root does, because I know the laws of roots and I know what I can do with the symbols. However, for other things, like an integral or a gradient I have a strong intuition. I have intuition for some of the simpler things in haskell too. For functions, folds and functors I have some intuition. In math, the only ways I know of to get a better intuition is practice and a good teacher. Maybe it is the same in haskell? From lemmih at gmail.com Wed Jul 30 18:08:49 2014 From: lemmih at gmail.com (Lemmih) Date: Thu, 31 Jul 2014 02:08:49 +0800 Subject: [Haskell-cafe] redundant loads and saves in code generated for recursive functions? In-Reply-To: References: Message-ID: Interestingly enough, if you run ?opt? on the llvm code before compiling it with ?llc?, you get the optimised code you would expect. On Thursday 31 July 2014 at 01:37, Jyotirmoy Bhattacharya wrote: > I have filed a bug > https://ghc.haskell.org/trac/ghc/ticket/9387 > > > On Wed, Jul 30, 2014 at 6:03 PM, Johan Tibell wrote: > > I see. I think this is worthwhile to file a bug for. Please include > > the cmm, asm, and llvm as attachedment (and perhaps a short Haskell > > program that show the issue). > > > > On Wed, Jul 30, 2014 at 2:10 PM, Jyotirmoy Bhattacharya > > wrote: > > > Hi, > > > > > > It doesn't seem the same to me. > > > > > > Unlike the bug you point to, the C-- does not have any extra stores. The > > > stores and loads appear first in the LLVM. I am attaching the C--, LLVM and > > > assembly codes for the function. > > > > > > The real missed opportunity seems to me the absence of a recognition that we > > > are in fact making a tail call to ourselves. Recognizing that might allow > > > jumping to some point after the initial stores. > > > > > > Jyotirmoy Bhattacharya > > > > > > > > > On Wed, Jul 30, 2014 at 4:14 PM, Johan Tibell > > > wrote: > > >> > > >> Hi Jyotirmoy, > > >> > > >> I didn't read your assembly carefully, but it sounds similar to > > >> https://ghc.haskell.org/trac/ghc/ticket/8905, which is not fixed yet. > > >> > > >> On Wed, Jul 30, 2014 at 12:03 PM, Jyotirmoy Bhattacharya > > >> wrote: > > >> > On reading this again I realise that I got the order of loads and stores > > >> > wrong. The arguments are being stored on entering the function and > > >> > loaded > > >> > before the call. But still, is there a chance of eliminating this > > >> > redundancy? > > >> > > > >> > Jyotirmoy > > >> > > > >> > > > >> > On Wed, Jul 30, 2014 at 1:54 PM, Jyotirmoy Bhattacharya > > >> > wrote: > > >> >> > > >> >> Dear All, > > >> >> > > >> >> I am new to Haskell so please forgive me if I am asking about something > > >> >> already well-understood. > > >> >> > > >> >> I was trying to understand the performance of my Haskell program > > >> >> compiled > > >> >> with the LLVM backend. I used -ddump-llvm to dump the LLVM assembly and > > >> >> then > > >> >> ran llc -O3 on the resulting file to look at the native assembly. > > >> >> > > >> >> One of the generated function starts off with > > >> >> s5BH_info: # @s5BH_info > > >> >> # BB#0: > > >> >> subq $208, %rsp > > >> >> movq %r13, 200(%rsp) > > >> >> movq %rbp, 192(%rsp) > > >> >> movq %r12, 184(%rsp) > > >> >> movq %rbx, 176(%rsp) > > >> >> movq %r14, 168(%rsp) > > >> >> movq %rsi, 160(%rsp) > > >> >> movq %rdi, 152(%rsp) > > >> >> movq %r8, 144(%rsp) > > >> >> movq %r9, 136(%rsp) > > >> >> movq %r15, 128(%rsp) > > >> >> movss %xmm1, 124(%rsp) > > >> >> movss %xmm2, 120(%rsp) > > >> >> movss %xmm3, 116(%rsp) > > >> >> movss %xmm4, 112(%rsp) > > >> >> movsd %xmm5, 104(%rsp) > > >> >> movsd %xmm6, 96(%rsp) > > >> >> > > >> >> At some point down the line the function makes a tail call to itself > > >> >> and > > >> >> this is the code generated > > >> >> movq %r14, 168(%rsp) > > >> >> movq 200(%rsp), %r13 > > >> >> movq 192(%rsp), %rbp > > >> >> movq 184(%rsp), %r12 > > >> >> movq 176(%rsp), %rbx > > >> >> movq 128(%rsp), %r15 > > >> >> movsd 104(%rsp), %xmm5 > > >> >> addq $208, %rsp > > >> >> jmp s5BH_info > > >> >> > > >> >> So it looks like some values are being moved from registers to the > > >> >> stack > > >> >> only to be immediately moved from the stack to the register on entry to > > >> >> the > > >> >> function. It should be possible to eliminate both the load and the > > >> >> stores. > > >> >> > > >> >> Is this behaviour due to LLVM or GHC? If it is GHC, it this an > > >> >> optimization a newcomer can attempt to implement or are there deep > > >> >> issues > > >> >> here? > > >> >> > > >> >> Jyotirmoy Bhattacharya > > >> >> > > >> >> > > >> > > > >> > > > >> > _______________________________________________ > > >> > Haskell-Cafe mailing list > > >> > Haskell-Cafe at haskell.org (mailto:Haskell-Cafe at haskell.org) > > >> > http://www.haskell.org/mailman/listinfo/haskell-cafe > > >> > > > > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org (mailto:Haskell-Cafe at haskell.org) > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerzy.karczmarczuk at unicaen.fr Wed Jul 30 18:59:37 2014 From: jerzy.karczmarczuk at unicaen.fr (Jerzy Karczmarczuk) Date: Wed, 30 Jul 2014 20:59:37 +0200 Subject: [Haskell-cafe] Intuition to understand ... In-Reply-To: <53D932AD.9020801@web.de> References: <53D4D7F5.5090904@web.de> <53D55181.6020904@gmail.com> <53D6A2F7.7040004@web.de> <86bns8bkfb.fsf@gmail.com> <53D932AD.9020801@web.de> Message-ID: <53D94099.50806@unicaen.fr> Le 30/07/2014 20:00, martin a ?crit : > for other things, like an integral or a gradient I have a strong intuition. Oh, do you?... My deepest respect and admiration. I have used gradients and integrals for almost a half of century, and I lost all intuition thereof several times... I thought I had quite a quite substantial intuition of gradients, and then I discovered tensorial calculus, and when my intuition "progressed", I discovered differential forms, and then fibre bundles, and I broke some teeth on topological issues, and then ... And with integrals it was much worse. ??? ????? ?? ?????????! > In math, the only ways I know of to get a better intuition is practice and a good teacher. Maybe it is the same in haskell? In math, your practice doesn't give you any intuition. Your training and your teacher increase your belief that the model you use is right. It is the "love after marriage" syndrome. It works with most formal, disciplined approach to anything, Haskell included. It is needed that you can *formulate* your thoughts, but the true intuition, your insight, the impression that you KNOW that something is "right", is independent of it. The best. Jerzy Karczmarczuk Caen, France From trebla at vex.net Wed Jul 30 19:29:03 2014 From: trebla at vex.net (Albert Y. C. Lai) Date: Wed, 30 Jul 2014 15:29:03 -0400 Subject: [Haskell-cafe] Intuition to understand ... In-Reply-To: <53D932AD.9020801@web.de> References: <53D4D7F5.5090904@web.de> <53D55181.6020904@gmail.com> <53D6A2F7.7040004@web.de> <86bns8bkfb.fsf@gmail.com> <53D932AD.9020801@web.de> Message-ID: <53D9477F.7040500@vex.net> On 14-07-30 02:00 PM, martin wrote: > When I do math, I do similar things. Particularly in algebra I don't ask myself what e.g. a cubic root does, because I > know the laws of roots and I know what I can do with the symbols. > > However, for other things, like an integral or a gradient I have a strong intuition. I have intuition for some of the > simpler things in haskell too. For functions, folds and functors I have some intuition. > > In math, the only ways I know of to get a better intuition is practice and a good teacher. Maybe it is the same in haskell? What, exactly, is intuition? Or, ironically, we shouldn't be asking that, just like we shouldn't be asking "what, exactly, is a set, or a number, or a cubic root?". Perhaps we should be asking: Where, exactly, does intuition come from? http://www.vex.net/~trebla/weblog/intuitive.html It seems logically obvious to me: If you are learning something new to you, then by definition of "new to you", you are not supposed to have any intuition yet (any correct intuition anyway --- oh, the human brain is great at manufacturing all kinds of wrong intuitions). You are supposed to practice the rules a lot, and then you gain intuition. I am always fond of citing Chess as an example. I don't think any Chess teachers teach intuition first, rules later. I'm pretty sure it's the other way round. And most likely they don't even tell you the intuition "control the centre" until you've practiced a million hours or something. And then, I don't value intuition very highly, certainly not as highly as most other people. Intuition is a great accelerator when it's right, but you never know whether it's right a priori. Symbolic manipulation has the final say. And symbolic manipulation teaches you new, correct intuition sometimes. Regarding bind and join, I find bind more obvious for some examples, and join for some other examples. I'm sure it is subjective. From trebla at vex.net Wed Jul 30 19:37:12 2014 From: trebla at vex.net (Albert Y. C. Lai) Date: Wed, 30 Jul 2014 15:37:12 -0400 Subject: [Haskell-cafe] Deduce issue. In-Reply-To: References: Message-ID: <53D94968.5030203@vex.net> On 14-07-29 04:44 AM, Magicloud Magiclouds wrote: > I should just use Widget I defined. Why not before.... > > But then I am confused on type cast again. How to extract the > existential type inside Widget? If you really want it, you need Data.Typeable. From oleg at okmij.org Thu Jul 31 01:14:15 2014 From: oleg at okmij.org (oleg at okmij.org) Date: Wed, 30 Jul 2014 21:14:15 -0400 (EDT) Subject: [Haskell-cafe] The ML Family workshop: program and the 2nd call for participation Message-ID: <20140731011415.79099C381C@www1.g3.pair.com> Higher-order, Typed, Inferred, Strict: ACM SIGPLAN ML Family Workshop Thursday September 4, 2014, Gothenburg, Sweden Call For Participation and Program http://okmij.org/ftp/ML/ML14.html Early registration deadline is August 3. Please register at https://regmaster4.com/2014conf/ICFP14/register.php The workshop is conducted in close cooperation with the OCaml Users and Developers Workshop http://ocaml.org/meetings/ocaml/2014/ taking place on September 5. *** Program with short summaries *** (The online version links to the full 2-page abstracts) * Welcome 09:00 * Session 1: Module Systems 09:10 - 10:00 1ML -- core and modules as one (Or: F-ing first-class modules) Andreas Rossberg We propose a redesign of ML in which modules are first-class values. Functions, functors, and even type constructors are one and the same construct. Likewise, no distinction is made between structures, records, or tuples, including tuples over types. Yet, 1ML does not depend on dependent types, and its type structure is expressible in terms of plain System F-omega, in a minor variation of our F-ing modules approach. Moreover, it supports (incomplete) Hindley/Milner-style type inference. Both is enabled by a simple universe distinction into small and large types. Type-level module aliases: independent and equal Jacques Garrigue; Leo White We promote the use of type-level module aliases, a trivial extension of the ML module system, which helps avoiding code dependencies, and provides an alternative to strengthening for type equalities. * Session 2: Beyond Hindley-Milner 10:30 - 11:20 The Rust Language and Type System (Demo) Felix Klock; Nicholas Matsakis Rust is a new programming language for developing reliable and efficient systems. It is designed to support concurrency and parallelism in building applications and libraries that take full advantage of modern hardware. Rust's static type system is safe and expressive and provides strong guarantees about isolation, concurrency, and memory safety. Rust also offers a clear performance model, making it easier to predict and reason about program efficiency. One important way it accomplishes this is by allowing fine-grained control over memory representations, with direct support for stack allocation and contiguous record storage. The language balances such controls with the absolute requirement for safety: Rust's type system and runtime guarantee the absence of data races, buffer overflows, stack overflows, and accesses to uninitialized or deallocated memory. In this demonstration, we will briefly review the language features that Rust leverages to accomplish the above goals, focusing in particular on Rust's advanced type system, and then show a collection of concrete examples of program subroutines that are efficient, easy for programmers to reason about, and maintain the above safety property. Doing web-based data analytics with F# (Informed Position) Tomas Petricek; Don Syme With type providers that integrate external data directly into the static type system, F# has become a fantastic language for doing data analysis. Rather than looking at F# features in isolation, this paper takes a holistic view and presents the F# approach through a case study of a simple web-based data analytics platform. * Session 3: Verification 11:40 - 12:30 Well-typed generic smart-fuzzing for APIs (Experience report) Thomas Braibant; Jonathan Protzenko; Gabriel Scherer In spite of recent advances in program certification, testing remains a widely-used component of the software development cycle. Various flavors of testing exist: popular ones include unit testing, which consists in manually crafting test cases for specific parts of the code base, as well as quickcheck-style testing, where instances of a type are automatically generated to serve as test inputs. These classical methods of testing can be thought of as internal testing: the test routines access the internal representation of the data structures to be checked. We propose a new method of external testing where the library only deals with a module interface. The data structures are exported as abstract types; the testing framework behaves like regular client code and combines functions exported by the module to build new elements of the various abstract types. Any counter-examples are then presented to the user. Furthermore, we demonstrate that this methodology applies to the smart-fuzzing of security APIs. Improving the CakeML Verified ML Compiler Ramana Kumar; Magnus O. Myreen; Michael Norrish; Scott Owens The CakeML project comprises a mechanised semantics for a subset of Standard ML and a formally verified compiler. We will discuss our plans for improving and applying CakeML in four directions: optimisations, new primitives, a library, and verified applications. * Session 4: Implicits 14:00 - 14:50 Implicits in Practice (Demo) Nada Amin; Tiark Rompf Popularized by Scala, implicits are a versatile language feature that are receiving attention from the wider PL community. This demo will present common use cases and programming patterns with implicits in Scala. Modular implicits Leo White; Fr?d?ric Bour We propose a system for ad-hoc polymorphism in OCaml based on using modules as type-directed implicit parameters. * Session 5: To the bare metal 15:10 - 16:00 Metaprogramming with ML modules in the MirageOS (Experience report) Anil Madhavapeddy; Thomas Gazagnaire; David Scott; Richard Mortier In this talk, we will go through how MirageOS lets the programmer build modular operating system components using a combination of functors and metaprogramming to ensure portability across both Unix and Xen, while preserving a usable developer workflow. Compiling SML# with LLVM: a Challenge of Implementing ML on a Common Compiler Infrastructure Katsuhiro Ueno; Atsushi Ohori We report on an LLVM backend of SML#. This development provides detailed accounts of implementing functional language functionalities in a common compiler infrastructure developed mainly for imperative languages. We also describe techniques to compile SML#'s elaborated features including separate compilation with polymorphism, and SML#'s unboxed data representation. * Session 6: No longer foreign 16:30 - 18:00 A Simple and Practical Linear Algebra Library Interface with Static Size Checking (Experience report) Akinori Abe; Eijiro Sumii While advanced type systems--specifically, dependent types on natural numbers--can statically ensure consistency among the sizes of collections such as lists and arrays, such type systems generally require non-trivial changes to existing languages and application programs, or tricky type-level programming. We have developed a linear algebra library interface that guarantees consistency (with respect to dimensions) of matrix (and vector) operations by using generative phantom types as fresh identifiers for statically checking the equality of sizes (i.e., dimensions). This interface has three attractive features in particular. (i) It can be implemented only using fairly standard ML types and its module system. Indeed, we implemented the interface in OCaml (without significant extensions like GADTs) as a wrapper for an existing library. (ii) For most high-level operations on matrices (e.g., addition and multiplication), the consistency of sizes is verified statically. (Certain low-level operations, like accesses to elements by indices, need dynamic checks.) (iii) Application programs in a traditional linear algebra library can be easily migrated to our interface. Most of the required changes can be made mechanically. To evaluate the usability of our interface, we ported to it a practical machine learning library (OCaml-GPR) from an existing linear algebra library (Lacaml), thereby ensuring the consistency of sizes. SML3d: 3D Graphics for Standard ML (Demo) John Reppy The SML3d system is a collection of libraries designed to support real-time 3D graphics programming in Standard ML (SML). This paper gives an overview of the system and briefly highlights some of the more interesting aspects of its design and implementation. * Poster presentation, at the joint poster session with the OCaml workshop Nullable Type Inference Michel Mauny; Benoit Vaugon We present a type system for nullable types in an ML-like programming language. We start with a simple system, presented as an algorithm, whose interest is to introduce the formalism that we use. We then extend it as system using subtyping constraints, that accepts more programs. We state the usual properties for both systems. This is work in progress. Program Committee Kenichi Asai Ochanomizu University, Japan Matthew Fluet Rochester Institute of Technology, USA Jacques Garrigue Nagoya University, Japan Dave Herman Mozilla, USA Stefan Holdermans Vector Fabrics, Netherlands Oleg Kiselyov (Chair) University of Tsukuba, Japan Keiko Nakata Tallinn University of Technology, Estonia Didier Remy INRIA Paris-Rocquencourt, France Zhong Shao Yale University, USA Hongwei Xi Boston University, USA From vigalchin at gmail.com Thu Jul 31 03:08:06 2014 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Wed, 30 Jul 2014 22:08:06 -0500 Subject: [Haskell-cafe] www.galois.com vs Google?? Message-ID: Hello Haskellers(and all FPL people), I just ran across the following effort by Google: http://blogs.techworld.com/war-on-error/2014/07/googles-project-zero-flaw-programme-do-gooding-spin-or-a-much-needed-evolution/index.htm It seems to me that www.galois.com(www.janestreetcapital.com) realizes that the solution to software correctness problems doesn't lie with uncontrolled "mutability" ... Question: does Google concur with www.galois.com or google's effort just "more of the same"?? Vasili From dstcruz at gmail.com Thu Jul 31 03:40:34 2014 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 30 Jul 2014 21:40:34 -0600 Subject: [Haskell-cafe] Haskell Weekly News: Issue 300 Message-ID: Welcome to issue 300 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from July 13 to 26, 2014 Looks like we are chuck-full of goodies this time around! Enjoy! Quotes of the Week * Cale: Functions aren't monads, the type constructor (->) e is a monad * glguy: There's no achievement for using all the operators * benmachine: adoption by lots of people may stunt progress of haskell, but it will probably help the progress of people Top Reddit Stories * Somehow, this happened. Haskell Ryan Gosling. Domain: haskellryangosling.tumblr.com, Score: 144, Comments: 31 Original: [1] http://goo.gl/IQ2f3s On Reddit: [2] http://goo.gl/H24aRa * Papers every haskeller should read Domain: self.haskell, Score: 104, Comments: 35 Original: [3] http://goo.gl/R7uGSB On Reddit: [4] http://goo.gl/R7uGSB * Strict Language Pragma Proposal Domain: ghc.haskell.org, Score: 86, Comments: 95 Original: [5] http://goo.gl/Yq28yt On Reddit: [6] http://goo.gl/BlmXpA * Announcing engine-io and socket-io for Haskell Domain: ocharles.org.uk, Score: 81, Comments: 7 Original: [7] http://goo.gl/PGW8Y8 On Reddit: [8] http://goo.gl/IsGRGi * The Haskell Cast #8 - Ollie Charles on 24 Days of Hackage and Nix Domain: haskellcast.com, Score: 70, Comments: 12 Original: [9] http://goo.gl/jBc9bk On Reddit: [10] http://goo.gl/syhwPd * Blazing Fast HTML - Virtual DOM in Elm Domain: elm-lang.org, Score: 60, Comments: 28 Original: [11] http://goo.gl/3luwtw On Reddit: [12] http://goo.gl/88zNkZ * Idris 0.9.14 released, with updated JavaScript backend, quasiquotes, and lots of internal cleanups and improvements Domain: idris-lang.org, Score: 55, Comments: 11 Original: [13] http://goo.gl/wmW3RM On Reddit: [14] http://goo.gl/fN28z6 * hoodle 0.3 released - free pen note taking program Domain: ianwookim.org, Score: 53, Comments: 15 Original: [15] http://goo.gl/jauFC On Reddit: [16] http://goo.gl/upMnf6 * This just in, from my local GHC/Cabal checkout... (re: Cabal Hell) Domain: self.haskell, Score: 52, Comments: 13 Original: [17] http://goo.gl/tD2yOg On Reddit: [18] http://goo.gl/tD2yOg * Haskell for all: Equational reasoning at scale Domain: haskellforall.com, Score: 52, Comments: 29 Original: [19] http://goo.gl/BZtZ4R On Reddit: [20] http://goo.gl/xKxCM3 * Complete roadmap from total novice to Haskell mastery? Domain: self.haskell, Score: 50, Comments: 74 Original: [21] http://goo.gl/5y1lXA On Reddit: [22] http://goo.gl/5y1lXA * Write webservices around databases with 0 boilerplate: announcing servant 0.1 Domain: alpmestan.com, Score: 50, Comments: 16 Original: [23] http://goo.gl/vzz8aT On Reddit: [24] http://goo.gl/qTty6u * Mutable Algorithms in Immutable Languages, Part 3 Domain: tel.github.io, Score: 49, Comments: 2 Original: [25] http://goo.gl/uG5Bds On Reddit: [26] http://goo.gl/qrdk6Y * Best Practices for Avoiding Cabal Hell Domain: softwaresimply.blogspot.com, Score: 47, Comments: 13 Original: [27] http://goo.gl/OqG241 On Reddit: [28] http://goo.gl/fapyz2 * Applicative (Make) vs Monadic (Shake) build systems Domain: neilmitchell.blogspot.co.uk, Score: 47, Comments: 7 Original: [29] http://goo.gl/CPyzpd On Reddit: [30] http://goo.gl/2eW8Ed * Nemnem - Haskell source hyperlinker Domain: robinp.github.io, Score: 41, Comments: 33 Original: [31] http://goo.gl/2msbLR On Reddit: [32] http://goo.gl/R6hBOl * Let me tell you about the types of data Domain: tel.github.io, Score: 41, Comments: 51 Original: [33] http://goo.gl/ZjJelo On Reddit: [34] http://goo.gl/bbmXSW * Lens Tutorial - Introduction (part 1) Domain: blog.jakubarnold.cz, Score: 39, Comments: 11 Original: [35] http://goo.gl/yQRoPY On Reddit: [36] http://goo.gl/fnbZ0F * Help - I wrote some Haskell code, it works, but it's slower than Python. What did I do wrong? Domain: self.haskell, Score: 39, Comments: 43 Original: [37] http://goo.gl/CG13CR On Reddit: [38] http://goo.gl/CG13CR * IntrinsicSuperclasses for Haskell (new proposal for default superclass instances by Conor McBride) Domain: ghc.haskell.org, Score: 37, Comments: 10 Original: [39] http://goo.gl/vDYUQh On Reddit: [40] http://goo.gl/vZjHXS * hackage-diff: Compare the public API of different versions of a Hackage library Domain: self.haskell, Score: 37, Comments: 32 Original: [41] http://goo.gl/y682CB On Reddit: [42] http://goo.gl/y682CB * How do you avoid the Cabal Hell?? Domain: self.haskell, Score: 36, Comments: 30 Original: [43] http://goo.gl/9uS54H On Reddit: [44] http://goo.gl/9uS54H * Edward Kmett on Hask Domain: youtu.be, Score: 35, Comments: 34 Original: [45] http://goo.gl/1lfywk On Reddit: [46] http://goo.gl/D0AuFQ * Mutable Algorithms in Immutable Languages, Part 2 Domain: tel.github.io, Score: 33, Comments: 1 Original: [47] http://goo.gl/g0ylvT On Reddit: [48] http://goo.gl/jwwr87 * Multi-instance packages status report Domain: permalink.gmane.org, Score: 32, Comments: 7 Original: [49] http://goo.gl/JSPx39 On Reddit: [50] http://goo.gl/2rzPJL * Slides from Conan Elliott's workshop on Denotational Design: from meanings to programs Domain: conal.net, Score: 32, Comments: 6 Original: [51] http://goo.gl/GwO4Fv On Reddit: [52] http://goo.gl/0u9KVl * Reactive-banana anti-tutorial Domain: gelisam.blogspot.ca, Score: 31, Comments: 23 Original: [53] http://goo.gl/D7mv4X On Reddit: [54] http://goo.gl/shMY0N * Intro to Machines & Arrows Part 2: 'Auto' as Category, Applicative & Arrow, ft. locally stateful compositions; Further down the road to an Arrowized FRP implementation. Domain: blog.jle.im, Score: 28, Comments: 9 Original: [55] http://goo.gl/xkwocR On Reddit: [56] http://goo.gl/phqXn8 Top StackOverflow Questions * Examples of histomorphisms in Haskell votes: 16, answers: 2 Read on SO: [57] http://goo.gl/ZmGzI6 * Plan B, or what's the opposite of Maybe's >>=? votes: 15, answers: 2 Read on SO: [58] http://goo.gl/rYWlzQ * Let-renaming function breaks code votes: 14, answers: 2 Read on SO: [59] http://goo.gl/R9CGyL * Pattern matching on rank-2 type votes: 14, answers: 3 Read on SO: [60] http://goo.gl/s0IszK * Haskell algorithm advice and suggestions for alternate solutions votes: 14, answers: 1 Read on SO: [61] http://goo.gl/2l23N8 * Why can't Haskell be tricked into performing IO operations by using strict evaluation? votes: 14, answers: 2 Read on SO: [62] http://goo.gl/Ey9795 * How does lifting (in a functional programming context) relate to category theory? votes: 14, answers: 1 Read on SO: [63] http://goo.gl/esTTbO Until next time, [64]+Daniel Santa Cruz References 1. http://haskellryangosling.tumblr.com/ 2. http://www.reddit.com/r/haskell/comments/2avnc0/somehow_this_happened_haskell_ryan_gosling/ 3. http://www.reddit.com/r/haskell/comments/2blsqa/papers_every_haskeller_should_read/ 4. http://www.reddit.com/r/haskell/comments/2blsqa/papers_every_haskeller_should_read/ 5. https://ghc.haskell.org/trac/ghc/wiki/StrictPragma 6. http://www.reddit.com/r/haskell/comments/2bi69g/strict_language_pragma_proposal/ 7. https://ocharles.org.uk/blog/posts/2014-07-13-announcing-socket-io-for-haskell.html 8. http://www.reddit.com/r/haskell/comments/2aks91/announcing_engineio_and_socketio_for_haskell/ 9. http://www.haskellcast.com/episode/008-ollie-charles-on-24-days-of-hackage-and-nix/ 10. http://www.reddit.com/r/haskell/comments/2bbc82/the_haskell_cast_8_ollie_charles_on_24_days_of/ 11. http://elm-lang.org/blog/Blazing-Fast-Html.elm 12. http://www.reddit.com/r/haskell/comments/2bam6p/blazing_fast_html_virtual_dom_in_elm/ 13. http://www.idris-lang.org/idris-0-9-14-released/ 14. http://www.reddit.com/r/haskell/comments/2aw6vl/idris_0914_released_with_updated_javascript/ 15. http://ianwookim.org/hoodle/ 16. http://www.reddit.com/r/haskell/comments/2aotln/hoodle_03_released_free_pen_note_taking_program/ 17. http://www.reddit.com/r/haskell/comments/2b7odl/this_just_in_from_my_local_ghccabal_checkout_re/ 18. http://www.reddit.com/r/haskell/comments/2b7odl/this_just_in_from_my_local_ghccabal_checkout_re/ 19. http://www.haskellforall.com/2014/07/equational-reasoning-at-scale.html 20. http://www.reddit.com/r/haskell/comments/2b7xwx/haskell_for_all_equational_reasoning_at_scale/ 21. http://www.reddit.com/r/haskell/comments/2ali12/complete_roadmap_from_total_novice_to_haskell/ 22. http://www.reddit.com/r/haskell/comments/2ali12/complete_roadmap_from_total_novice_to_haskell/ 23. http://alpmestan.com/posts/2014-07-26-announcing-servant.html 24. http://www.reddit.com/r/haskell/comments/2bs536/write_webservices_around_databases_with_0/ 25. http://tel.github.io/2014/07/15/mutable_algorithms_in_immutable_languages_part_3/ 26. http://www.reddit.com/r/haskell/comments/2ase1q/mutable_algorithms_in_immutable_languages_part_3/ 27. http://softwaresimply.blogspot.com/2014/07/haskell-best-practices-for-avoiding.html 28. http://www.reddit.com/r/haskell/comments/2ameew/best_practices_for_avoiding_cabal_hell/ 29. http://neilmitchell.blogspot.co.uk/2014/07/applicative-vs-monadic-build-systems.html 30. http://www.reddit.com/r/haskell/comments/2blex3/applicative_make_vs_monadic_shake_build_systems/ 31. http://robinp.github.io/nemnem/ 32. http://www.reddit.com/r/haskell/comments/2ata3n/nemnem_haskell_source_hyperlinker/ 33. http://tel.github.io/2014/07/23/types_of_data/ 34. http://www.reddit.com/r/haskell/comments/2bj7it/let_me_tell_you_about_the_types_of_data/ 35. http://blog.jakubarnold.cz/2014/07/14/lens-tutorial-introduction-part-1.html 36. http://www.reddit.com/r/haskell/comments/2ap02f/lens_tutorial_introduction_part_1/ 37. http://www.reddit.com/r/haskell/comments/2brxwp/help_i_wrote_some_haskell_code_it_works_but_its/ 38. http://www.reddit.com/r/haskell/comments/2brxwp/help_i_wrote_some_haskell_code_it_works_but_its/ 39. https://ghc.haskell.org/trac/ghc/wiki/IntrinsicSuperclasses 40. http://www.reddit.com/r/haskell/comments/2avs16/intrinsicsuperclasses_for_haskell_new_proposal/ 41. http://www.reddit.com/r/haskell/comments/2b5jfd/hackagediff_compare_the_public_api_of_different/ 42. http://www.reddit.com/r/haskell/comments/2b5jfd/hackagediff_compare_the_public_api_of_different/ 43. http://www.reddit.com/r/haskell/comments/2al3vx/how_do_you_avoid_the_cabal_hell/ 44. http://www.reddit.com/r/haskell/comments/2al3vx/how_do_you_avoid_the_cabal_hell/ 45. http://youtu.be/Klwkt9oJwg0 46. http://www.reddit.com/r/haskell/comments/2b3rk5/edward_kmett_on_hask/ 47. http://tel.github.io/2014/07/13/mutable_algorithms_in_immutable_languages_part_2/ 48. http://www.reddit.com/r/haskell/comments/2al4cw/mutable_algorithms_in_immutable_languages_part_2/ 49. http://permalink.gmane.org/gmane.comp.lang.haskell.ghc.devel/5413 50. http://www.reddit.com/r/haskell/comments/2bbys6/multiinstance_packages_status_report/ 51. http://conal.net/talks/lambdajam-2014.pdf 52. http://www.reddit.com/r/haskell/comments/2brioe/slides_from_conan_elliotts_workshop_on/ 53. http://gelisam.blogspot.ca/2014/07/reactive-banana-anti-tutorial.html 54. http://www.reddit.com/r/haskell/comments/2auswf/reactivebanana_antitutorial/ 55. http://blog.jle.im/entry/auto-as-category-applicative-arrow-intro-to-machines 56. http://www.reddit.com/r/haskell/comments/2aot3i/intro_to_machines_arrows_part_2_auto_as_category/ 57. http://stackoverflow.com/questions/24884475/examples-of-histomorphisms-in-haskell 58. http://stackoverflow.com/questions/24902463/plan-b-or-whats-the-opposite-of-maybes 59. http://stackoverflow.com/questions/24724738/let-renaming-function-breaks-code 60. http://stackoverflow.com/questions/24744294/pattern-matching-on-rank-2-type 61. http://stackoverflow.com/questions/24748750/haskell-algorithm-advice-and-suggestions-for-alternate-solutions 62. http://stackoverflow.com/questions/24775528/why-cant-haskell-be-tricked-into-performing-io-operations-by-using-strict-evalu 63. http://stackoverflow.com/questions/24856963/how-does-lifting-in-a-functional-programming-context-relate-to-category-theory 64. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From vigalchin at gmail.com Thu Jul 31 03:42:58 2014 From: vigalchin at gmail.com (Vasili I. Galchin) Date: Wed, 30 Jul 2014 22:42:58 -0500 Subject: [Haskell-cafe] Tor project Message-ID: Haskell contributions to http://www.torproject.org .. .any thoughts ?? From spam at scientician.net Thu Jul 31 04:53:43 2014 From: spam at scientician.net (Bardur Arantsson) Date: Thu, 31 Jul 2014 06:53:43 +0200 Subject: [Haskell-cafe] Tor project In-Reply-To: References: Message-ID: On 2014-07-31 05:42, Vasili I. Galchin wrote: > Haskell contributions to http://www.torproject.org .. .any thoughts ?? > Uh... what? In case it isn't clear: Posting incoherent one-liners which seem to be missing several words (such as your post above) and posts which don't seem to carry any content* (your other post today) isn't particularly useful or welcome around here. Despite what some might claim about the Haskell community, we aren't mind readers. You need to add a few more words to explain what you're trying to say and/or ask, so that people other than you can understand. *) Apart from vague mentions of "mutability" and two links which on the face of it don't have much (if anything) to do with each other. Regards, From k-bx at k-bx.com Thu Jul 31 10:55:32 2014 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Thu, 31 Jul 2014 13:55:32 +0300 Subject: [Haskell-cafe] Newtype derivation understanding problem Message-ID: Excuse me if the question is silly. Thought this MonadCatchIO will be removed in next version of snap, current version has it and I can't understand this derivation: [0] L.Lensed seems like just a newtype wrapper around a function [1], and there is no instance of MonadCatchIO for a function. How is it derived? [0]: https://github.com/snapframework/snap/blob/0.13.2.8/src/Snap/Snaplet/Internal/Types.hs#L260 [1]: https://github.com/snapframework/snap/blob/0.13.2.8/src/Snap/Snaplet/Internal/Lensed.hs#L20 -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Thu Jul 31 10:57:31 2014 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 31 Jul 2014 13:57:31 +0300 Subject: [Haskell-cafe] Bad interaction of inlinePerformIO and mutable vectors Message-ID: I'm trying to understand why some code isn't behaving as I'd expect, and to determine whether it's a bug or not (and where that bug might be). Here's the simplest version of the code: import Data.ByteString.Internal (inlinePerformIO) import qualified Data.Vector as V import qualified Data.Vector.Mutable as VM main :: IO () main = do vm <- VM.new 1 VM.write vm 0 'A' let x = inlinePerformIO $ VM.write vm 0 'B' x `seq` (V.freeze vm >>= print) A more complete example is available on lpaste[1]. The problem is that I would expect the output to be "B", but in fact "A" is still printed. From the longer paste that I linked to, you can see that: * When using unsafePerformIO and unsafeDupablePerformIO, the semantics work as I would have expected: "B" is printed after forcing evaluation of the result. * If I add a `VM.read vm 0` call after the write, it also works. * Using IORef, the behavior is also as I would have expected: as soon as the result is evaluated, the reference is updated. I'm testing on GHC 7.8.3, Ubuntu 64-bit, and compiling with -O2. I'm curious if anyone has an idea as to why there is this difference in behavior. Michael [1] http://lpaste.net/108483 -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbrock at goula.sh Thu Jul 31 11:00:26 2014 From: mbrock at goula.sh (Mikael Brockman) Date: Thu, 31 Jul 2014 13:00:26 +0200 Subject: [Haskell-cafe] Newtype derivation understanding problem References: Message-ID: Konstantine Rybnikov writes: > Excuse me if the question is silly. > > Thought this MonadCatchIO will be removed in next version of snap, > current version has it and I can't understand this derivation: [0] > > L.Lensed seems like just a newtype wrapper around a function [1], and > there is no instance of MonadCatchIO for a function. > > How is it derived? You probably just missed it, but there's a MonadCatchIO instance for L.Lensed, and so the derived instance for Handler is trivial. From k-bx at k-bx.com Thu Jul 31 11:04:30 2014 From: k-bx at k-bx.com (Konstantine Rybnikov) Date: Thu, 31 Jul 2014 14:04:30 +0300 Subject: [Haskell-cafe] Newtype derivation understanding problem In-Reply-To: References: Message-ID: Yes, sorry! I also for some reason added "deriving MonadCatchIO" which is not there :) I needed to see it's not derived, that's why I should do a search for it. Thank you. On Thu, Jul 31, 2014 at 2:00 PM, Mikael Brockman wrote: > Konstantine Rybnikov writes: > > > Excuse me if the question is silly. > > > > Thought this MonadCatchIO will be removed in next version of snap, > > current version has it and I can't understand this derivation: [0] > > > > L.Lensed seems like just a newtype wrapper around a function [1], and > > there is no instance of MonadCatchIO for a function. > > > > How is it derived? > > You probably just missed it, but there's a MonadCatchIO instance for > L.Lensed, and so the derived instance for Handler is trivial. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From felipe.lessa at gmail.com Thu Jul 31 11:35:56 2014 From: felipe.lessa at gmail.com (Felipe Lessa) Date: Thu, 31 Jul 2014 08:35:56 -0300 Subject: [Haskell-cafe] Bad interaction of inlinePerformIO and mutable vectors In-Reply-To: References: Message-ID: <53DA2A1C.3080103@gmail.com> Hey, Michael! I'm not going to give you the answer to your question, just a new bit of information. If you check the core generated from -O2 you'll see that this is what the IORef version of "inlinePerformIO" looks like: -- prints "inlinePerformIO" case Handle.Text.hPutStr2 Handle.FD.stdout lvl2_r5GX True ipv28_X3s6 of _ [Occ=Dead] { (# ipv30_X3vu, ipv31_X3sc #) -> -- reads current value case readMutVar# @ RealWorld @ Char ipv3_a3pa ipv30_X3vu of _ [Occ=Dead] { (# ipv32_X3uU, ipv33_X3uX #) -> -- prints current value case Handle.Text.hPutStr2 Handle.FD.stdout ($fShowChar_$cshow ipv33_X3uX) True ipv32_X3uU of _ [Occ=Dead] { (# ipv34_X3si, ipv35_X3sk #) -> -- sets new value case writeMutVar# @ RealWorld @ Char ipv3_a3pa lvl10_r5H5 realWorld# of _ [Occ=Dead] { __DEFAULT -> -- reads current value case readMutVar# @ RealWorld @ Char ipv3_a3pa ipv34_X3si of _ [Occ=Dead] { (# ipv36_X3v6, ipv37_X3v9 #) -> -- prints current value case Handle.Text.hPutStr2 Handle.FD.stdout ($fShowChar_$cshow ipv37_X3v9) True ipv36_X3v6 -- ... While this is what the Vector version of "inlinePerformIO" looks like: -- prints "inlinePerformIO" case Handle.Text.hPutStr2 Handle.FD.stdout lvl2_r5GX True ipv72_X3zS of _ [Occ=Dead] { (# ipv74_X3uq, ipv75_X3us #) -> -- prints current value case a_s32R ipv74_X3uq of _ [Occ=Dead] { (# ipv76_X3uu, ipv77_X3uw #) -> -- prints current value case a_s32R ipv76_X3uu of _ [Occ=Dead] { (# ipv78_X3v5, ipv79_X3v7 #) -> -- ... Ouch! Everything was optimized away :(. For reference, this is what the "inlinePerformIO + read" version looks like: -- prints "inlinePerformIO + read" case Handle.Text.hPutStr2 Handle.FD.stdout lvl1_r5GW True ipv78_X3v5 of _ [Occ=Dead] { (# ipv80_X3Bs, ipv81_X3vb #) -> -- prints current value case a_s32R ipv80_X3Bs of _ [Occ=Dead] { (# ipv82_X3vd, ipv83_X3vf #) -> -- sets new value then read it case readArray# @ (Control.Monad.Primitive.PrimState IO) @ Char ipv55_a2Ze 0 (writeArray# @ (Control.Monad.Primitive.PrimState IO) @ Char ipv55_a2Ze 0 lvl_r5GV (realWorld# `cast` ((State# (Sym Control.Monad.Primitive.TFCo:R:PrimStateIO[0]))_R :: State# RealWorld ~# State# (Control.Monad.Primitive.PrimState IO)))) of _ [Occ=Dead] { (# ipv84_s5yV, ipv85_s5yW #) -> -- prints current value a_s32R ipv82_X3vd Hmmmm... -- Felipe. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From mike at proclivis.com Thu Jul 31 13:05:00 2014 From: mike at proclivis.com (Michael Jones) Date: Thu, 31 Jul 2014 07:05:00 -0600 Subject: [Haskell-cafe] Tor project In-Reply-To: References: Message-ID: <0A84F9F7-1349-489E-8B36-717FC0226D9F@proclivis.com> I?ll make a question out of it: Is anyone working on a Haskell project compatible with Tor? Library, Server, Browser, etc. Is anyone interested in such a project? Would the Haskell Runtime and TLS modules have any time dependent behavior that would make encryption harder/easier to break than C implementations? Basically, is the TLS attach surface smaller or larger than openssl and is there any data to support claims of such? Mike On Jul 30, 2014, at 10:53 PM, Bardur Arantsson wrote: > On 2014-07-31 05:42, Vasili I. Galchin wrote: >> Haskell contributions to http://www.torproject.org .. .any thoughts ?? >> > > Uh... what? > > In case it isn't clear: Posting incoherent one-liners which seem to be > missing several words (such as your post above) and posts which don't > seem to carry any content* (your other post today) isn't particularly > useful or welcome around here. > > Despite what some might claim about the Haskell community, we aren't > mind readers. You need to add a few more words to explain what you're > trying to say and/or ask, so that people other than you can understand. > > *) Apart from vague mentions of "mutability" and two links which on the > face of it don't have much (if anything) to do with each other. > > Regards, > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From chriswarbo at googlemail.com Thu Jul 31 13:17:54 2014 From: chriswarbo at googlemail.com (Chris Warburton) Date: Thu, 31 Jul 2014 14:17:54 +0100 Subject: [Haskell-cafe] Intuition to understand ... In-Reply-To: <53D932AD.9020801@web.de> (martin's message of "Wed, 30 Jul 2014 20:00:13 +0200") References: <53D4D7F5.5090904@web.de> <53D55181.6020904@gmail.com> <53D6A2F7.7040004@web.de> <86bns8bkfb.fsf@gmail.com> <53D932AD.9020801@web.de> Message-ID: <86vbqdacql.fsf@gmail.com> martin writes: > > x >>= f = join (fmap f x) > > So you're really throwing symbols around? > > When I do math, I do similar things. Particularly in algebra I don't ask myself what e.g. a cubic root does, because I > know the laws of roots and I know what I can do with the symbols. Not quite. Cube roots are a special case of roots. Here, I'm building bind out of two conceptually-simpler parts. Of course, it's subjective which is "simpler", but in any case we'll need to define fmap sooner or later, since all Monads must be Functors; we might as well use it! > In math, the only ways I know of to get a better intuition is practice > and a good teacher. Maybe it is the same in haskell? Practice definitely helps. I've managed so far without a teacher (does stackoverlow.com count as a teacher? ;) ) Cheers, Chris From mike at proclivis.com Thu Jul 31 13:28:30 2014 From: mike at proclivis.com (Michael Jones) Date: Thu, 31 Jul 2014 07:28:30 -0600 Subject: [Haskell-cafe] Tor project In-Reply-To: <0A84F9F7-1349-489E-8B36-717FC0226D9F@proclivis.com> References: <0A84F9F7-1349-489E-8B36-717FC0226D9F@proclivis.com> Message-ID: <9777A9F0-C3BF-43F7-AAD3-AEE37605A694@proclivis.com> Gee, complete sentences with bad spelling! I mean attack surface. Basically, its a question whether the total outcome would be better than what we have today. On Jul 31, 2014, at 7:05 AM, Michael Jones wrote: > I?ll make a question out of it: > > Is anyone working on a Haskell project compatible with Tor? Library, Server, Browser, etc. > Is anyone interested in such a project? > Would the Haskell Runtime and TLS modules have any time dependent behavior that would make encryption harder/easier to break than C implementations? Basically, is the TLS attach surface smaller or larger than openssl and is there any data to support claims of such? > > Mike > > On Jul 30, 2014, at 10:53 PM, Bardur Arantsson wrote: > >> On 2014-07-31 05:42, Vasili I. Galchin wrote: >>> Haskell contributions to http://www.torproject.org .. .any thoughts ?? >>> >> >> Uh... what? >> >> In case it isn't clear: Posting incoherent one-liners which seem to be >> missing several words (such as your post above) and posts which don't >> seem to carry any content* (your other post today) isn't particularly >> useful or welcome around here. >> >> Despite what some might claim about the Haskell community, we aren't >> mind readers. You need to add a few more words to explain what you're >> trying to say and/or ask, so that people other than you can understand. >> >> *) Apart from vague mentions of "mutability" and two links which on the >> face of it don't have much (if anything) to do with each other. >> >> Regards, >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From felipe.lessa at gmail.com Thu Jul 31 14:27:36 2014 From: felipe.lessa at gmail.com (Felipe Lessa) Date: Thu, 31 Jul 2014 11:27:36 -0300 Subject: [Haskell-cafe] Bad interaction of inlinePerformIO and mutable vectors In-Reply-To: <53DA2A1C.3080103@gmail.com> References: <53DA2A1C.3080103@gmail.com> Message-ID: <53DA5258.60509@gmail.com> Checking a bit deeper using: $ ghc-core --no-cast --no-asm snoyberg.hs -O1 -ddump-simpl \ -dverbose-core2core -dcore-lint This is the last time we see the "inlinePerformIO" function call (before it being optimized away): lvl_s2R1 = \ (vm_a2gL [OS=ProbOneShot] :: Data.Vector.Mutable.MVector RealWorld Char) -> thenIO @ () @ () lvl_s2QY (let { a_s2QN :: State# RealWorld -> (# State# RealWorld, () #) a_s2QN = \ (eta_Xm [OS=OneShot] :: State# RealWorld) -> ((bindIO @ (Data.Vector.Vector Char) @ () (Data.Vector.unsafeFreeze @ IO @ Char Control.Monad.Primitive.$fPrimMonadIO (vm_a2gL `cast` ...)) lvl_s2QV) `cast` ...) eta_Xm } in thenIO @ () @ () (a_s2QN `cast` ...) (case $ @ (IO ()) @ () (Data.ByteString.Internal.inlinePerformIO @ ()) (Data.Vector.Mutable.write @ IO @ Char Control.Monad.Primitive.$fPrimMonadIO (vm_a2gL `cast` ...) lvl_s2QZ lvl_s2R0) of _ [Occ=Dead] { () -> a_s2QN `cast` ... })) lvl_s2QV is the action that prints the array contents. The above snippet prints the contents, writes the new value then prints the contents again. But then comes a simplifier phase which lead us to: ... of _ [Occ=Dead] { (# ipv_X3cp [OS=OneShot], ipv1_X3cr #) -> let { a_s2QN :: State# RealWorld -> (# State# RealWorld, () #) [LclId, Arity=1, Unf=Unf{Src=, TopLvl=False, Arity=1, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 91 0}] a_s2QN = \ (eta_Xm [OS=OneShot] :: State# RealWorld) -> case unsafeFreezeArray# @ (Control.Monad.Primitive.PrimState IO) @ Char ipv1_a2NI (eta_Xm `cast` ...) of _ [Occ=Dead] { (# ipv_a2Oy [OS=OneShot], ipv1_a2Oz #) -> Handle.Text.hPutStr2 Handle.FD.stdout (Data.Vector.$fShowVector_$cshow @ Char $fShowChar (Data.Vector.Vector @ Char 0 1 ipv1_a2Oz)) True (ipv_a2Oy `cast` ...) } } in case a_s2QN ipv_X3cp of _ [Occ=Dead] { (# ipv_X3cv [OS=OneShot], ipv1_X3dt #) -> a_s2QN ipv_X3cv ... Note that a_s2QN has changed due to inlining but still performs the same action. However! ipv_X3cp is *not* the same as the big case with our inlinePerformIO, it's merely the resulting RealWorld from printing "inlinePerformIO"! This is the spot. Now I'm stuck, though. I have no idea why the simplifier did this. Cheers! -- Felipe. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From michael at snoyman.com Thu Jul 31 14:51:36 2014 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 31 Jul 2014 17:51:36 +0300 Subject: [Haskell-cafe] Bad interaction of inlinePerformIO and mutable vectors In-Reply-To: <53DA5258.60509@gmail.com> References: <53DA2A1C.3080103@gmail.com> <53DA5258.60509@gmail.com> Message-ID: Thanks for digging into this Felipe! That's certainly an interesting result, though I similarly have no idea why that's what the simplifier is doing. On Thu, Jul 31, 2014 at 5:27 PM, Felipe Lessa wrote: > Checking a bit deeper using: > > $ ghc-core --no-cast --no-asm snoyberg.hs -O1 -ddump-simpl \ > -dverbose-core2core -dcore-lint > > This is the last time we see the "inlinePerformIO" function call (before > it being optimized away): > > lvl_s2R1 = > \ (vm_a2gL [OS=ProbOneShot] > :: Data.Vector.Mutable.MVector > RealWorld Char) -> > thenIO > @ () > @ () > lvl_s2QY > (let { > a_s2QN > :: State# RealWorld > -> (# State# RealWorld, () #) > > a_s2QN = > \ (eta_Xm [OS=OneShot] :: State# RealWorld) -> > ((bindIO > @ (Data.Vector.Vector Char) > @ () > (Data.Vector.unsafeFreeze > @ IO > @ Char > Control.Monad.Primitive.$fPrimMonadIO > (vm_a2gL `cast` ...)) > lvl_s2QV) > `cast` ...) > eta_Xm } in > thenIO > @ () > @ () > (a_s2QN `cast` ...) > (case $ > @ (IO ()) > @ () > (Data.ByteString.Internal.inlinePerformIO @ ()) > (Data.Vector.Mutable.write > @ IO > @ Char > Control.Monad.Primitive.$fPrimMonadIO > (vm_a2gL `cast` ...) > lvl_s2QZ > lvl_s2R0) > of _ [Occ=Dead] { () -> > a_s2QN `cast` ... > })) > > lvl_s2QV is the action that prints the array contents. The above > snippet prints the contents, writes the new value then prints the > contents again. > > But then comes a simplifier phase which lead us to: > > ... > of _ [Occ=Dead] { (# ipv_X3cp [OS=OneShot], ipv1_X3cr #) -> > let { > a_s2QN > :: State# RealWorld > -> (# State# RealWorld, () #) > [LclId, > Arity=1, > > Unf=Unf{Src=, TopLvl=False, Arity=1, Value=True, > ConLike=True, WorkFree=True, Expandable=True, > Guidance=IF_ARGS [0] 91 0}] > a_s2QN = > \ (eta_Xm [OS=OneShot] :: State# RealWorld) -> > case unsafeFreezeArray# > @ (Control.Monad.Primitive.PrimState IO) > @ Char > ipv1_a2NI > (eta_Xm `cast` ...) > of _ [Occ=Dead] { (# ipv_a2Oy [OS=OneShot], ipv1_a2Oz #) -> > Handle.Text.hPutStr2 > Handle.FD.stdout > (Data.Vector.$fShowVector_$cshow > @ Char > $fShowChar > (Data.Vector.Vector @ Char 0 1 ipv1_a2Oz)) > True > (ipv_a2Oy `cast` ...) > } } in > case a_s2QN ipv_X3cp > of _ [Occ=Dead] { (# ipv_X3cv [OS=OneShot], ipv1_X3dt #) -> > a_s2QN ipv_X3cv > ... > > Note that a_s2QN has changed due to inlining but still performs the same > action. However! ipv_X3cp is *not* the same as the big case with our > inlinePerformIO, it's merely the resulting RealWorld from printing > "inlinePerformIO"! This is the spot. > > Now I'm stuck, though. I have no idea why the simplifier did this. > > Cheers! > > -- > Felipe. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From awick at galois.com Thu Jul 31 16:59:41 2014 From: awick at galois.com (Adam Wick) Date: Thu, 31 Jul 2014 09:59:41 -0700 Subject: [Haskell-cafe] Tor project In-Reply-To: References: <0A84F9F7-1349-489E-8B36-717FC0226D9F@proclivis.com> Message-ID: Hi - Yes, we (Galois) are. The end goal is to have a Tor implementation running on a HaLVM. Right now the project is internal, but the plan is to push a basic relay node implementation out to our GitHub site sometime in the next few weeks. As for TLS, it is possible that timing attacks based on a functional language implementation could be more likely than those for a traditional C implementation. On the other hand, functional language implementations protect you from a wide variety of attacks that occur in C implementations. I don?t believe the balance has been studied, but it?d be interesting. I do know the OCaml/Mirage folks have been having good luck with their TLS implementation. I believe they?ve at least started doing some red team analysis of it, as well, with good results. See their various blog posts, starting with http://openmirage.org/blog/introducing-ocaml-tls. I?m not sure if Vincent?s library has been subject to similar evaluation, and I know the partial library in our Tor implementation has not been. - Adam Quoth: > I?ll make a question out of it: > > Is anyone working on a Haskell project compatible with Tor? Library, Server, Browser, etc. > Is anyone interested in such a project? > Would the Haskell Runtime and TLS modules have any time dependent behavior that would make encryption harder/easier to break than C implementations? Basically, is the TLS attach surface smaller or larger than openssl and is there any data to support claims of such? From daniel.trstenjak at gmail.com Thu Jul 31 19:59:49 2014 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Thu, 31 Jul 2014 21:59:49 +0200 Subject: [Haskell-cafe] [ANN] hsimport 0.5: configurable pretty printing and placing of imports Message-ID: <20140731195949.GA24969@machine> Hi all, hsimport[1] is a command line program for extending the import list of a Haskell source file. There's an integration[2] for the vim editor, which can automatically extend the import list for the symbol under the cursor. hsimport 0.5 changes: - configurable[3] pretty printing of imports - configurable placing of new imports - support of multi line imports - better handling of incomplete/invalid Haskell source files Grettings, Daniel [1] https://github.com/dan-t/hsimport [2] https://github.com/dan-t/vim-hsimport [3] https://github.com/dan-t/hsimport/blob/master/README.md From spam at scientician.net Thu Jul 31 20:46:04 2014 From: spam at scientician.net (Bardur Arantsson) Date: Thu, 31 Jul 2014 22:46:04 +0200 Subject: [Haskell-cafe] Tor project In-Reply-To: References: <0A84F9F7-1349-489E-8B36-717FC0226D9F@proclivis.com> Message-ID: On 2014-07-31 18:59, Adam Wick wrote: > Hi - > > Yes, we (Galois) are. The end goal is to have a Tor implementation running on a HaLVM. Right now the project is internal, but the plan is to push a basic relay node implementation out to our GitHub site sometime in the next few weeks. > > As for TLS, it is possible that timing attacks based on a functional language implementation could be more likely than those for a traditional C implementation. On the other hand, functional language implementations protect you from a wide variety of attacks that occur in C implementations. I don?t believe the balance has been studied, but it?d be interesting. > > I do know the OCaml/Mirage folks have been having good luck with their TLS implementation. I believe they?ve at least started doing some red team analysis of it, as well, with good results. See their various blog posts, starting with http://openmirage.org/blog/introducing-ocaml-tls. I?m not sure if Vincent?s library has been subject to similar evaluation, and I know the partial library in our Tor implementation has not been. > > > - Adam > > Wow, that actually turned out to be interesting! Thanks Michael and Adam! :) PS: I wonder what the response to timing attacks will be... Regards, From mark.lentczner at gmail.com Thu Jul 31 20:48:05 2014 From: mark.lentczner at gmail.com (Mark Lentczner) Date: Thu, 31 Jul 2014 16:48:05 -0400 Subject: [Haskell-cafe] Haskell Platform 2014.2.0.0 Release Candidate 3 Message-ID: Small update to the Haskell Platfrom 2014.2.0.0 release: We have new Release Candidate 3 versions of the source tarball... and a new generic-linux bindist of the platform! - source tarball: haskell-platform-2014.2.0.0-srcdist-RC3.tar.gz - generic linux: haskell-platform-2014.2.0.0-unknown-linux-x86_64-RC3.tar.gz *Windows and OS X users: There are no RC3 versions - as the RC2 versions seem to be holding up fine!* *General* - hptool (and hence ./platform.sh script) take a new --prefix parameter that is used for generic (non-OS X, non-Windows) builds: It sets the root under which haskell installations are located. Defaults to /usr/local/haskell. Everything will be placed in a directory named ghc-7.8.3- under this prefix. - activate-hs script for default Posix-like builds - small fixes to allow bootstrapping the platform with GHC 7.4 - README and LICENSE updated *Source Tarball* - all missing pieces now present - build platfrom from source tarball verified *Generic Linux Binary Dist* - Built from the GHC's generic Linux bindist for Deb 7 style systems - Complete tarball: this is all you need to install Haskell on a compatible system - Built on Ubuntu 12.04LTS - Tested on Ubuntu 14 - my system needed a symlink from libgmp.so to libgmp.so.10 - this seems to be an issue with the GHC bindist built components To install this: cd / sudo tar xvf ~/haskell-platform-2014.2.0.0-unknown-linux-x86_64-RC3.tar.gz sudo /usr/local/haskell/ghc-7.8.3-x8_64/bin/activate-hs This will finish the package registration, and install symlinks from /usr/local/bin for all the standard haskell command line tools. ? Mark *shasum -a 256:* ab759ec50618f2604163eca7ad07e50c8292398a2d043fdc1012df161b2eb89a haskell-platform-2014.2.0.0-srcdist-RC3.tar.gz 0da6879ae657481849e7ec4e5d3c4c035e090824167f97434b48af297ec17cf9 haskell-platform-2014.2.0.0-unknown-linux-x86_64-RC3.tar.gz -------------- next part -------------- An HTML attachment was scrubbed... URL: From wojtek at power.com.pl Thu Jul 31 21:11:05 2014 From: wojtek at power.com.pl (=?UTF-8?B?V29qdGVrIE5hcmN6ecWEc2tp?=) Date: Thu, 31 Jul 2014 23:11:05 +0200 Subject: [Haskell-cafe] Tor project In-Reply-To: References: <0A84F9F7-1349-489E-8B36-717FC0226D9F@proclivis.com> Message-ID: <53DAB0E9.70207@power.com.pl> On 31.07.2014 18:59, Adam Wick wrote: > As for TLS, it is possible that timing attacks based on a functional language implementation could be more likely than those for a traditional C implementation. (...) I don?t believe the balance has been studied, but it?d be interesting. > I believe no evidence is available, not even anecdotal. And it would be rather expensive a subject to study. But, AFAIK, the (necessary and sufficient) protection against timing attacks is the addition of randomized waits. In the protocol layer, not in pure encryption/decryption/hashing routines. I strive not to use words I don't understand, but I have the M. word in mind for structuring such a computation. In other words, I think it is a myth. -- Kind regards, Wojtek N. From mike at proclivis.com Thu Jul 31 23:42:19 2014 From: mike at proclivis.com (Michael Jones) Date: Thu, 31 Jul 2014 17:42:19 -0600 Subject: [Haskell-cafe] Tor project In-Reply-To: <53DAB0E9.70207@power.com.pl> References: <0A84F9F7-1349-489E-8B36-717FC0226D9F@proclivis.com> <53DAB0E9.70207@power.com.pl> Message-ID: <784C06CC-006E-4BBD-B1BD-20D7D6256093@proclivis.com> I am not an expert, but I think timing attacks try to push data though a system and look for time dependent calculations. If every packet that leaves a system has the same data size and the same encryption time, the attacker would not be able to detect any difference in time wrt difference in data. Time could also vary if you mucked with the voltage of the CPU, or if some calculation could. I would guess that if it is not possible to make all packages the same size and time, randomizing time would hide time differences. However, it may be possible to extract randomness. This is just a conjecture on my part. A work around might be to use hardware encryption. I work on an A9, and with openssl, there is the option to have hardware do the actual encryption, etc. I have not had the time to implement this, but I believe that Linux for IMX6 has support for hardware encryption. If nothing else, it is best to use the hardware for random number generation. My interested would be to run it on my Wandboard and Yocto linux. Hence my questions about cross-compilers. I am still stuck on that problem because I have not figure out how to make GHC pass architecture options to the gcc cross compiler but not to the local linux gcc. It seems some variables in the build are tied together. But eventually I?ll probably figure it out. I think the Hypervisor approach is also interesting. Just build a mini OS with TLS and Tor. That could reduce the attack surface by eliminating Linux. This would be interesting for a repeater. I was thinking doing the same onto of a smaller kernel such as eCos. I tried to get GHC running on that, but there is some missing POSIX support, so I went back to linux. Mike On Jul 31, 2014, at 3:11 PM, Wojtek Narczy?ski wrote: > On 31.07.2014 18:59, Adam Wick wrote: >> As for TLS, it is possible that timing attacks based on a functional language implementation could be more likely than those for a traditional C implementation. (...) I don?t believe the balance has been studied, but it?d be interesting. >> > I believe no evidence is available, not even anecdotal. And it would be rather expensive a subject to study. > > But, AFAIK, the (necessary and sufficient) protection against timing attacks is the addition of randomized waits. In the protocol layer, not in pure encryption/decryption/hashing routines. I strive not to use words I don't understand, but I have the M. word in mind for structuring such a computation. > > In other words, I think it is a myth. > > -- > Kind regards, > Wojtek N. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe