Re: [Haskell-cafe] hdbc-odbc not getting any data using mssql stored procedure
Hi Gauthier, that answer was perfect! I just tried it out and It completely solved my problem. Thanks so much! Grant. On Thu, Oct 10, 2013 at 8:58 AM, Gauthier Segay wrote: > Hello Grant, pulling this topic out of the archive as I face similar issue > and found a work around. > > I'm unsure what's happening in gp_somestoredproc but if using the sql > management studio, you see some output such as > > (X row(s) affected) > > then you might want to put "set nocount on" before issuing the statement > > I'm unsure what's the status of multiple resultset in hdbc / hdbc-odbc but > I did succeed pulling results out of first resultset of a stored procedure > call > > (sorry for html email, sending this from google groups) > > > On Friday, 1 February 2013 01:16:38 UTC+1, grant wrote: > >> Hi, >> >> I am trying to call a stored procedure (exec gp_somestoredproc 123,22) >> using microsoft sql server 2008 R2 using hdbc-odbc. >> >> Here is the haskell code: >> >> import Database.HDBC >> import Database.HDBC.ODBC >> import Control.Monad >> import Data.Maybe >> import qualified Data.ByteString.Char8 as B >> >> test1 = do >> c <- connectODBC "Driver={SQL Server};Server=?;Database=?;**uid=sa;pwd=?;" >> >> p <- prepare c "exec gp_somestoredproc 123,22" -- returns no data >> -- p <- prepare c "exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec >> gp_somestoredproc 123,22" -- all is good >> e <- execute p [] -- returns 6 (number of rows) >> putStrLn $ "execute " ++ show e >> r <- fetchAllRows' p >> putStrLn $ "fetchAllRows' " ++ show r >> >> >> The problem is that this code returns the number of rows correctly but >> doesn't return data nor are there any errors. >> >> However, I ran a perl program using perl dbi and got the data correctly. >> >> Here is the perl code: >> >> #!/usr/bin/perl >> use DBI; >> >> my $user = 'sa'; >> my $pw = ''; >> my $dsn = ''; >> my $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pw, >>{PrintError => 1, RaiseError => 1}); >> if (!$dbh) { >> print "error: connection: $DBI::err\n$DBI::errstr\n$DBI:**:state\n"; >> >> } >> my $type_info = $dbh->type_info(93); >> while(my($key, $value) = each(%$type_info)){ >> print "$key => $value\n"; >> }; >> my $sql = "exec gp_somestoredproc 123,22"; >> my $sth = $dbh->prepare($sql); >> my $r = $sth->execute; >> while (my ($db) = $sth->fetchrow_array) { >> print $db . "\n===\n"; >> >> } >> $dbh->disconnect if $dbh; >> >> I traced both versions and noticed that the perl dbi version first called >> >>exec [sys].sp_datatype_info_100 0,@ODBCVer=4 >> >> So I prefixed the stored proc call in haskell with "exec >> [sys].sp_datatype_info_100 0,@ODBCVer=4;" and it worked fine. >> >> In short: >> >> FAILS p <- prepare c "exec gp_somestoredproc 123,22" -- returns number >> of rows >> but no data >> >> WORKS p <- prepare c "exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec >> gp_somestoredproc 123,22" >> >> I have no idea why this works. >> >> sp_datatype_info_100 just dumps out the fields types ... >> >> More information: >> >> The stored procedure returns data with user defined field types. >> I have managed to do selects against tables with user defined field types >> without any problems using hdbc-odbc. >> I couldn't emulate this error on a local older version of mssql server >> (Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64) express) but the >> perl dbi >> prefixed the stored procedure call with "exec sp_datatype_info >> 0,@ODBCVer=3" >> I am running this against Microsoft SQL Server 2008 R2 (RTM) - >> 10.50.1797.0 >> (X64) >> >> I would appreciate any pointers you can give me. >> Thanks >> Grant >> >> >> >> __**_ >> Haskell-Cafe mailing list >> haskel...@haskell.org >> http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe> >> > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Cabal v1.18.0 released
Thank you all for the hard work. The new features are already of great help to me! Cheers, Darren On 2013-09-04 2:13 PM, "Johan Tibell" wrote: > Hi all, > > On behalf of the cabal maintainers and contributors I'm proud to > announce the Cabal (and cabal-install) 1.18.0 release. To install run > > cabal update && cabal install Cabal-1.18.0 cabal-install-1.18.0 > > With 854 commits since the last release there are two many > improvements and bug fixes to list them here, but two highlights are: > > * Hermetic builds using sandboxes. This should reduce the number of > "dependency hell" and broken package DB problems. > > * GHCi support. It's now much easier to use ghci when developing your > packages, especially if those packages require preprocessors (e.g. > hsc2hs). > > Here's how working on a package might look like using the new features: > > # Only once: > cabal sandbox init > cabal install --only-dependencies --enable-tests > # Configure, build, and run tests: > cabal test # now implies configure and build > # Play around with the code in GHCi: > cabal repl > > Mikhail wrote a bit more about the user visible changes on his blog: > > http://coldwa.st/e/blog/2013-08-21-Cabal-1-18.html > > For a complete list of changes run > > git log cabal-install-v1.16.0.2..cabal-install-v1.18.0 > > in the cabal repo or look at the GitHub compare page: > > > https://github.com/haskell/cabal/compare/cabal-install-v1.16.0.2...cabal-install-v1.18.0 > > (only shows the last 250 commits). > > 57 people contributed to this release! > >503 Mikhail Glushenkov > 99 Johan Tibell > 41 Duncan Coutts > 39 Ian Lynagh > 19 Brent Yorgey > 19 Thomas Tuegel > 18 Ben Millwood > 16 Eyal Lotem > 10 Thomas Dziedzic > 7 Andres Loeh > 6 John Wiegley > 6 Benno Fünfstück > 5 Gregory Collins > 4 Herbert Valerio Riedel > 4 Simon Hengel > 3 Joachim Breitner > 3 Luke Iannini > 3 Bryan Richter > 3 Richard Eisenberg > 3 Tuncer Ayaz > 3 Jens Petersen > 2 Arun Tejasvi Chaganty > 2 Bryan O'Sullivan > 2 Eric Kow > 2 Jookia > 2 Paolo G. Giarrusso > 2 Paolo Capriotti > 1 Sönke Hahn > 1 Yitzchak Gale > 1 Albert Krewinkel > 1 stepcut > 1 Alexander Kjeldaas > 1 Austin Seipp > 1 Bardur Arantsson > 1 Ben Doyle > 1 Ben Gamari > 1 Bram > 1 Carter Tazio Schonwald > 1 Clint Adams > 1 Daniel Wagner > 1 David Lazar > 1 Erik Hesselink > 1 Eugene Sukhodolin > 1 Gabor Greif > 1 Jack Henahan > 1 Jason Dagit > 1 Ken Bateman > 1 Mark Lentczner > 1 Masahiro Yamauchi > 1 Merijn Verstraaten > 1 Michael Thompson > 1 Niklas Hambüchen > 1 Oleksandr Manzyuk > 1 Patrick Premont > 1 Roman Cheplyaka > 1 Sergei Trofimovich > 1 Stephen Blackheath > > -- Johan, on behalf of the cabal maintainers and contributors. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subclass or no subclass?
Here's another thought (not my own): Abstractions can be classified based on where responsibility lies. Popular languages implementing interface composition expect the caller to know almost nothing about the concrete details while the callee has to handle all concrete permutations. Conversely, the sort of abstraction we see in typeclasses, much like those in c++ template programming, require the client to dictate concrete details that satisfy the callee requirements. Cheers, Darren On 2013-07-01 9:08 AM, "Patrick Browne" wrote: > On 30/06/13, *Dan Burton * wrote: > > I am not trying to say "every building is a shelter", rather "anything >> that is a building must provide sheltering services". > > > Well if it walks like a shelter and quacks like a shelter... /shrug > > One of the nice things about OO is the intuitive nature of the is-a > relation between class and instance (forgetting hierarchies for the > moment). I suggest that an intuitive interpretation of the Haskell > class–instance relation might be *acts-as*. For example, a car or a bus > could afford transport once they have a move operation. This is an > intuitive view for design; it does not reflect the language level function > of handling ad-hoc polymorphism. Also it reifies the type class, which > AFAIK does not exist at run time. > > > > Tá an teachtaireacht seo scanta ó thaobh ábhar agus víreas ag Seirbhís > Scanta Ríomhphost de chuid Seirbhísí Faisnéise, ITBÁC agus meastar í a > bheith slán. http://www.dit.ie > This message has been scanned for content and viruses by the DIT > Information Services E-Mail Scanning Service, and is believed to be clean. > http://www.dit.ie > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
Hi Richard, This page helped me when starting out: http://en.wikibooks.org/wiki/Haskell/Indentation On 2013-06-30 4:55 PM, "Richard Cobbe" wrote: > I hope I'm not starting a holy war with this, but I'm curious about an > aspect of coding style that's been bugging me for a while, and I'm not > finding much discussion of this question on the web or in the mailing list > archives. > > Two questions: > > 1) Are there wide-spread conventions in the Haskell community for how to > indent an application expression that's split across multiple lines? For > how to indent an expression that uses infix operators? Or does everyone > pretty much do their own thing? > > 2) If there is such a convention, how do I make Emacs's haskell-mode do it? > > By default, in most cases Emacs's haskell-mode with > turn-on-haskell-indentation does > > function firstArgument > (second argument) > thirdArgument > > Personally, I'd prefer some indentation on the 2nd and 3rd lines to > indicate that they're continuing an expression begun on a previous line. > > I can use parens around the entire application to force haskell-mode to > indent subsequent lines (and of course this is necessary in some contexts, > like a 'do' expression), but haskell-mode only indents that by a single > space: > > do (function firstArgument > (second argument) > thirdArgument) >nextAction > > I'd find a larger indent---even just 2 spaces---to be more readable. > > My inclination to indent the second and following lines of a multi-line > application expression is informed by my long experience in Scheme, Racket, > and Lisp, whose S-expressions lend themselves to fairly straightforward > (and automatable!) indentation conventions. If the Haskell community does > things differently, though, I'm happy to adapt. > > This is the sort of thing that one picks up from the community, as in other > languages. I don't, however, have a whole lot of contact with that > community outside this list -- thus the post, despite the dangers inherent > in discussing subjective stuff like this that people often feel strongly > about. > > Thanks, > > Richard > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Promoting Haskell via Youtube movies
Third. I really like the hands on approach. Cheers, Darren On 2013-06-17 12:09 PM, "Taylor Hedberg" wrote: > AlanKim Zimmerman, Mon 2013-06-17 @ 20:38:55+0200: > > This looks like quite a good series https://www.youtube.com/user/jekor > > Seconded. I have really enjoyed his videos so far and it seems like he's > regularly producing more. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: Backward compatibility
Just to be clear, is WASH beyond redemption, or would it be worth reviving again? If so, why? Cheers, Darren On 2013-05-05 1:48 PM, "Alberto G. Corona" wrote: > The case of WASH is a pity. Architecturally It was more advanced that many > recent haskell web frameworks. The package would have been a success with > little changes in the DSL syntax. > > I suspect that there are many outstanding packages with great ideas > abandoned, like WASH > > > > 2013/5/5 Brandon Allbery > >> On Sun, May 5, 2013 at 7:55 AM, Raphael Gaschignard >> wrote: >> >>> Forgive me if I'm wrong, but I feel like I've seen such "suggestions" in >>> GHC errors before. >>> >>> If so, does that mean there's some sort of mechanism in the compiler >>> already in place for such error recognition? Like some simple pattern >>> stuff? If not, I think that it might not be bad to consider this stuff >>> (misused packaged, changed semantics that create compiler errors), and to >>> put something into place for future modifications. This could make it a lot >>> easier to deal with unmaintained code. >>> >> >> There's some very limited capability now; the GHC folks are tossing >> around ideas for something more general like that. >> >> >> -- >> brandon s allbery kf8nh sine nomine >> associates >> allber...@gmail.com >> ballb...@sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad >> http://sinenomine.net >> >> ___ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > > -- > Alberto. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] xml conduit
Michael Snoyman snoyman.com> writes: > Hi Michael, Just one last thought. Does it make any sense that xml-conduit could be rewritten as a lens instead of a cursor? Or leverage the lens package somehow? Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] xml conduit
Michael Snoyman snoyman.com> writes: > > > Hi Grant, > As you might expect from immutable data structures, there's no way to > update in place. The approach you'd take to XSLT: traverse the tree, > check each node, and output a new structure. I put together the following > as an example, but I could ... Thanks a lot, I really appreciate it, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] xml conduit
Mateusz Kowalczyk fuuzetsu.co.uk> writes: > > I don't know about xml-conduit but I know that such thing is possible in > HXT. See the `Modifying a Node' section at [1] for a trivial example. > You probably will have to read the whole page to somewhat understand > what's going on though. > > [1] - http://adit.io/posts/2012-04-14-working_with_HTML_in_haskell.html > > Thanks for the tip, which looks really promising. The problem is that I cannot get large xml files to load with HXT. I tried a 24mb file and it ran out of memory, whereas with xml-conduit it took 15 seconds to load. Is there something I'm missing? Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] xml conduit
Hi, Is there a nice way to update xml. I want to be able to use xml-conduit to find a location in the xml and then add/update that node. eg xpath from //d/e/f and then change the content at 'f' or add a new node ... some data to change ... Thanks for any help, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] hdbc-odbc not getting any data using mssql stored procedure
Hi, I am trying to call a stored procedure (exec gp_somestoredproc 123,22) using microsoft sql server 2008 R2 using hdbc-odbc. Here is the haskell code: import Database.HDBC import Database.HDBC.ODBC import Control.Monad import Data.Maybe import qualified Data.ByteString.Char8 as B test1 = do c <- connectODBC "Driver={SQL Server};Server=?;Database=?;uid=sa;pwd=?;" p <- prepare c "exec gp_somestoredproc 123,22" -- returns no data -- p <- prepare c "exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec gp_somestoredproc 123,22" -- all is good e <- execute p [] -- returns 6 (number of rows) putStrLn $ "execute " ++ show e r <- fetchAllRows' p putStrLn $ "fetchAllRows' " ++ show r The problem is that this code returns the number of rows correctly but doesn't return data nor are there any errors. However, I ran a perl program using perl dbi and got the data correctly. Here is the perl code: #!/usr/bin/perl use DBI; my $user = 'sa'; my $pw = ''; my $dsn = ''; my $dbh = DBI->connect("dbi:ODBC:$dsn", $user, $pw, {PrintError => 1, RaiseError => 1}); if (!$dbh) { print "error: connection: $DBI::err\n$DBI::errstr\n$DBI::state\n"; } my $type_info = $dbh->type_info(93); while(my($key, $value) = each(%$type_info)){ print "$key => $value\n"; }; my $sql = "exec gp_somestoredproc 123,22"; my $sth = $dbh->prepare($sql); my $r = $sth->execute; while (my ($db) = $sth->fetchrow_array) { print $db . "\n===\n"; } $dbh->disconnect if $dbh; I traced both versions and noticed that the perl dbi version first called exec [sys].sp_datatype_info_100 0,@ODBCVer=4 So I prefixed the stored proc call in haskell with "exec [sys].sp_datatype_info_100 0,@ODBCVer=4;" and it worked fine. In short: FAILS p <- prepare c "exec gp_somestoredproc 123,22" -- returns number of rows but no data WORKS p <- prepare c "exec [sys].sp_datatype_info_100 0,@ODBCVer=4;exec gp_somestoredproc 123,22" I have no idea why this works. sp_datatype_info_100 just dumps out the fields types ... More information: The stored procedure returns data with user defined field types. I have managed to do selects against tables with user defined field types without any problems using hdbc-odbc. I couldn't emulate this error on a local older version of mssql server (Microsoft SQL Server 2008 (SP1) - 10.0.2531.0 (X64) express) but the perl dbi prefixed the stored procedure call with "exec sp_datatype_info 0,@ODBCVer=3" I am running this against Microsoft SQL Server 2008 R2 (RTM) - 10.50.1797.0 (X64) I would appreciate any pointers you can give me. Thanks Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type classes, collections, sum types, closures, and a massive headache
On Mon, Jan 28, 2013 at 5:43 PM, Bob Hutchison wrote: > > Now, this is how I got caught: it seems to be impossible to have > collections of things with a common type class if they have different > types. How is it that I've written that many lines of code in Haskell and > I'm just noticing this now? (If I wasn't so annoyed, I'd look for something > clever to reflect how loc count obviously doesn't mean much… but clever > seems to be beyond me today). > > Is this true? Are there any GHC extensions that will let me around this? > I just encountered this recently myself. There is a GADT extension [1][2] that may help. The greater abstraction appears to lie in existential types [3]. That being said, I'm a beginner as well and haven't yet used these extensions. So far I have found that my code is simplified by redefining heterogeneous types in terms of homogeneous functions. If I have a class that implements common methods, I will reorganize lists by common function types rather than by class. Cheers, Darren --- [1] http://www.haskell.org/haskellwiki/GADT [2] http://www.haskell.org/haskellwiki/GADTs_for_dummies [3] http://www.haskell.org/haskellwiki/Existential_type ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Announce: Leksah 0.13.1.1 (a bit experimental)
Thank you kindly for this release! System-wide package metadata is working with my platform install now. :) Cheers, d On Sun, Jan 6, 2013 at 9:34 PM, Hamish Mackenzie < hamish.k.macken...@gmail.com> wrote: > I fixed some annoying issues with 0.13.1.0 and > added "Panes->HLint". > > OS X (using Gtk3) > - > Choose the version that matches your installed GHC > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.0.3.dmg > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.0.4.dmg > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.4.1.dmg > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.4.2.dmg > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.6.1.dmg > (probable needs OS X 10.7) > > Windows (still Gtk2) > > Choose the version that matches your installed GHC > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.0.3.exe > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.0.4.exe > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.4.1.exe > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.4.2.exe > http://leksah.org/packages/leksah-0.13.1.1-ghc-7.6.1.exe > > On 6 Jan 2013, at 15:16, Hamish Mackenzie > wrote: > > > This has mostly bug fixes, GHC 7.4.2, GHC 7.6.1 and Gtk3 > > support. > > > > I have not uploaded it to Hackage as it uses Gtk2Hs patches > > that are not in Hackage. > > > > New features include "View->Dark" (OS X only) and > > "View->Fullscreen". > > > > Linux > > - > > Follow the steps in the .travis.yml file... > > https://github.com/leksah/leksah/blob/master/.travis.yml > > Should go something like this... > > https://travis-ci.org/leksah/leksah > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal failures...
Why not? Either way, I am chiming in as a programmer of many years. Unless using osx I stick with windows to avoid half-day forays into nettling technical issues that are not related to the work I am paid to perform. I would love for Haskell to work better there. On Nov 20, 2012 5:21 PM, "Johan Tibell" wrote: > On Tue, Nov 20, 2012 at 5:14 PM, Albert Y. C. Lai wrote: > >> On 12-11-20 05:37 PM, Gregory Guthrie wrote: >> >>> No; the first sentence says that someone else had reported that testing >>> on Windows was hard to do because of (a perceived) lack of access to >>> Windows by Haskell developers... The implication is that Haskell developers >>> (only/mainly) use *nix. >>> I commented that if true this lack of Windows testing could limit the >>> availability of Haskell to the largest market share of users. >>> >> >> Clearly, since >90% of computers have Windows, it should be trivial to >> find one to test on, if a programmer wants to. Surely every programmer is >> surrounded by Windows-using family and friends? (Perhaps to the >> programmer's dismay, too, because the perpetual "I've got a virus again, >> can you help?" is so annoying?) We are not talking about BeOS. >> >> Therefore, if programmers do not test on Windows, it is because they do >> not want to. >> > > This logic is flawed. More than 90% of computers having Windows doesn't > imply that 90% of all computers in a given household runs Windows. What's > the probability that your household has a Windows computer if you're a > programmer that don't live with your parents? What if that programmer is an > open source contributor. Surely not 90%. > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code length in Haskell, a comparison
I find myself wondering where Rebol would stand in this. On Nov 19, 2012 8:35 PM, "KC" wrote: > I am leery of code comparisons (but not Timothy Leary of them). > > Clojure being a JVM language has the advantage of the massive Java > class libraries. > > If Haskell could tie in fairly seamlessly to the Java class libraries ... > > If more developers learned the need for finer grained abstraction ... > > > > On Mon, Nov 19, 2012 at 7:55 PM, Gregory Guthrie wrote: > > There is some interesting data in the article at: > > > >Code Length Measured in 14 Languages > > > http://blog.wolfram.com/2012/11/14/code-length-measured-in-14-languages/ > > > > basically comparing program lengths in various languages, and some > ensuing discussion of how this relates to language expressiveness, etc. > > (He does all of his analysis in Mathematica, which is the goal of the > article.) > > > > It is interesting to see how well Haskell showed in the data; and it > would also be interesting to see how well it could replicate the analysis > example which was a nice example of web data scraping! > > > > The data is the length of a series of programs written in a number of > languages (data from: http://rosettacode.org/wiki/Rosetta_Code). > > (The columns don't map well to text only, Haskell column marked with > (Why doesn't this list support HTML?)). > > See nicer version at: http://pastehtml.com/view/ciy7woohv.rtxt > > > > The average for Haskell of 1.89 means that on the average the same > program in Haskell takes ~2x in the other languages. > > Given the correlation of size to clarity, complexity, effort, and > errors, this is a good thing! :-) > > > > Massive Snip! > > > > > Overall Ranking: > >Clojure 0.41 > >Haskell 0.83 > >R0.85 > >MATLAB 1.14 > >JavaScript 1.27 > >Ruby 1.36 > >Common Lisp 1.56 > >Python 1.61 > >C++ 1.68 > >C# 1.85 > >Pascal 1.86 > >Fortran 2.33 > >C++ 2.58 > >C4.09 > > --- > > > > ___ > > Haskell-Cafe mailing list > > Haskell-Cafe@haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > -- > -- > Regards, > KC > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: Sylvia, a lambda calculus visualizer
On Wed, Sep 26, 2012 at 11:51 PM, Chris Wong wrote: > Hello all > > Some of you in the audience may have read Dave Keenan's paper, [To > Dissect a Mockingbird][]. A subset of that may have wondered if it was > possible to generate those pretty pictures programmatically. For that > subset, I can answer to you -- yes, yes you can. > > [To Dissect a Mockingbird]: http://dkeenan.com/Lambda/ > > Sylvia is a lambda calculus visualizer. It takes in an expression in > the untyped lambda calculus and spits out a pretty picture. > > This is still in very early alpha, but it renders a fair number of > combinators correctly. I plan to add animated reduction (once I figure > out how to do it), and eventually develop this into a sandbox game of > some sort. I'm hoping to get some comments and ideas on how I can take > it from here. > > > Obligatory links > > > Hackage: http://hackage.haskell.org/package/sylvia > > Source: https://github.com/lfairy/sylvia > > Documentation: https://github.com/lfairy/sylvia/wiki > > > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe This is actually a lot of fun, thanks for sharing! I am looking forward to the animated reductions. :) Cheers, Darren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] process-conduit appears to hang on windows
Michael Snoyman snoyman.com> writes: > > I'm not sure what the original problems were that caused it to hang on > Windows, so I can't really speak to that part of the code. The > conduit-specific stuff looks good though. > > Michael > Thanks for taking a look. I guess windows handling of processes is a lot different than linux. Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] process-conduit appears to hang on windows
> > Hi, I am trying to use process-conduit on windows, but it appears to hang > when using the conduitCmd. > Is there a reason why this doesn't work? > > Thanks for any help, > Grant I have made an attempt to create a version of process conduits that appears to work on Windows and Linux. Unfortunately it looks a bit ugly. Does anyone have any input on if this is the right approach and if so, how it can be improved? Thanks for any help. Grant https://gist.github.com/2395361 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] process-conduit appears to hang on windows
Hi, I am trying to use process-conduit on windows, but it appears to hang when using the conduitCmd. Is there a reason why this doesn't work? Thanks for any help, Grant {-# LANGUAGE QuasiQuotes #-} import System.Process.QQ import Data.Conduit import qualified Data.Conduit.Binary as CB import qualified Data.Conduit.List as CL import Data.Conduit.Process import qualified Data.ByteString as B import System.IO main :: IO () main = runResourceT $ [scmd|dir *.txt|] $$ [ccmd|find /i "help"|] =$ CB.sinkHandle stderr main1::IO() main1 = runResourceT $ sourceCmd "dir" $= conduitCmd "find /i \"help\"" $$ CB.sinkHandle stdout ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] sinkfork using conduit 3.0
I am trying to update sinkfork to use conduits 3.0. The difficulty I am having is trying to figure out how to push a value into a SinkM constructor. Any ideas? Here is the old! conduits code 2.0: https://gist.github.com/1975383 Thanks in advance. Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-conduit proxy
> So you can do smth like: > > (sourceClient $= CL.map Left) >=< > (sourceTMChan communicationChannel $= CL.map Right) > > Alexander V Vershilov That's a great idea, I'll give that a try. I was having an odd problem with killThread on windows where the first character would be lost in the next session straight after the killThread, so your idea looks more appealing. Thanks again, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-conduit proxy
Thanks for explaining the problem. I guess I have to ditch my preconceived notions (based on using Java/.Net) that killing a thread is dangerous. Thanks again, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-conduit proxy
The problem is, how would I then go about creating a proxy like tcpmon? I was going to replace this code 'clientSrc $$ serverSink' with this 'clientSrc $$ (sinkFork (sinkFile "randomname") serverSink' and the same for the 'serverSrc $$ clientSink' part. However, since the 'clientSrc $$ serverSink' part will be suspended until the process has ended, I would be holding on to open resources for the whole time. Is there a better way to create this proxy? Thanks, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-conduit proxy
Unfortunately I don't have a solution to this. Here is some code and output that hopefully explains what is happening https://gist.github.com/2012723 The problem is that the clientSrc $$ serverSink appears to run and according to Alexander, the socket closes. But the thread seems to hang inside the "clientSrc $$ serverSink" command and then nothing after that command is run (until the process is terminated). I would have expected the register command to run and the statement "END clientSrc serverSink" to display. When I kill the process on Ubuntu all three exceptions are then thrown at once and the rest of the thread continue. Thanks for taking a look at this, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-conduit proxy
Excellent. registering killThread works great. Hopefully the library will be fixed correctly. Thanks a lot for your help, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-conduit proxy
I've tried running the code with runTCPServer first but I get "recv: invalid argument (Bad file descriptor)" on ubuntu (virtualbox) and when running on windows I get "Network.Socket.ByteString.recv: failed (Unknown error)". Also, it seems odd that when I run this code https://gist.github.com/2010354 that it doesn't print "END serverSrc clientSink". Is this the expected behaviour or are resources not being closed? Again the same thing happens when running on Ubuntu. {- here is the output ... C:\haskell>netproxy4 START clientSrc serverSink START serverSrc clientSink END clientSrc serverSink START serverSrc clientSink START clientSrc serverSink END clientSrc serverSink -} Thanks for any ideas. Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] network-conduit proxy
When I run the code you suggested on windows I get the following error: getAddrInfo: does not exist (error 10093) which probably refers to http://trac.haskell.org/network/ticket/32 After adding withSocketsDo I get a little further, but get the following error after sending data through the proxy: netproxy2: Network.Socket.ByteString.recv: failed (Unknown error) Any ideas? Thanks so much for your help with this. Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] network-conduit proxy
I am trying to get a proxy working using the network-conduit package on windows. So I send a request to port 5002 and that gets forwarded to another port 5000 where I have a simple echo server running. I made a stab at it, but get intermittent send errors after the first connection Here is the code: {-# OPTIONS -Wall #-} import Data.Conduit import Data.Conduit.Network import Network (withSocketsDo) import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Resource main::IO () main = withSocketsDo $ runTCPClient (ClientSettings 5000 "localhost") $ \src1 sink1 -> do liftIO $ print "in tcpclient section" liftIO $ withSocketsDo $ runTCPServer (ServerSettings 5002 Nothing) $ \src sink -> do liftIO $ print "in tcpserver section" _ <- liftIO $ runResourceT $ resourceForkIO $ do src1 $$ sink return () src $$ sink1 Thanks for any help, Grant ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe