[Haskell-cafe] Telling Cassava to ignore lines
I'm happily using Cassava to parse CSV, only to discover that non-conforming lines in the input data are causing the parser to error out. let e = decodeByName y' :: Either String (Header, Vector Person) chugs along fine until line 461 of the input when parse error (endOfInput) at ... Ironically when my Person (ha) data type was all fields of :: Text it just worked, but now that I've specified one or two of the fields as Int or Float or whatever, it's mis-parsing. Is there a way to tell it to just ignore lines that don't parse, rather than it killing the whole run? Cassava understands skipping the *header* line (and indeed using it to do the -by-name field mapping). Otherwise the only thing I can see is going back to all the fields being :: Text, and then running over that as an intermediate structure and validating whether or not things parse to i.e. float. AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Telling Cassava to ignore lines
On Tue, 2013-09-17 at 19:03 -0700, Johan Tibell wrote: 2. Use the Streaming module, which lets you skip whole records that fails to parse (see the docs for the Cons constructor). Ah, that's sure to be it. Totally missed Data.Csv.Streaming. Thanks! AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hoogle problems?
I've just tried using Hoogle, but either get a 404 not found (http://haskell.org/hoogle/) or else I find I get a ELF 64-bit LSB executable being downloaded If I search using Google and click on the first link (shown as www.haskell.org/hoogle/ I get the following (spaces deliberately added to make it less dangerous) https://www.goo gle.com/url?sa=trct=jq=esrc=ssou rce=webcd=1cad=rjaved=0CC8QFjAAurl=http%3A%2F%2Fwww.haskell.org%2Fhoogle%2Fei=y_njUdZAhY 7sBsGpgNAKusg=AFQjCNFljq5Oyb4LT7VF-I5MUotq512AQgsig2 =SVRE_6nF3bhho7-NKqEaCwbvm=bv.487 05608,d.ZGU Using Mac OS X 10.6, Chrome and Safari Is it me, or is there a wider problem ? Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: haskell-names-0.1
On Thu, 2013-06-20 at 18:13 +0300, Roman Cheplyaka wrote: Namely, it can do the following: * for a module, compute its interface, i.e. the set of entities exported by the module, together with their original names. * for each name in the module, figure out what it refers to — whether it's bound locally (say, by a where clause) or globally (and then give its origin). Is this a step toward being able to automatically derive an API version number [in the SO version sense of the word; ie, has a change happened requiring a version bump?] AfC Sydney signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Improved ghc-pkg cache warnings
When ghc-pkg observes your cache is out of date, it displays a helpful warning, recommending ghc-pkg recache. However, sometimes running this command does not fix the problem, because it targets the wrong cache. For out of date global caches, ghc-pkg --global recache successfully clears the warning. For out of date user caches, ghc-pkg --user recache clears the warning. In the future, could ghc-pkg display the command more specific to the problem? -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Automating Hackage accounts
Could we add an HTML form for creating new Hackage accounts? Right now, our community is small enough that emailing r...@soi.city.ac.uk and waiting for a manual response isn't too bad of a problem, but as we grow, it would be nice for these sorts of things to be handled by a server, like with RubyGems and NPM. -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] mapFst and mapSnd
I have them defined for my stuff. Generally I find it much quicker to roll my own than to (1) ask on this list if someone else has done it... (2) look at arrows or MyFavouriteCategoryTheoryBitOfFPBecauseICantGetAbstractEnough and the try to figure out what is going on. The joy of Haskell is both that rolling your own is often so easy, and that there are lots of approaches out there that allow you to get abstract as well... Regards, Andrew (Engineering graduate, feet still firmly embedded in concrete :-) On 28 May 2013, at 09:54, Dominique Devriese wrote: Hi all, I often find myself needing the following definitions: mapPair :: (a - b) - (c - d) - (a,c) - (b,d) mapPair f g (x,y) = (f x, g y) mapFst :: (a - b) - (a,c) - (b,c) mapFst f = mapPair f id mapSnd :: (b - c) - (a,b) - (a,c) mapSnd = mapPair id But they seem missing from the prelude and Hoogle or Hayoo only turn up versions of them in packages like scion or fgl. Has anyone else felt the need for these functions? Am I missing some generalisation of them perhaps? Regards, Dominique ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Teaching FP with Haskell
Rustom, you should look at Helium - http://www.cs.uu.nl/wiki/bin/view/Helium/WebHome Andrew. On 21 May 2013, at 10:55, Rustom Mody wrote: We are offering a MOOC on haskell : https://moocfellowship.org/submissions/the-dance-of-functional-programming-languaging-with-haskell-and-python Full Announcement on beginners list : http://www.haskell.org/pipermail/beginners/2013-May/012013.html One question that I have been grappling with in this regard: How to run ghc in lightweight/beginner mode? 2 examples of what I mean: 1. gofer used to come with an alternative standard prelude -- 'simple.pre' Using this, gofer would show many of the type-class based errors as simple (non-type-class based) errors. This was very useful for us teachers to help noobs start off without intimidating them. 2. Racket comes with a couple of levels. The easier numbers were not completely consistent with scheme semantics, but was gentle to beginners Any thoughts/inputs on this will be welcomed Rusi ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What symbol / atom/ interned-string package is currently preferred?
On Thu, 2013-05-09 at 11:56 +, Johannes Waldmann wrote: http://hackage.haskell.org/package/intern what does this package do? OK, I can read efficient hash consing but what does it mean exactly? and how would I actually use it? Hah. I read the same thing and came to exactly the same level of not-understanding. Thankfully edwardk is learning the value of putting documentation in his libraries! The only trouble is that he is so bloody prolific it might be a while before he gets around to explaining any particular one to the rest of us :) AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Platform's libstdc++-6.dll may be interfering with other applications
I use a number of different programming languages, so I have Haskell Platform, Strawberry Perl, Node.js, RVM, and Git Bash installed at the same time. I've noticed that compiling packages with C dependencies (e.g. using node-gyp during npm install node-mhash, or doing cpan install PAR::Packer) often crashes during the build process with a popup: The procedure entry point __gxx_personality_sj0 could not be located in the dynamic link library libstdc++-6.dll. As Roderich Schupp points outhttps://rt.cpan.org/Public/Bug/Display.html?id=84949, it appears that the different libstdc++-6.dll's are interfering with one another. Haskell Platform comes with one, Vagrant comes with one, GIMP comes with one, MinGW comes with one, and Strawberry Perl comes with two! Objdump seems to indicate that Haskell Platform's DLL is the one to blame. $ find /c/ -name libstdc++-6.dll 2/dev/null /c/DevKit/mingw/bin/libstdc++-6.dll /c/Program Files/GIMP 2/bin/libstdc++-6.dll /c/Program Files/Haskell Platform/2012.4.0.0/mingw/bin/libstdc++-6.dll /c/strawberry/c/bin/libstdc++-6.dll /c/strawberry/perl/bin/libstdc++-6.dll /c/vagrant/vagrant/embedded/mingw/bin/libstdc++-6.dll $ objdump -ax /c/DevKit/mingw/bin/libstdc++-6.dll | ack gxx_personality [3896] __gxx_personality_sj0 $ objdump -ax /c/Program\ Files/GIMP\ 2/bin/libstdc++-6.dll | ack gxx_personality [3499] __gxx_personality_sj0 $ objdump -ax /c/Program\ Files/Haskell\ Platform/2012.4.0.0/mingw/bin/libstdc++-6.dll | ack gxx_personality [3401] __gxx_personality_v0 $ objdump -ax /c/strawberry/c/bin/libstdc++-6.dll | ack gxx_personality [3510] __gxx_personality_sj0 $ objdump -ax /c/strawberry/perl/bin/libstdc++-6.dll | ack gxx_personality [3510] __gxx_personality_sj0 $ objdump -ax /c/vagrant/vagrant/embedded/mingw/bin/libstdc++-6.dll | ack gxx_personality [3896] __gxx_personality_sj0 Would updating Haskell Platform's libstdc++-6.dll fix this issue? Is there some way to cordon Haskell Platform off from the rest of the system, while still making ghc.exe and friends available on PATH? Here are my system specs, I figure they're highly relevant. $ specs haskell perl node ruby git os Specs: specs 0.4 https://github.com/mcandre/specs#readme cabal --version cabal-install version 0.14.0 using version 1.14.0 of the Cabal library ghc --version The Glorious Glasgow Haskell Compilation System, version 7.4.2 ghc-pkg field haskell-platform version version: 2012.4.0.0 cpan --version c:\strawberry\perl\bin/cpan version 1.5902 calling Getopt::Std::getopts (version 1.07 [paranoid]), running under Perl version 5.16.2. [Now continuing due to backward compatibility and excessive paranoia. See 'perldoc Getopt::Std' about $Getopt::Std::STANDARD_HELP_VERSION.] Nothing to install! perl --version This is perl 5, version 16, subversion 2 (v5.16.2) built for MSWin32-x86-multi-thread Copyright 1987-2012, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using man perl or perldoc perl. If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. npm --version 1.2.17 node --version v0.10.3 bundle --version Bundler version 1.3.2 gem --version 2.0.3 ruby --version ruby 1.9.3p374 (2013-01-15) [i386-mingw32] git --version git version 1.8.0.msysgit.0 systeminfo | findstr /B /C:OS Name /C:OS Version OS Name: Microsoft Windows XP Professional OS Version:5.1.2600 Service Pack 3 Build 2600 -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Markdown extension for Haddock as a GSoC project
My 2c (before such coins disappear...) On 2 May 2013, at 09:14, Petr Pudlák wrote: Hi, Personally I'd incline to choose some existing, well-established markup language with formal specification that supports math (hopefully there is one). So TeX/LaTeX is out then :-( Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Looking for portable Haskell or Haskell like language
On Fri, 2013-04-26 at 21:21 -0800, Christopher Howard wrote: Hi. I've got this work situation where I've got to do all my work on /ancient/ RHEL5 systems, with funky software configurations, and no root privileges. I wanted to install GHC in my local account, but the gnu libc version is so old (2.5!) that I can't even get the binary packages to install. Silly question, but have you tried *building GHC from source*? Building GHC is non-trivial, but basically boils down to having an existing ghc that runs enough to bootstrap, right? So you can take a (quite old, sure, no problem) ghc out of the RHEL 5 repositories and use that to build a current GHC 7.6 say. That _would_ be linked against whatever library stack you have present, and you should be ok from there. AfC Sydney -- Andrew Frederick Cowie http://www.andrewcowie.com/ +61 4 1079 6725 signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Stream fusion and span/break/group/init/tails
On Thu, 2013-04-25 at 21:15 -0700, Johan Tibell wrote: {-# LANGUAGE Strict #-} God, I would love this. Obviously the plugin approach could do it, but could not GHC itself just _not create thunks_ for things unless told to be lazy in the presence of such a pragma? [at which point, we need an annotation for laziness, instead of the annotation for strictness. We're not using ampersand for anything, are we? func Int - Thing - WorldPeace func a b = ... Ah, bikeshed, how we love thee] AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock
On 4 Apr 2013, at 22:53, Aleksey Khudyakov wrote: If we are going to change haddock syntax we should add ability to add math formulae to documentation. It's not currently possible and it makes documenting numeric code properly difficult. How about support for .lhs files? - both those with bird-tracks (which I don't use anymore) and \begin{code}...\end{code} (which I do use). My .lhs files are also LaTeX sources - I guess some way to nicely integrate haddock markup/down/whatever with LaTeX stuff would be needed +1 in any case ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock
I'm not proposing the LaTeX is used for hyperlinking the reference - hence my comment about nicely integrating Perhaps a \begin{haddock} ... \end{haddock} environment* ? * This would only affect those using LaTeX/lhs - everyone else could haddock** as usual ** haddock = whatever markdow/up/sideways scheme you guys come up with... On 5 Apr 2013, at 16:22, Aleksey Khudyakov wrote: On 5 April 2013 12:20, Andrew Butterfield andrew.butterfi...@scss.tcd.ie wrote: On 4 Apr 2013, at 22:53, Aleksey Khudyakov wrote: If we are going to change haddock syntax we should add ability to add math formulae to documentation. It's not currently possible and it makes documenting numeric code properly difficult. How about support for .lhs files? - both those with bird-tracks (which I don't use anymore) and \begin{code}...\end{code} (which I do use). My .lhs files are also LaTeX sources - I guess some way to nicely integrate haddock markup/down/whatever with LaTeX stuff would be needed I'm not sure that it would help. If we to use haddock markup it need to support math typesetting. And LaTeX IMHO isn't right tool for creating hyperlinked API reference ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: HaTeX-3.5 - New version of the LaTeX library
On Tue, 2013-03-19 at 00:47 -0400, Daniel Díaz Casanueva wrote: This new version also includes a new matrix renderer. I'm surprised you had to create a new 'matrix' package; I would have thought one of the existing math libraries would have had the types you need? AfC Sydney signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: http-streams 0.3.1.0
Hey, I'd like to announce the initial release of http-streams, an HTTP client library using the Snap Framework's io-streams library to handle the streaming I/O. I blogged about it the background and API design here: http://blogs.operationaldynamics.com/andrew/software/haskell/http-streams-introduction The SHA256 sum of http-streams-0.3.1.0.tar.gz as uploaded is: e0671f8eac83e9a4b092bdd7b03e69b80ac0417818b8dbc51d8604b769179bd3 Comments and feedback welcome. Cheers, AfC Sydney signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] The state of binary (de)serialization
On Mon, 2013-02-25 at 11:59 -0800, Johan Tibell wrote: Simon's builder (originally developed in blaze-binary) has been merged into the bytestring package. I've been meaning to ask: does this mean that ByteString's concat and append functions will now be implemented in terms of Builder internally, or does one will need to use Builder exclusively until it's finally time to create a ByteString for passing to $whatever? AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ifdef based on which OS you're on
On Mon, 2013-02-25 at 00:28 -0500, Dan Cross wrote: Why go to all that bother? Why not just write code that writes out the path you want to take and link against it? {shrug} You could do that too. I spent a decade doing work in Java-land, a language where by design we *didn't* have #ifdefs. Write once, run everywhere, they said. Yeah, right. It was a royal pain in the ass, especially when writing language bindings to native libraries. Portability is part of it, but including coverage (or not) of features based on whether dependencies were present was a biggie, too. So I'm a fan. To your point about generating code and then having only one version at compile time, that's a fair approach too. I would choose against it only because I'd prefer (as in this example) the relevant lines be in the source file where they belong, rather than having three definitions of that function somewhere else (or worse, meta). In the case I showed it's only one #define and one code block. But in a case where you had to make decisions across a code base, then I think #include config.h would be a workable choice. Anyway, I thought it was cool, and as figuring it out took a bit of doing I wanted to write it up. AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ifdef based on which OS you're on
I've got a piece of code that looks like this: baselineContextSSL :: IO SSLContext baselineContextSSL = do ctx - SSL.context SSL.contextSetDefaultCiphers ctx #if defined __MACOSX__ SSL.contextSetVerificationMode ctx SSL.VerifyNone #elif defined __WIN32__ SSL.contextSetVerificationMode ctx SSL.VerifyNone #else SSL.contextSetCADirectory ctx /etc/ssl/certs SSL.contextSetVerificationMode ctx $ SSL.VerifyPeer True True Nothing #endif return ctx all very nice (this being necessary because apparently the non-free operating systems don't store their certs in a reliably discoverable place; bummer). That, however, is not the problem. After all, this sort of thing is what #ifdefs are for. The problem is needing to get an appropriate symbol based on what OS you're using defined. I naively assumed there would be __LINUX__ and __MACOSX__ and __WIN32__ defined by GHC because, well, that's just the sort of wishful thinking that powers the universe. So my question is: what's an appropriate Haskell mechanism for building code that is OS / arch / distro specific? It's not like I have autoconf running generating me a config.h I could #include, right? This feels simple and an appropriate use of CPP; even the symbol names look just about like what I would have expected; stackoverflow said so, must be true. Just need to get the right symbol defined at build time. Any suggestions? AfC Sydney signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ifdef based on which OS you're on
That's interesting. But are there standard values for those functions? I'm guessing not, seeing a how they're String and not an ADT. AfC Sydney Artyom Kazak artyom.ka...@gmail.com wrote: You can know the OS and arch without even resorting to CPP; see System.Info which defines `os` and `arch`. -- Andrew Frederik Cowie Operational Dynamics ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] optimization of recursive functions
Thanks for the exhaustive answer. Andrew On Wed, Feb 13, 2013 at 2:57 PM, Alp Mestanogullari alpmes...@gmail.comwrote: If a difference appears, I believe http://blog.johantibell.com/2010/09/static-argument-transformation.htmlwould be involved. Also, the second map function could be inlined by GHC, avoiding calling f through a pointer because at the call site, we know what 'f' is (this is also mentionned in the blog post by Johan). On Wed, Feb 13, 2013 at 9:55 AM, Andrew Polonsky andrew.polon...@gmail.com wrote: Hello, Is there any difference in efficiency between these two functions, when compiled with all optimizations? map f [] = [] map f (a:as) = f a : map f as and map f x = map' x where map' [] = [] map' (a:as) = f a : map' as Thanks, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alp Mestanogullari ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] tls talking to certificate stores (was Re: ...)
On Fri, 2013-02-15 at 15:12 +, Vincent Hanquez wrote: Sorry the answer is out of topic That's ok. Windows certificate and macos X certificate are stored in a reliably discoverable place. That openssl provide no way to get to it is a different story and one reason to have tls. Is talking to the Windows and Mac OS certificate stores something that you wrote for the tls library [in Haskell]? If so, is it something that could be ported for other people to use? [I assume we can just look at tls's source but I'd certainly welcome a pointer as to where to look] AfC Sydney signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ifdef based on which OS you're on
On Fri, 2013-02-15 at 15:16 +0100, Krzysztof Skrzętnicki wrote: See: http://www.haskell.org/cabal/users-guide/developing-packages.html#configurations That link says os(): Tests if the current operating system is name. The argument is tested against System.Info.os on the target system. There is unfortunately some disagreement between Haskell implementations about the standard values of System.Info.os. Cabal canonicalises it so that in particular os(windows) works on all implementations. If the canonicalised os names match, this test evaluates to true, otherwise false. The match is case-insensitive. So this approach is back to relying on System.Info.os either way. What worries me is the Cabal canonicalises it, which seems to indicate that there are actually many values that show up in 'os' that need to be regularized. Anyone have any idea if the Cabal library exposes this somewhere? AfC Sydney signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] optimization of recursive functions
Hello, Is there any difference in efficiency between these two functions, when compiled with all optimizations? map f [] = [] map f (a:as) = f a : map f as and map f x = map' x where map' [] = [] map' (a:as) = f a : map' as Thanks, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Mobile app development?
Can we un-deprecate GHC's ability to compile to C code? C may be the best option to bridge to mobile, as Android, iOS, and Windows RT do support C/C++ apps. On Jan 22, 2013 2:14 PM, Dan Choi dhc...@gmail.com wrote: What about the option of using Haskell's Parsec or AttoParsec to implement a Haskell-ish language that compiles down not to machine code but to Objective C or Android Java? Like how CoffeeScript compiles down to JavaScript. On Saturday, January 19, 2013 1:58:03 PM UTC-5, Casey Hawthorne wrote: You would need native compilers for all the platforms and/or virtual machine technology. Might be easier to have the browser connect to a Haskell app. On Sat, Jan 19, 2013 at 10:42 AM, Andrew Pennebaker andrew.p...@gmail.com wrote: There are currently very few options, especially free and open source options, when it comes to developing cross-platform mobile applications. It's basically web apps with JavaScript, or C++. If Haskell supported app development on Android, iOS, and Windows RT, that alone would bring in more developers. Similarly, there are very few languages for mobile development that take advantage of multiple cores and multiple CPUs. Haskell's `parmap` is an amazing selling point. Can we please prioritize mobile support? I'd much rather write everything in ML than PhoneGap. -- Cheers, Andrew Pennebaker www.yellosoft.us __**_ Haskell-Cafe mailing list haskel...@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe -- -- Regards, KC __**_ Haskell-Cafe mailing list haskel...@haskell.org http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] XCode Dependency for HP on Mac
Tom Murphy amindfv at gmail.com writes: Is there a way to install HP without XCode? Could there be in the future? I'm tired of dealing with Apple's constant upgrade requirements, registration requirements, etc., and it seems like a small function that XCode actually performs in the Haskell development toolchain. Again, I'm ignorant of the details and I'm sorry if this is ranty, but I'd love to hear your reactions. Thanks! Tom Hi, I know this is an old thread, but it came up on Google when I was searching around for an answer to this. So maybe I can still help someone. 10.6 users can use this installer on GitHub https://github.com/kennethreitz/osx-gcc-installer. It installs gcc and a few other bits and pieces (less than a GB to install). Then you can install the Haskell Platform. It's worked for me so far! Enjoy! Thanks, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] XCode Dependency for HP on Mac
Mark Lentczner mark.lentczner at gmail.com writes: As the README at that repository states, For 10.7 and later Apple now distributes a Command Line Tools package on the developer site. When I build and release the Haskell Platform, I confirm that works when just this package is installed (rather than all of Xcode). [Message continues] - Mark (HP release manager) ___ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Hi Mark, I will keep you updated, the issue is that I refuse to upgrade to 10.7 or later, many of the brilliant features from Snow Leopard were entirely ruined and I still see people complaining about having trouble with it on my model of MacBook. So for 10.6 users, this 3rd part installer is the only option I could find! Thanks, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Mobile app development?
There are currently very few options, especially free and open source options, when it comes to developing cross-platform mobile applications. It's basically web apps with JavaScript, or C++. If Haskell supported app development on Android, iOS, and Windows RT, that alone would bring in more developers. Similarly, there are very few languages for mobile development that take advantage of multiple cores and multiple CPUs. Haskell's `parmap` is an amazing selling point. Can we please prioritize mobile support? I'd much rather write everything in ML than PhoneGap. -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] curl package broken in Windows
Yes, that's a very good point. Did you know that Strawberry Perl includes a cygwin gcc? http://strawberryperl.com Maybe Haskell Platform could do the same. On Nov 10, 2012 5:28 PM, Stephen Tetley stephen.tet...@gmail.com wrote: The only short cut would be to have it in the Platform - otherwise it is DIY I'm afraid. This is as much Microsoft's fault as Haskell's for not providing a C compiler, build tools etc. in the baseline environment. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC for mobile devices?
I've tried porting GHC to Haiku OS, a Unix-like desktop OS, but the state of the GHC build system is fairly confusing. The build scripts contain a Perl script with a bad shebang, and you can't build GHC without already having a working older version. If someone can point me to the most recent GHC code that doesn't need itself to compile, I can work on a Haiku version as practice. I really want GHC for every possible system. On Nov 10, 2012 5:49 PM, Kristopher Micinski krismicin...@gmail.com wrote: On Sat, Nov 10, 2012 at 3:50 PM, Casey Basichis caseybasic...@gmail.com wrote: Hi Kris, No offense taken, it was an argument that works to shut down constructive discussion of how to get Haskell running on mobile, a task which has perplexed me for several long days. I agree most apps are pretty terrible, at least on iOS though, despite the percentages being wildly off there are still a few hundred apps that are very well done and thoughtful, none of them using Haskell I'm sure. Yup! Most of the time apps are merely translated versions of rails frontends. (For better or for worse, I assume that if we were to port haskell to work with Android really it would be mostly to appease my purity.) I'm looking to pass Haskell lists of musical data and return processed musical ideas from it (not audio, not realtime). I was also planning on handling a database within Haskell as the information contained would be used by the music processing and from what I have read Haskell interfaces to SQL far more readily than with a C++ orm type solution. I was planning on working with Haskells Euterpea as base to build my ideas off of, my I might end up rolling my own similar library as my aims are a bit different than theirs. I'm not sure I understand completely, but I agree this isn't a bad idea. Everything else would be C++, including the interface, audio and dsp processing etc. I already have the C++ stuff running on my phone. I have read about the difficulty of getting Haskell working in real world scenarios, but as far as I understand my plans for it are fairly well suited to it. I don't disagree! Since much of the documentation online about Haskell seems to be out of date, its tough to get a general feel for whats working. I see people mention that cross-compilation was finished a while back which should allow for targeting arm but nothing concrete and the website gives conflicting info. I've also considered using GHC to generate C to paste into the project but it seems there have been and may be more integrated ways to get it running. I am venturing into my embarrassing lack of knowledge about GHC internals here, but how easily would the run time system work on Android..? I had assumed a large part of the effort into getting OCaml to work on iPhone went into the runtime system, no? If you're (Andrew or anyone) still interested in pursuing this I would be interested in helping out, I have some Android internals knowledge and would be glad to lend a hand. One major thing that seems to be necessary is congealing all the (mis/outdated)information into the wiki article on haskell.org. kris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC for mobile devices?
ASM for iOS is possible, so GHC mobile should be possible. www.shervinemami.info/armAssembly.html#howto On Nov 10, 2012 5:59 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: I've tried porting GHC to Haiku OS, a Unix-like desktop OS, but the state of the GHC build system is fairly confusing. The build scripts contain a Perl script with a bad shebang, and you can't build GHC without already having a working older version. If someone can point me to the most recent GHC code that doesn't need itself to compile, I can work on a Haiku version as practice. I really want GHC for every possible system. On Nov 10, 2012 5:49 PM, Kristopher Micinski krismicin...@gmail.com wrote: On Sat, Nov 10, 2012 at 3:50 PM, Casey Basichis caseybasic...@gmail.com wrote: Hi Kris, No offense taken, it was an argument that works to shut down constructive discussion of how to get Haskell running on mobile, a task which has perplexed me for several long days. I agree most apps are pretty terrible, at least on iOS though, despite the percentages being wildly off there are still a few hundred apps that are very well done and thoughtful, none of them using Haskell I'm sure. Yup! Most of the time apps are merely translated versions of rails frontends. (For better or for worse, I assume that if we were to port haskell to work with Android really it would be mostly to appease my purity.) I'm looking to pass Haskell lists of musical data and return processed musical ideas from it (not audio, not realtime). I was also planning on handling a database within Haskell as the information contained would be used by the music processing and from what I have read Haskell interfaces to SQL far more readily than with a C++ orm type solution. I was planning on working with Haskells Euterpea as base to build my ideas off of, my I might end up rolling my own similar library as my aims are a bit different than theirs. I'm not sure I understand completely, but I agree this isn't a bad idea. Everything else would be C++, including the interface, audio and dsp processing etc. I already have the C++ stuff running on my phone. I have read about the difficulty of getting Haskell working in real world scenarios, but as far as I understand my plans for it are fairly well suited to it. I don't disagree! Since much of the documentation online about Haskell seems to be out of date, its tough to get a general feel for whats working. I see people mention that cross-compilation was finished a while back which should allow for targeting arm but nothing concrete and the website gives conflicting info. I've also considered using GHC to generate C to paste into the project but it seems there have been and may be more integrated ways to get it running. I am venturing into my embarrassing lack of knowledge about GHC internals here, but how easily would the run time system work on Android..? I had assumed a large part of the effort into getting OCaml to work on iPhone went into the runtime system, no? If you're (Andrew or anyone) still interested in pursuing this I would be interested in helping out, I have some Android internals knowledge and would be glad to lend a hand. One major thing that seems to be necessary is congealing all the (mis/outdated)information into the wiki article on haskell.org. kris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] curl package broken in Windows
When I do cabal install curl in Windows, a missing cygwin dll message pops up, and packages that depend on curl, like shpider, fail to install. Specs: * cabal-install 0.14.0 * Cabal 1.14.0 * GHC 7.4.2 * Haskell Platform 2012 * Windows 7 Proffesional x64 -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHC for mobile devices?
I'd love to use Haskell directly for making mobiles apps. How can we make this happen, porting GHC to Android, iOS, and Windows Phone? -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Motion to unify all the string data types
Frequently when I'm coding in Haskell, the crux of my problem is converting between all the stupid string formats. You've got String, ByteString, Lazy ByteString, Text, [Word], and on and on... I have to constantly lookup how to convert between them, and the overloaded strings GHC directive doesn't work, and sometimes ByteString.unpack doesn't work, because it expects [Word8], not [Char]. AAAH!!! Haskell is a wonderful playground for experimentation. I've started to notice that many Hackage libraries are simply instances of typeclasses designed a while ago, and their underlying implementations are free to play around with various optimizations... But they ideally all expose the same interface through typeclasses. Can we do the same with String? Can we pick a good compromise of lazy vs strict, flexible vs fast, and all use the same data structure? My vote is for type String = [Char], but I'm willing to switch to another data structure, just as long as it's consistently used. -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC for mobile devices?
Awesome! Jeffrey Scofield has ported OCaml to iOShttp://psellos.com/ocaml/compile-to-iossim.html, so there's also experience there. On Fri, Nov 9, 2012 at 11:46 PM, Kristopher Micinski krismicin...@gmail.com wrote: If you have interest in doing this, I have quite a bit of experience in Android hacking at the system level and above and would be glad to talk about what might need to happen. (Though I don't know the GHC internals / toolchain so well.) One potential choice is Scala, though from my limited experience that's a very rough imitation of the uses for Haskell. (Though, obviously it works mostly out of the box because of the JVM compiler target..) http://www.haskell.org/haskellwiki/Android I've been writing up some thoughts on the Android activity lifecycle already interpreted with respect to FP, apps are quite functional already for a variety of reasons. kris On Fri, Nov 9, 2012 at 8:51 PM, Andrew Pennebaker andrew.penneba...@gmail.com wrote: I'd love to use Haskell directly for making mobiles apps. How can we make this happen, porting GHC to Android, iOS, and Windows Phone? -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How do I specify language literals in hsparql?
If the raw SPARQL is rdfs:label D (programming language)@en, what would the hsparql http://hackage.haskell.org/package/hsparql syntax be? The docshttps://github.com/robstewart57/hsparql/blob/master/tests/DBPedia.hs don't include any language literal examples. -- Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Tutorial: Haskell for the Evil Genius
I've gotten mixed feedback from Reddit for my tutorial. It provides an overview of how functional and declarative programming in Haskell empower baddies, increasing the accuracy and efficiency of their atomic superweapons. What do you guys think of my tutorial, Haskell for the Evil Genius http://www.yellosoft.us/evilgenius/? Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius
A summary of the changes I've included so far: Under Declarative, you aren't creating a named expression, 2 + 2, really. You are redefining (+). Noted and reflected in the new version. Under Lazy, your example of binding fib 30 is not a good example of memoization. With memoization you typically call the underlying computation the first time, and memoize it for repeated retrieval later, not hardwire in values at compile time. Here you never ever call the real fib at all. On top of everything else, it'd be too easy to introduce a typo into one of your hardwired constant values. Noted and reflected in the new version. After several comments to this effect, I do not want to misrepresent memoization in the tutorial. Sometimes it is useful to be slightly inaccurate in a tutorial in order to help bridge the gap between someone with no experience in a something vs the wealth of knowledge and complexity in the thing itself. This is not one of those times, and fortunately, fixing the misrepresentation in my tutorial is as easy as removing the hardcoded call. One thing I want to double check is that Haskell does, in fact, automatically memoize all pure function calls. Is this true? I would still like to provide a performance comparison of the Fibonacci code with and without memoization, for readers who enjoy numerical evidence, using the Unix time command, but I don't know how to turn memoization off. I guess I would have to reimplement the algorithm in a way that can't make use of memoization. Any suggestions? Under Infinite, you should use sieve (n:ns) pattern matching instead of calling head. Thank you! I try to make use of Haskell pattern matching wherever I can. Since I needed to refer to the whole list, as well as the head and tail, I originally used head instead of pattern matching. Noted and reflected in the new version. Under Type-Safe Subtle distinction, but returning () is not the same as returning nothing at all. True. Noted and reflected in the new version. What's the Haskell name for () again? I fear explaining the exact type information of IO () may be too much for a brief introduction to Haskell to cover. s/ommitted/omitted/ Noted and reflected in the new version. You've got an unusual indentation scheme. Consider adopting a more standard one for your tutorial. I'm in the camp of hard tabs rather than soft tabs, and that preference is probably responsible for much of the difference in indentation scheme. Unfortunately, HTML is terrible at representing hard tabs in PRE code with a custom width preference; they all come out looking like some idiot pressed space bar eight times. I could use JavaScript to remedy this, but for now, I like to directly copy and paste my working code from .HS files into PRE tags just in case. If tabs are *not* the issue, then maybe I'm not indenting far enough to the right for some tastes? Or maybe it's my tendency to put where on its own line, something a Perl obfuscater would detest. I dunno. If someone would suggest a more idiomatic indentation scheme for my code so that I know exactly what is different, I can take a look. In general, monotonically decreasing is not sufficient to prove you will hit a base case. For example, decreasing by 5 would still be monotonically decreasing, and could jump right over your base cases. (Not arguing that the code is incorrect, but rather than your explanation is a little misleading/incomplete.) Understood. Noted and reflected in the new version. Incidentally, when will Nat be available in Haskell? The Fibonacci algorithm is designed to work only over natural numbers, and the best way to express this in the type system is with Nat. But this type doesn't seem available out-of-the-box for Haskell users. Unless I'm using my Haskell Platform (GHC 7.0.3) is slightly outdated. Eh? Again, further confusion about what memoization really is. Under Records Functions are already defined by their data structures; they are already semantically bundled... doesn't seem to make sense. Noted and reflected... I'm trying to convey to an audience largely composed of Java and C++ fanatics how Haskell records are much better than OOP, how GADTs are more intuitive, robust, ... OOP doesn't even compare! That's what I'm trying to get across in that bit. And it's hard to do this in just a few sentences, especially when the reader isn't even familiar with GADTs in the first place. ... acts on the specific constructor, blasting fools, murdering crowds... makes it sound like fireOn actually has side effects. A truly fair point. Would you like to contribute a monad for blowing up the moon? Another comment: As a declarative language, Haskell manipulates expressions, eventually reducing expressions to values. Huh? In what sense do declarative languages manipulate expressions? Sounds like a classic syntax/semantics confusion, especially when interpreters and/or lazy evaluation
Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius
Experiment #4: fib :: Int - Int fib n = mem !! n mem :: [Int] mem = map aux [0..] -- remark: even [Int] is not a very efficient data structure for this aux 0 = 0 aux 1 = 1 aux n = mem!!(n-1) + mem!!(n-2) main :: IO () main = mapM_ (print . fib) (replicate 10 30) Question: How fast is this compared to #1? Why? Final remark: Evil geniuses should use the scientific method, not the opinionative method. Noted and reflected in the new version. Thank you for taking the time to write out a detailed, practical analysis of the question. Yes, I should assume less and test more. I tried these outhttps://github.com/mcandre/mcandre/tree/master/haskell/memfibas requested, and came up with results demonstrating that Haskell, does not, as I mistakenly interpreted, automatically memoize all function calls. Which makes sense, otherwise memory would quickly run out. I found some useful reference code on the Haskell Wiki and constructed my own memoized Fibonacci function using the MemoTrie library, which, fortunately, is builtin with Haskell Platform and therefore does not require the tutorial reader to install additional code. The new version of the tutorial includes an ordinary recursive Fibonacci function (fib1.hs), and the same code but renamed to fib', memoized using the memo function from the MemoTrie library (fib2.hs), and exposed as fib. Unix time information provides real numbers for comparison: The memoized version is clearly much faster. I rewrote the section, deleting the part that stated memoization was automatic, and added text describing how Haskell makes memoization easy. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius
But, Haskell records aren't better than OOP. I am not trying to be controversial here -- Haskell records would naturally implement prototype-based OOP, like JavaScript uses, if they (Haskell records) weren't so useless. This is basically why lenses were designed (i.e., to make consistent syntax for getters and setters) Hey, I don't want the tutorial to be controversial either, especially since my word choice of words like better are highly subjective. I find it extraordinarily empowering that Haskell's type system allows programmers to use a wide variety of programming paradigms: functional, declarative, imperative, lazy, eager, parallel, quantum, matrix, CUDA, multithreaded, distributed, logical, object oriented... When I describe Haskell's type system as better than OOP, what I mean is this: You can code OOP in Haskell, because the type system can adapt to that. But it's much harder to go the other way, trying to code GADTs in Java/C++. In order to get the effect, you'll have to code something as complex as Scala, at which point you might as well just use Haskell (unless you really really really need the JVM for compatibility). It's the same with Lisp or JavaScript or Smalltalk or Ruby: Allowing the programmer to roll his own paradigm, such as OOP, is more powerful than offering only that paradigm. More to the point, the monad system enables all of this, and I'm not sure how to reword this tutorial to reflect that; monads themselves are generally treated as an advanced lesson, and this one tries to hit the ground running. Does anyone know of a brief introductory Haskell tutorial that engages monads? LYAH covers monads, but it does so after a few chapters of simpler, pure function Haskell coding. I know of some brief tutorials for monads that explain them in a variety of creative ways, but they all assume the reader is at least somewhat familiar with Haskell. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius
Everyone in the Haskell cafe probably has a secret dream to give the best five minute monad talk. Challenge: get someone to have a competition at one of the conferences where students all give their best five minute monad talk and try to find the most comprehensible one! Haha, maybe that's why I'm writing. Agree on all points, not just this quotation. Yeah, IO and Maybe are the first monads most new Haskell programmers encounter. Perhaps a tour of RVars or the accelerate library would give a better impression. I bet a lot of students get the concept of pure functional programming, and if you shock them with: So how would you implement a PRNG?, they would understand the role monads play. Given that Maybe and Either don't modify state, nor do they communicate with outside interfaces, nor do they specify computation ordering, I don't understand why they're implemented as monads. Why not a primitive typeclass or even datatype declaration? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Tutorial: Haskell for the Evil Genius
Challenge: get someone to have a competition at one of the conferences where students all give their best five minute monad talk and try to find the most comprehensible one! Challenge accepted http://www.yellosoft.us/5min/. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How do I generate random numbers using random-fu, with platform-agnostic code?
I can't figure out how to use Data.Random.Source.IO to generate random numbers in a multiplatform way. I can generate random numbers in Unix using Data.Random.Source.DevRandom, and there is an example in the GitHub documentation for Windows using Data.Random.Source.MWC, but there is no example code for using Data.Random.Source.IO. Cheers, Andrew Pennebaker www.yellosoft.us ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] createProcess running non-existent programs
On Sun, 2012-08-12 at 23:18 -0700, Evan Laforge wrote: Yes, I ran into the same thing a while back. The problem is that the subprocess has already been forked off before it runs exec() and finds out the file doesn't exist. Given how astonishingly common it is to pass an invalid executable name and/or path, wouldn't it be worth doing a quick probe to see if the file exists before createProcess actually forks? [It's not like the effort the OS is going to do for the stat is going to be thrown away; whether that call pulls it up off of disk or the one after the fork that exec will do doesn't matter] AfC Sydney signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What Haskell Records Need
On 2 Aug 2012, at 09:25, Erik Hesselink wrote: Isn't this exactly the problem solved by all the lens packages? Current popular ones are fclabels [0] and data-lens [1]. [0] http://hackage.haskell.org/package/fclabels [1] http://hackage.haskell.org/package/data-lens Not sure what all of these do, but I have a simple solution I use in my work: Take the following types from a contrived example. type Salary = Integer data Job = Job { title :: String , salary :: Salary } Rather than setTitle :: String - Job - Job we lift the first argument and define setfTitle :: (String - String) - Job - Job setfTitle f jobrec = jobrec{ title = f $ title jobrec } then setTitle = setfTitle . const This is all just boilerplate, so we continue setfSalary :: (Salary - Salary) - Job - Job setfSalary f jobrec = jobrec{ salary = f $ salary jobrec } data Person = Person { name :: String , job :: Job } setfName :: (String - String) - Person - Person setfName f prec = prec{ name = f $ name prec } setfJob :: (Job - Job) - Person - Person setfJob f prec = prec{ job = f $ job prec } Now we can use function composition to do two levels setfTitleInPerson :: (String - String) - Person - Person setfTitleInPerson = setfJob . setfTitle setTitleInPerson :: String - Person - Person setTitleInPerson = setfTitleInPerson . const Simple function composition works to put these together... I was frustrated by this problem a while back, and decided to approach it formally (I write literate Haskell/LateX documents), and went to work, doing the math with the intention of writing a suitable combinator, until I discovered I didn't need one lifting from X - R - R to (X - X) - R - R gave me all I needed... Since I've used record syntax, I get getter/accessor functions (title, salary, name, job) for free. Now suppose I want to create an aggregate getter function: return the salary of a given person. Piece of cake, it's just function composition getSalary :: Person - Salary getSalary = salary . job Done! Now suppose I want to write a setter/mutator function for the same nested field setSalaryMessy :: Salary - Person - Person setSalaryMessy newSalary person = person { job = (job person) { salary = newSalary } } Ouch! And that's not even very deeply nested. Imagine 4 or 5 levels deep. It really makes Haskell feel clunky next to `a.b.c.d = val` that you see in other languages. Of course immutability means that the semantics of Haskell are quite different (we're creating new values here, not updating old ones) but it's still common to model change using these kinds of updates. What if along with the free getters that the compiler generates when we use record syntax, we also got semantic editor combinator (SEC) functions[0] that could be used as follows? setSalary newSalary = job' $ salary' (const newSalary) giveRaise amount = job' $ salary' (+amount) givePercentRaise percent = job' $ salary' (*(1+percent)) For each field x, the compiler generates a function x' (the tic is mnemonic for change). These little functions aren't hard to write, but they're classic boilerplate. job' :: (Job - Job) - Person - Person job' f person = person {job = f $ job person} salary' :: (Salary - Salary) - Job - Job salary' f job = job { salary = f $ salary job} These type of utility functions are a dream when working with any reference type or State Monad. modify $ givePercentRaise 0.25 The compiler could also generate polymorphic SEC functions for polymorphic fields. Further, the compiler could disallow using old-style update syntax for fields whose SEC update function is not in scope, giving us fine-grained control over access and update. On the other hand we currently have to create new functions to achieve this (exporting the getter means exporting the ability to update as well, currently). Of course this doesn't address the namespacing issues with records, but it is likely nicely orthogonal to other proposals which do. Also note that there's a package on hackage [1] that will generate SEC functions using TH. It's nice, but I prefer the style of field names used above for updaters (field' vs editField). Let me know what you think. I'll write up an official proposal if there's a bit of general interest around this. Thanks for reading, --Jonathan [0] - http://conal.net/blog/posts/semantic-editor-combinators [1] - http://hackage.haskell.org/packages/archive/sec/0.0.1/doc/html/Data-SemanticEditors.html ___ 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 Andrew Butterfield
Re: [Haskell-cafe] What Haskell Records Need
Ah yes - the joy of Haskell It so easy to roll your own, rather than search to find someone else's (better/more elegant) solution... :-) On 2 Aug 2012, at 11:41, Erik Hesselink wrote: On Thu, Aug 2, 2012 at 12:30 PM, Andrew Butterfield andrew.butterfi...@scss.tcd.ie wrote: On 2 Aug 2012, at 09:25, Erik Hesselink wrote: Isn't this exactly the problem solved by all the lens packages? Current popular ones are fclabels [0] and data-lens [1]. [0] http://hackage.haskell.org/package/fclabels [1] http://hackage.haskell.org/package/data-lens Not sure what all of these do, but I have a simple solution I use in my work: They do exactly that. They create 'lenses' which are getters/setters/modifiers combined, and allow you to compose these to get/set/modify deep inside nested data types. Look at the examples in the fclabels documentation [2] for more details. [2] http://hackage.haskell.org/packages/archive/fclabels/1.1.4/doc/html/Data-Label.html Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Portackage - a hackage portal
Now all packages, including those without exposed modules, are included. Also, I've attempted to parse the author lists into JSON arrays. Due to the free format of many fields in the .cabal package descriptions, including author list, there are many exceptional cases where they are ill-parsed, but at least the JSON file is well-formed and validates at jsonlint.com. Once more: JSON Schema: http://www.fremissant.net/portackage/packages.schema.json.txt Hopefully compressed JSON data: http://www.fremissant.net/portackage/packages.php Raw JSON data in case the compressed doesn't work: http://www.fremissant.net/portackage/packages.json The hackage data updated as of yesterday (June 14). Will work on daily incremental updates from Hackage RSS feed soon. -Andrew On Thu, Jun 14, 2012 at 7:05 PM, Andrew Seniuk ras...@gmail.com wrote: I discovered http://jsonlint.com/ and got it to validate. :) On Thu, Jun 14, 2012 at 6:18 PM, Andrew Seniuk ras...@gmail.com wrote: Hi ___, Thank you for your suggestion to provide JSON, which seconds Derek's earlier suggestion. I have anonymised your name since you wrote to me but didn't CC the list. :) As much as I wish the web interface was up to snuff, it is really too slow. While I continue to try to resolve that, there is something like a JSON feed available now. I'm new to these things and may be doing it wrong. Any advice would be appreciated, either in accelerating the web interface or in providing the JSON. I have no idea whether it parses or not. JSON Schema: http://www.fremissant.net/portackage/packages.schema.json.txt Hopefully compressed JSON data: http://www.fremissant.net/portackage/packages.php Raw JSON data in case the compressed doesn't work: http://www.fremissant.net/portackage/packages.json The hackage data updated as of today (June 14). For now this is only the packages which expose modules (i.e. not including binary packages). No particular reason, I just ran out of time this afternoon and thought I'd post what I've got. The fields present in the JSON are those available on the HTML table version. There are several dozen other fields which come up more or less infrequently in the Hackage packages, and they could all be included. The complete list of modules is included (rather than the summary versions used in the HTML table version). A next step would be for the server to incrementally update the JSON data based on the Hackage RSS feed. Kind Regards, Andrew On Wed, Jun 13, 2012 at 7:58 AM, ___ wrote: Hi Andrew Portackage is a great site for browsing packages, but it's really really slow for filtering per column. What about offering an additional non-javascript version of the pages -- searching with plain text in a browser works quite well. On 4/30/12, Andrew Seniuk ras...@gmail.com wrote: Oops, the three links in summary are: module tree: http://fremissant.net/portackage/modules.php library packages: http://fremissant.net/portackage/portackage.php other packages: http://fremissant.net/portackage/binary.php ___ 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: Portackage - a hackage portal
Hi ___, Thank you for your suggestion to provide JSON, which seconds Derek's earlier suggestion. I have anonymised your name since you wrote to me but didn't CC the list. :) As much as I wish the web interface was up to snuff, it is really too slow. While I continue to try to resolve that, there is something like a JSON feed available now. I'm new to these things and may be doing it wrong. Any advice would be appreciated, either in accelerating the web interface or in providing the JSON. I have no idea whether it parses or not. JSON Schema: http://www.fremissant.net/portackage/packages.schema.json.txt Hopefully compressed JSON data: http://www.fremissant.net/portackage/packages.php Raw JSON data in case the compressed doesn't work: http://www.fremissant.net/portackage/packages.json The hackage data updated as of today (June 14). For now this is only the packages which expose modules (i.e. not including binary packages). No particular reason, I just ran out of time this afternoon and thought I'd post what I've got. The fields present in the JSON are those available on the HTML table version. There are several dozen other fields which come up more or less infrequently in the Hackage packages, and they could all be included. The complete list of modules is included (rather than the summary versions used in the HTML table version). A next step would be for the server to incrementally update the JSON data based on the Hackage RSS feed. Kind Regards, Andrew On Wed, Jun 13, 2012 at 7:58 AM, ___ wrote: Hi Andrew Portackage is a great site for browsing packages, but it's really really slow for filtering per column. What about offering an additional non-javascript version of the pages -- searching with plain text in a browser works quite well. On 4/30/12, Andrew Seniuk ras...@gmail.com wrote: Oops, the three links in summary are: module tree: http://fremissant.net/portackage/modules.php library packages: http://fremissant.net/portackage/portackage.php other packages: http://fremissant.net/portackage/binary.php ___ 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: Portackage - a hackage portal
I discovered http://jsonlint.com/ and got it to validate. :) On Thu, Jun 14, 2012 at 6:18 PM, Andrew Seniuk ras...@gmail.com wrote: Hi ___, Thank you for your suggestion to provide JSON, which seconds Derek's earlier suggestion. I have anonymised your name since you wrote to me but didn't CC the list. :) As much as I wish the web interface was up to snuff, it is really too slow. While I continue to try to resolve that, there is something like a JSON feed available now. I'm new to these things and may be doing it wrong. Any advice would be appreciated, either in accelerating the web interface or in providing the JSON. I have no idea whether it parses or not. JSON Schema: http://www.fremissant.net/portackage/packages.schema.json.txt Hopefully compressed JSON data: http://www.fremissant.net/portackage/packages.php Raw JSON data in case the compressed doesn't work: http://www.fremissant.net/portackage/packages.json The hackage data updated as of today (June 14). For now this is only the packages which expose modules (i.e. not including binary packages). No particular reason, I just ran out of time this afternoon and thought I'd post what I've got. The fields present in the JSON are those available on the HTML table version. There are several dozen other fields which come up more or less infrequently in the Hackage packages, and they could all be included. The complete list of modules is included (rather than the summary versions used in the HTML table version). A next step would be for the server to incrementally update the JSON data based on the Hackage RSS feed. Kind Regards, Andrew On Wed, Jun 13, 2012 at 7:58 AM, ___ wrote: Hi Andrew Portackage is a great site for browsing packages, but it's really really slow for filtering per column. What about offering an additional non-javascript version of the pages -- searching with plain text in a browser works quite well. On 4/30/12, Andrew Seniuk ras...@gmail.com wrote: Oops, the three links in summary are: module tree: http://fremissant.net/portackage/modules.php library packages: http://fremissant.net/portackage/portackage.php other packages: http://fremissant.net/portackage/binary.php ___ 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] High memory usage with 1.4 Million records?
Thanks for the responses everyone, I'll try them out and see what happens :) Andrew On Fri, Jun 8, 2012 at 4:40 PM, Johan Tibell johan.tib...@gmail.com wrote: Hi Andrew, On Thu, Jun 7, 2012 at 5:39 PM, Andrew Myers asm...@gmail.com wrote: Hi Cafe, I'm working on inspecting some data that I'm trying to represent as records in Haskell and seeing about twice the memory footprint than I was expecting. I've got roughly 1.4 million records in a CSV file (400M on disk) that I parse in using bytestring-csv. bytestring-csv returns a [[ByteString]] (wrapped in `type`s) which I then convert into a list of records that have the following structure: 3 Int 1 Text Length 3 1 Text Length 11 12 Float 1 UTCTime All fields are marked strict and have {-# UNPACK #-} pragmas (I'm guessing that doesn't do anything for non primitives). (Side note, is there a way to check if things are actually being unpacked?) GHC used to complain when you use UNPACK with something that can't be unpacked, but that warning seems to have been (accidentally) removed in 7.4.1. The rule for unpacking is: * all product types (i.e. types with only one constructor) can be unpacked. This includes Int, Char, Double, etc and tuples or records their-of. * sum types (i.e. data types with more than one constructor) and polymorphic fields can't be unpacked. My back of the napkin memory estimates based on the assumption that nothing is being unpacked (and my very spotty understanding of Haskell data structures): Platform: 64 Bit Linux # Type (Sizeof type (occasionally a guess)) 3 * Int (8) 14 * Char (4) -- Text is some kind of bytestring but I'm guessing it can't be worse than the same number of Char? 12 * Float (4) 18 * sizeOf (ptr) (8) UTC: -- From what I can gather through :info in ghci 4 * (ptr) (8) 2 * Integer (16) -- Shouldn't be overly large, times are within 2012 All fields in a constructor are word aligned. This means that all primitive types take 8 bytes on a 64-bit platform, including Char and Float. You might find the following blog posts by me useful in computing the size of data structures: http://blog.johantibell.com/2011/06/memory-footprints-of-some-common-data.html http://blog.johantibell.com/2011/06/computing-size-of-hashmap.html http://blog.johantibell.com/2011/11/slides-from-my-guest-lecture-at.html Here's some more on the topic: http://stackoverflow.com/questions/3254758/memory-footprint-of-haskell-data-types http://stackoverflow.com/questions/657/how-to-find-out-ghcs-memory-representations-of-data-types I've written a small driver test program that just parses the CSV, finds the minimum value for a couple of the Float fields, and exits. In the process monitor the memory usage is 6.9G before the program exits. I've tried profiling with +RTS -hc but it ran for 3 hours without finishing, it normally finishes within 4 minutes. Anyone have any ideas for me? Things to try? Thanks, Andrew You could try to use a 32-bit GHC, which would use about half the memory. You're at the limit of the size of data that you can comfortably fit in memory on a normal desktop machine, so it might be time to consider a streaming approach. -- Johan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] High memory usage with 1.4 Million records?
Hi Cafe, I'm working on inspecting some data that I'm trying to represent as records in Haskell and seeing about twice the memory footprint than I was expecting. I've got roughly 1.4 million records in a CSV file (400M on disk) that I parse in using bytestring-csv. bytestring-csv returns a [[ByteString]] (wrapped in `type`s) which I then convert into a list of records that have the following structure: 3 Int 1 Text Length 3 1 Text Length 11 12 Float 1 UTCTime All fields are marked strict and have {-# UNPACK #-} pragmas (I'm guessing that doesn't do anything for non primitives). (Side note, is there a way to check if things are actually being unpacked?) My back of the napkin memory estimates based on the assumption that nothing is being unpacked (and my very spotty understanding of Haskell data structures): Platform: 64 Bit Linux # Type (Sizeof type (occasionally a guess)) 3 * Int (8) 14 * Char (4) -- Text is some kind of bytestring but I'm guessing it can't be worse than the same number of Char? 12 * Float (4) 18 * sizeOf (ptr) (8) UTC: -- From what I can gather through :info in ghci 4 * (ptr) (8) 2 * Integer (16) -- Shouldn't be overly large, times are within 2012 List: (Pointer to element and next cons cell) 1408113 * 8 * 2 = 2513G + 21.5M So even if the original bytestring file is being kept entirely in memory somehow that's not more than 3G. I've written a small driver test program that just parses the CSV, finds the minimum value for a couple of the Float fields, and exits. In the process monitor the memory usage is 6.9G before the program exits. I've tried profiling with +RTS -hc but it ran for 3 hours without finishing, it normally finishes within 4 minutes. Anyone have any ideas for me? Things to try? Thanks, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell source AST zipper with state
On Thu, May 3, 2012 at 2:22 AM, Niklas Broberg niklas.brob...@gmail.com wrote: On Thu, May 3, 2012 at 2:52 AM, Andrew Seniuk ras...@gmail.com wrote: Note that the Annotated version of the HSE parser/AST will probably not provide enough generality for the sorts of attributes you want to store... I do hope you're wrong on that! The annotations are fully general (and have been all along), so you can store whatever you like there(*). They are *used* for source locations by the parser, but that's just one possibility. (*) The only requirement is that you need to store values of the same type throughout the syntax tree - but Either or Maybe should do the trick there. Sorry Niklas! Thanks for the mild correction. (Wish I'd understood that when trying to compute the semilattice joins I needed.) Any recommendations for a zipper (or other traversal) library for use with HSE? Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell source AST zipper with state
On Wed, May 2, 2012 at 7:20 PM, Tony Morris tonymor...@gmail.com wrote: Is there a library to traverse a source AST keeping state? Hi Tony, I was able to do this [1] using haskell-src-exts and a state monad. AST traversal is possible due to HSE deriving instances for Data in all its datatype declarations, but the traversals were of a generic variety, rather than zippers. I read Scrap Your Zippers [2] and looked at various other generic zipper libs, but in the end I managed without zippers. Note that most zipper libs require instance declarations for all the syntax datatypes -- Scrap Your Zippers only requires the Data instances that HSE comes with, not sure why I was unable to use it, probably just inexperience. Note that the Annotated version of the HSE parser/AST will probably not provide enough generality for the sorts of attributes you want to store (it's for source locations, unless something changed in the most recent release). Best of luck, and I'll be interested to hear other responses! -Andrew [1] http://hackage.haskell.org/freesect (in particular FreeSect*.hs) [2] https://www.cs.indiana.edu/~adamsmd/papers/scrap_your_zippers/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal
First let me mention, there is now a complete modules tree with API links (in a very preliminary state), at http://fremissant.net/portackage/modules.php and the package view is still http://fremissant.net/portackage On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote: Great work! Thanks. Does it include only packages without executables ? Eg I see hledger-lib but not the hledger or gist packages. It would be nice to have all of hackage there. Simon, thank you. And, yes, as a temporary measure, I elided the packages that expose no modules, to try to tame the slowness a bit. I could provide them on a similar, separate page, until figure out some optimisations. Derek, if you're reading, sorry if I seemed defensive there before. :) Okay, this bagel is screaming Eat Me!!... Kind Reg'ds, Andrew On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote: Great work! Thanks. Does it include only packages without executables ? Eg I see hledger-lib but not the hledger or gist packages. It would be nice to have all of hackage there. Best - Simon ___ 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] [Haskell] ANN: Portackage - a hackage portal
...and the binary packages (those exposing no modules) are now up at http://fremissant.net/portackage/binary.php Not nice to have them in a separate table, but for now that's the case. :( So the three links in summary: module tree: http://fremissant.net/portackage/modules.php library packages: http://fremissant.net/portackage/binary.php other packages: http://fremissant.net/portackage/portackage.php On Mon, Apr 30, 2012 at 1:42 PM, Andrew Seniuk ras...@gmail.com wrote: First let me mention, there is now a complete modules tree with API links (in a very preliminary state), at http://fremissant.net/portackage/modules.php and the package view is still http://fremissant.net/portackage On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote: Great work! Thanks. Does it include only packages without executables ? Eg I see hledger-lib but not the hledger or gist packages. It would be nice to have all of hackage there. Simon, thank you. And, yes, as a temporary measure, I elided the packages that expose no modules, to try to tame the slowness a bit. I could provide them on a similar, separate page, until figure out some optimisations. Derek, if you're reading, sorry if I seemed defensive there before. :) Okay, this bagel is screaming Eat Me!!... Kind Reg'ds, Andrew On Mon, Apr 30, 2012 at 11:35 AM, Simon Michael si...@joyful.com wrote: Great work! Thanks. Does it include only packages without executables ? Eg I see hledger-lib but not the hledger or gist packages. It would be nice to have all of hackage there. Best - Simon ___ 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] [Haskell] ANN: Portackage - a hackage portal
Oops, the three links in summary are: module tree: http://fremissant.net/portackage/modules.php library packages: http://fremissant.net/portackage/portackage.php other packages: http://fremissant.net/portackage/binary.php ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal
On Apr 27, 2012 6:18 PM, Andrew Seniuk ras...@gmail.com wrote: Oh, the idea wasn't that you would make the app, but that by providing a web service interface you would make it easier for me or anyone else to make an app or other alternative interface. It would also reduce bandwidth usage over screen scraping. Yes, well as I mentioned in the part of my response you didn't quote, I agree it would be desireable, and am working on it, but my motivation was to provide people with something immediately useful. Once I get something reasonably efficient worked out, I'll look at uploading the Haskell code to Hackage, providing JSON data, etc.. Meanwhile if someone wanted to work on their own app or interface, it's not too hard to get CSV from the table. I made a mistake and the link was down for about 12 hours. It's back now, with a number of improvements and up-to-date hackage info. It is an expensive page to run, you may get Script not responding pop-ups depending on your hardware, but I think it's worth it. http://fremissant.net/portackage Kind Reg'ds, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal
Excuse the delay, I have no home internet. On Fri, Apr 27, 2012 at 1:16 AM, bri...@aracnet.com wrote: Great idea. Maybe the format can start as compactly as possible, i.e. 1 entry per line to make it easy to browse as many entries as possible in one page. It looks as though disabling just the dependencies would go a long way to accomplish that. Yep, and in fact the version I uploaded while reading your message has the deps column elided (and one or two others). Enforcing single-line rows is a but a few tweaks away. The thing is, the module namespace was the main motivator for this project, so I'm also seeing whether I can get away with a single view, package-oriented as presently, and still give good focus to the modules names. Soon I hope to include accordion views of the module namespace, with cookie-based (?) persistent state so user's collapse/expand tree state is preserved. I'd like to vote to make the synopsis to be the second column. will each column type have an enable/disable ? I like the idea (although that one wasn't in the upload). Hopefully when I explore the JavaScript UI tools a bit more, the columns (key structure) will be totally configurable by drag-and-drop, with columns sizable, and keys selected from a listbox. (?) stuff like that it's probably best if a click on a specific target, say the actual name of the package, sends you to the hackage entry instead of a click anywhere on the row. I find myself clicking on the page by accident and it sending me off to some random hackage entry. :) That's a feature! But seriously, you're right, and as a bonus the links can be specific to the columns (package - hackage, modules - API pages, homepages - hps, maintainer - sendto [1]). (A 2-finger or Mod- click anywhere on a row might still be nice, but a bare tap is admittedly way too accident prone with touch input.) I really like the idea - makes your hackage surfing much more enjoyable ! Brian And thank-you for sharing your thoughts! I'm committed to improving it, until the ideas run out. On Fri, Apr 27, 2012 at 4:12 AM, Christoph Breitkopf chbreitk...@googlemail.com wrote: this already looks great. So here's my wish-list, in case you have too much time on yours hands ;-) Thanks! Yes I suppose I do have too much time on my hands, but the pain of that is conterbalanced by all the excitement. Quality/popularity indicators (I'm aware that some of these are real work and better provided by hackage itself): - used by how many other packages (number of edges to that package in the dependency graph of all packages) - haddock coverage, test coverage, etc. - like, +1, whatnot button - link to issue tracker, if there is one If there's interest, this could become integrated with hackage at some point in the future. Next thing is to get a last upload field which can replace the version field. The codependency graph :) would be a nice metric to add, I'll look into it. I remember seeing a package that does this someplace on hackage. The +1 button is a good one! In short I'll try to implement all these ideas, thanks to you both for the encouraging comments. -Andrew [1] I omitted the maintainer column, thinking its inclusion might be harmful, making the emails so easy for a bot to collect. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal
Hi Derek, Thanks for your comments. Yes, I am probably going to focus on making it work as a web service and stay away from platform-specific mobile apps. Not been thinking mobile much at all, since the quantities of data are taxing even to my laptop, and also I'm inclined to believe people are mostly at a laptop or desktop when coding Haskell. However, I'm planning to try server-side sorting and filtering, and compare performance. No DB is used on the server yet, but it would be simple enough I suppose -- all this is quite new territory for me. Also my shared hosting resource limits may become a problem if this gets a lot of use. On the other hand, was planning to use persistence (cookies i guess?) to save the data on the client, so that patches based on Hackage RSS could be applied incrementally. Also, I think the sorting could be faster by sending per-column lists of indices. But maybe it is just the browser rendering which is taking all the time? I'll take this opportunity to announce a few improvements: - shift-click a row to see the Hackage page (bare click does nothing) - per-column filtering widgets Presently working on getting the last updated column, this information is not in a .cabal file but I'm hoping it is in the TAR metadata... The link again: http://www.fremissant.net/portackage A. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Portackage - a hackage portal
Hello, This is to announce a provisional webpage to summarise hackage.haskell.org. http://www.fremissant.net/portackage It is a lot of data, so will be a bit slow to load. Columns can be sorted by clicking the headers, but this will also take some seconds on a typical client. The initial sort is by module name. Clicking a table row links to the project page on hackage. Although I believe this is a complete list of all packages/modules in hackage, it is probably still buggy, so if you see anything amiss please let me know. Also, a subsequent version in the near future will update automatically based on the http://hackage.haskell.org/packages/archive/recent.rss RSS feed, but for now it's based on a recent snapshot. Haskell code which prepares the page will be released after a few more days testing and refinement. Some previous work [1] provided a list of all modules, but is not being maintained, and I was unable to rearouse the author's interest. Feature requests and suggestions are welcome! Kind Reg'ds, Andrew Seniuk [1] http://folk.ntnu.no/hammar/explore-hackage/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal
Jonathan, On Thu, Apr 26, 2012 at 4:13 PM, Jonathan Daugherty j...@galois.com wrote: Although I believe this is a complete list of all packages/modules in hackage, it is probably still buggy, so if you see anything amiss please let me know. It might not be showing the most recent releases of everything. As an example, it shows a much older version of my vty-ui library (1.0) and its metadata, instead of the latest version, 1.5. As a result the version, module list, description, homepage, etc., are not current. Thank-you, I'd realised this issue but forgot to address it. It is due to a false assumption on my part that the .cabal entries in the 00-index.tar file were in increasing version order. I'll address this problem today. Cheers, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] ANN: Portackage - a hackage portal
Should be fixed in that respect now, thanks again for pointing it out. On Thu, Apr 26, 2012 at 4:23 PM, Andrew Seniuk ras...@gmail.com wrote: Jonathan, On Thu, Apr 26, 2012 at 4:13 PM, Jonathan Daugherty j...@galois.com wrote: Although I believe this is a complete list of all packages/modules in hackage, it is probably still buggy, so if you see anything amiss please let me know. It might not be showing the most recent releases of everything. As an example, it shows a much older version of my vty-ui library (1.0) and its metadata, instead of the latest version, 1.5. As a result the version, module list, description, homepage, etc., are not current. Thank-you, I'd realised this issue but forgot to address it. It is due to a false assumption on my part that the .cabal entries in the 00-index.tar file were in increasing version order. I'll address this problem today. Cheers, Andrew ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Portackage - a hackage portal
Somewhat lighter, using summarised module lists. A more sophistocated UI with per-column filtering is in the works. I invite your comments. Andrew On Thu, Apr 26, 2012 at 4:05 PM, Andrew Seniuk ras...@gmail.com wrote: Hello, This is to announce a provisional webpage to summarise hackage.haskell.org. http://www.fremissant.net/portackage It is a lot of data, so will be a bit slow to load. Columns can be sorted by clicking the headers, but this will also take some seconds on a typical client. The initial sort is by module name. Clicking a table row links to the project page on hackage. Although I believe this is a complete list of all packages/modules in hackage, it is probably still buggy, so if you see anything amiss please let me know. Also, a subsequent version in the near future will update automatically based on the http://hackage.haskell.org/packages/archive/recent.rss RSS feed, but for now it's based on a recent snapshot. Haskell code which prepares the page will be released after a few more days testing and refinement. Some previous work [1] provided a list of all modules, but is not being maintained, and I was unable to rearouse the author's interest. Feature requests and suggestions are welcome! Kind Reg'ds, Andrew Seniuk [1] http://folk.ntnu.no/hammar/explore-hackage/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: graphviz-2999.13.0.0
Alright, thank-you Ivan. I'm not yet using any standard library for my graphs, although no doubt I should, and FGL sounds like the obvious choice. Just hoping for a tour de force example of the layout and visualisation possibilities, preferably some Haskell code in the public domain that was guaranteed to work with the current version of the graphviz library, and could be used by newcomers as a springboard. Probably I'm being lazy, and should just start from scratch from the API. Thanks again for your efforts! -Andrew On Thu, Apr 19, 2012 at 6:04 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 20 April 2012 03:21, Ras Far ras...@gmail.com wrote: Hello Ivan, Thanks for bringing Graphviz to Haskell, and for your continuing dedication to making it more complete! I just tried Graphvis for the first time a few days ago. I regretted the absence of example code, especially as the API has been evolving, so that examples on the Web do not generally work without change. I see that the inclusion of QuickStart-style documentation is on your short-term list of milestones. I suppose an example program is not quite that, but it might help. Do you have something along these lines? Or, if not, if I managed to put something together which exercises a good cross-section of the features, do you think you could include it with the next release? I suppose there's a trade-off between ease of maintaining the code through releases, and feature coverage of the example(s)... Well, one reason I haven't included anything like that is because I'm not sure what to write, or where to put it! If you're using FGL graphs, you probably want [graphToDot]; otherwise, [graphElemsToDot] might do what you want (for which I've written an [example], which is also linked to from the [FAQ]). [graphToDot]: http://hackage.haskell.org/packages/archive/graphviz/2999.13.0.1/doc/html/Data-GraphViz.html#v:graphToDot [graphElemsToDot]: http://hackage.haskell.org/packages/archive/graphviz/2999.13.0.1/doc/html/Data-GraphViz.html#v:graphElemsToDot [tutorial](http://ivanmiljenovic.wordpress.com/2011/10/16/graphviz-in-vacuum/) [FAQ]: http://projects.haskell.org/graphviz/faq.html -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com http://IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I Need a Better Functional Language!
On 5 Apr 2012, at 15:14, Grigory Sarnitskiy wrote: Hello! I've just realized that Haskell is no good for working with functions! Obviously, that's not all of the imaginable possibilities. One also can rewrite programs. And write programs that rewrite programs. And write programs that rewrite programs that rewrite the first programs and so on. But there is no such possibility in Haskell, except for introducing a DSL. So now I wonder, what are the languages that are functional in the sense above? With a reasonable syntax and semantics, thus no assembler. I guess Lisp might be of this kind, but I'm not sure. Probably - but the semantics is dreadful... Note, that the reflectivity is important. Intel developed a reflective functional language/system called Forte that is the basic of a lot of their formal hardware verification process... http://www.cs.ox.ac.uk/tom.melham/res/forte.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I Need a Better Functional Language!
Addendum: Intel's Forte was the framework, reFLect was the language : http://www.cs.ox.ac.uk/tom.melham/res/reflect.html Quoting that page: reFLect is a functional programming language designed and implemented by a team at Intel Corporation's Strategic CAD Labs under the direction of Jim Grundy. The language is strongly typed and similar to ML, but provides certain reflection features intended for applications in industrial hardware design and verification. Like LISP, reFLect has quotation and antiquotation constructs that may be used to construct and decompose expressions in the language itself. Unlike LISP, these mechanisms are typed. The language also provides a primitive mechanism for pattern-matching, and in particular for defining functions over code by pattern-matching on the structure of reFLect expressions. On 5 Apr 2012, at 15:14, Grigory Sarnitskiy wrote: Hello! I've just realized that Haskell is no good for working with functions! First, what are 'functions' we are interested at? It can't be the usual set-theoretic definition, since it is not constructive. The constructive definition should imply functions that can be constructed, computed. Thus these are computable functions that should be of our concern. But computable functions in essence are just a synonym for programs. One could expect from a language that bears 'functional' as its characteristic to be able to do everything imaginable with functions. However, the only thing Haskell can do with functions is to apply them to arguments and to feed them as arguments, run in parallel (run and concatenate programs). Obviously, that's not all of the imaginable possibilities. One also can rewrite programs. And write programs that rewrite programs. And write programs that rewrite programs that rewrite the first programs and so on. But there is no such possibility in Haskell, except for introducing a DSL. So now I wonder, what are the languages that are functional in the sense above? With a reasonable syntax and semantics, thus no assembler. I guess Lisp might be of this kind, but I'm not sure. In addition, I'm not a fan of parentheses. What else? Pure? Mathematica? Maxima? Note, that the reflectivity is important. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] interest in Irish Haskell User's Group?
Count me in ! (i've also CCed a colleague) On 24 Jan 2012, at 11:27, John Lato wrote: Hello, Some other Haskellers and I have been discussing starting an Irish Haskell User's Group. I think we're close to critical mass, and need just a few more interested people to give it a run. To that end, I'd appreciate hearing from anyone who would be interested in attending or participating. Our initial meeting would likely be in Maynooth as that's where we're based, however we'd like to see involvement across at least the greater Dublin area, and possibly further afield. So, please let me know if you're interested in participating. I'll post further details when we've established an initial meeting. Thanks, John L. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] black Wikipedia (Was: PhD program at Portland State accepting applications)
Just add ?banner=none to the url if you really have to read the page On 18 Jan 2012, at 17:37, Henning Thielemann wrote: On Wed, 18 Jan 2012, Nathan Collins wrote: - Portland is a very popular US city, known for beer, bikes, music, and street food: http://en.wikipedia.org/wiki/Portland_Oregon (wikipedia is blacked out today) Maybe it is only a JavaScript trick. In Firefox (with JavaScript) I see the complete a page before it is overwritten by the protest page. In Konqueror of KDE 3 (with and without JavaScript) I can read the Wiki pages without problems. Edit however is really disabled. Sometimes I am glad to have the old technology available. :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] STM: nested atomically error
On 12/01/2012 12:48 PM, Johan Brinch wrote: I'm not using any unsafe IO OK, good... (only for debug printing) ...ah. It seems we have reached a contradiction. Where is a transaction being nested? My guess is that your debug printing is causing something to be evaluated when it otherwise wouldn't be, causing a transaction to begin within a transaction. I could, however, be horribly wrong about that... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Windows: openFile gives permission denied when file in use
Every time I hear oh, I don't think Windows can handle that, I sigh with resignation. Sorry to say, but it seems you yourself are unaware of the extensive and highly flexible locking facilities on Linux :) The defaults on Linux are advisory locking, not mandatory, but claiming Linux doesn't support locking is plain wrong. I would suggest that advisory locking isn't particularly useful. I gather that Linux does now support real locking though. (And file update notifications, and ACLs, and lots of other things that Windows has had for far longer.) Either way, I have no interest in starting a Windows vs Linux flamewar. I'm just saying it would be nice if Haskell could support more of what these two OSes have to offer. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Windows: openFile gives permission denied when file in use
I gather that Linux does now support real locking though. (And file update notifications, and ACLs, and lots of other things that Windows has had for far longer.) Hrmm: Mandatory File Locking For The Linux Operating System, 15 April 1996 :) Have a reference for when it was actually implemented? I tried to look this up, and got this: http://0pointer.de/blog/projects/locking.html Sounds like it's not so solved after all. (Or perhaps the author just doesn't know enough about it, it's hard to say...) The Wikipedia page on file locking also points out a list of Unix-related locking problems. (But again, that might just be editor bias.) I'm just saying it would be nice if Haskell could support more of what these two OSes have to offer. Totally agreed! Good, that was my main point. Now, who's volunteering to implement all this? :-} ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Windows: openFile gives permission denied when file in use
On 29/12/2011 04:29 AM, Antoine Latter wrote: On Wed, Dec 28, 2011 at 3:52 PM, Michael Snoymanmich...@snoyman.com wrote: Hi all, I just received a bug report from a client that, when an input file is open in FrameMaker, my program gives a permission denied error. This bug is reproducible with a simple Haskell program: This bug and its discussion is similar, but not identical: http://hackage.haskell.org/trac/ghc/ticket/4363 This one has been rumbling on for ages. As others have said, the Report demands that locking occur, which is probably a mistake. The daft thing is, apparently Linux doesn't really support locking, so on that platform these types of thing all work fine, and only on Windows, which does and always has supported propper locking, people get these errors. And yet, many people seem surprised to hear that Windows can actually turn off the locking; they seem completely unaware of the extensive and highly flexible locking facilities that Windows provides. Every time I hear oh, I don't think Windows can handle that, I sigh with resignation. Whatever we change the default to, it would be useful if we could expose locking mechanisms in a reasonably portable way so that people who care about such things can alter the default if it is not what they want. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?
On 19/12/2011 07:20 PM, Robert Clausecker wrote: Image you would create your own language with a paradigm similar to Haskell or have to chance to change Haskell without the need to keep any compatibility. What stuff would you add to your language, what stuff would you remove and what problems would you solve completely different? 1. Remove special treatment for lists. That is, remove the standard list type from the Prelude and make it into just another container library. The type is trivially definable; it doesn't need to be hard-wired into the language. I would name it List rather than [] too, and give its constructors sensible names rather than : and []. I would also make the current literal list syntax overloaded, so it can be used to construct any type of container. (Much the way numeric literals are overloaded.) 2. Add special treatment for arrays. That is, have strict, unboxed arrays hard-wired into the language. For every user type, not just ones which are members of a special type. Fully parametric. You know, like how they are in almost every other programming language known to Man, except Haskell. Also, the base array library would have zero-based integer indicies, and if you want arbitrary index values, that would be a library on top. Also, primitives for fast copying of array chunks. 3. Fix the Typeclassopedia. By which I mean things like removing fail from Monad, making Applicative a superclass of Monad, etc. You know, the usual stuff everybody complains about for being horribly broken. 4. Do something sane with the numerical classes. Unfortunately, this one is a Hard Problem. I doubt you can solve this without rampant language changes. But it should be possible to /improve/ on what exists currently. 5. Miscelaneous consistency changes. Haskell has a number of minor glitches which are irritating though not catastrophic. Things like type signatures being allowed in expressions but not patterns. Value constructors can be operators, but type constructors cannot. Negation is the only unary operator. And so forth. Nothing radical here. 6. Experimental stuff. I have a number of other, more radical ideas, but I probably wouldn't put those in, because the resulting language would be so drastically different that it wouldn't be Haskell any more. (That said, most of the stuff above would pretty much be hard breaking changes...) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?
On 21/12/2011 10:09 AM, Jesse Schalken wrote: IIRC, Scite's default configuration is with non-monospace font. I actually found it quite appealing, and in fact forgot about it entirely after some usage. It is much easier on the eyes to read. The difference is really whether you care about aligning things mid-line or not, not to mention editor support (i.e. not Vim or other terminal-based editor). SciTE's default binding /is/ proportional, not mono-space. I find it ever so irritating. Then again, I'm sure this one comes squarely down to personal preference, so it seems pointless to debate it. LaTeX offers the possibility of mid-line alignment even if you don't use monospace - a feature which I haven't seen in any other text processing system. It's a pitty this isn't more widespread... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] If you'd design a Haskell-like language, what would you do different?
On Tue, 2011-12-20 at 16:53 -0500, Matthew Farkas-Dyck wrote: Two of three ain't bad (^_~) Now we just need λ to replace \, → to replace -, and ≠ to replace /= (which still looks like division assignment no matter how hard I squint my eyes. 25 years of C and C derived languages is hard to forget). Hey, forget replacing, wouldn't it be wonderful if the compiler would just accept them as synonyms? AfC Sydney ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What happens if you get hit by a bus?
On 16/12/2011 07:05 PM, Bardur Arantsson wrote: Michael Litchard wrote: [--snip--] If getting hit by a bus is a significant factor in the overall outcome of the project then I think those are pretty good odds, aren't they? (I do realize that traffic accidents are a lot more frequent than we like to think, but still...) The /actual/ probability of being hit by a bus is irrelevant. The only thing of concequence is the /percieved/ probability. This latter quantity is not related to the former in any meaningful way. In fact, due to an effect known as availability bias, the probability of any potential threat varies depending on how long you spend thinking about it. (In other words, if you've never even considered what would happen if your sole developer got hit by a bus, your estimate of the probability of this will be very low. If you sit down and think about how much trouble you'd be in if this actually happened, suddenly your estimate of the probability starts increasing. This is completely illogical - which is why it's called a cognitive bias.) Ever heard the phrase fear, uncertainty and doubt? It's a killer in a business context. It seems clear [to me] that there are actually quite a few Haskell programmers around, and it's not especially hard to find them. The question is how many good ones there are. Good is all vague and subjective and hard to measure, unfortunately. On the other hand, if you just start the project with more than one developer on board in the first place, then the possibility of just one of them being killed prematurely becomes drastically less serious. (For the business. I'm sure it's still fairly serious for the person who just DIED...) PS. Kudos to Ketil Malde for the best link I've seen today. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Program used for debugging
On 1 Dec 2011, at 14:10, Yves Parès wrote: Hey, What do you mostly use for debugging? Simple calls to Debug.Trace.trace? Hpc? Hood? Debug.Trace, with some short helpers so dbg x= x displays the value of x, provided x is in Show import Debug.Trace dbg msg x = dbgsh show msg x dbgsh sh msg x = trace (msg++sh x) x cdbg p msg x | p x= dbg msg x | otherwise = x -- if you want to tailor the show: class Dshow t where dshow :: t - String ddbg msg x = dbgsh dshow msg x ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] XML modification
Hi guys. I've got a folder with about 80 XML files in it. I want to take each file and make specific modifications to it. (Mostly just finding specific attributes and changing their values to make then all consistent.) Now I guess it wouldn't take me /that/ long to code something from scratch. But does anybody have a better suggestion for tools or libraries that might be useful? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] XML modification
On 23/11/2011 10:14 AM, Jon Fairbairn wrote: Andrew Coppinandrewcop...@btinternet.com writes: I've got a folder with about 80 XML files in it. I want to take each file and make specific modifications to it. HaXml Mmm. That looks very promising... which gives some idea of the flavour. OK. So it looks like processXmlWith is the function I want, if I'm going to read one file and create another from it. So now I just need to figure out which combinators I need. (The documentation seems a bit thin.) Can you show me a snippet for how I would find [one] element named foo and change its bar attribute to have the value 5? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] XML modification
On 23/11/2011 12:58 PM, Andrew Coppin wrote: On 23/11/2011 10:14 AM, Jon Fairbairn wrote: HaXml Mmm. That looks very promising... which gives some idea of the flavour. OK. So it looks like processXmlWith is the function I want, if I'm going to read one file and create another from it. So now I just need to figure out which combinators I need. (The documentation seems a bit thin.) Can you show me a snippet for how I would find [one] element named foo and change its bar attribute to have the value 5? Well, from what I've been able to gather, HaXml has a really nice filter combinator library. However... Weird thing #1: processXmlWith handles the common case of loading a file from disk, filtering it, and saving the result to disk again. However, it does this based on CLI arguments. There is no function anywhere that I can find which allows the host program to specify what files to process. If you want to do that, you have to reimplement most of the body of this function all over again yourself. That seems a strange omission. Weird thing #2: There are absolutely no filters for dealing with attributes. I couldn't find anything anywhere that says apply this function to all the attributes of this element. I can find a function to /replace/ an element's attributes without regard to what existed before. But even something as trivial as adding an additional attribute while keeping the existing ones doesn't appear to be supported at all. Fortunately it turns out to not be especially hard to read the source for the replace-attributes function and change it to do what I want. But, again, it seems a rather large and obvious ommission. (I'm guessing that since attributes are key/value pairs and not content, you would need a seperate attribute filter type, which is different from the existing content filters. Even so, it shouldn't be /that/ hard to do...) Anyway, the important thing is, Haskell (and more specifically HaXml) let me accomplish the task I wanted without too much fuss. It's /certainly/ faster than editing 80 files by hand in a text editor! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A Mascot
On 16/11/2011 04:50 AM, heathmatlock wrote: On Tue, Nov 15, 2011 at 10:18 PM, John Meacham j...@repetae.net mailto:j...@repetae.net wrote: People tend to concentrate on the lambda which cooresponds to the functional aspect of haskell when designing logos. Not nearly enough attention is paid to the other striking feature, the laziness. The 'bottom' symbol _|_ should feature prominently. The two most defining features of haskell are that it is purely functional and _|_ inhabits every type. The combination of which is very powerful. John I would have to think about this a bit longer, but here's the symbol reworked onto the helmet: http://i.imgur.com/ZziGQ.png If you're going to draw a piece of graphics, why use ASCII workarounds like _|_, when you can use the real thing (i.e., ⊥)? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A Mascot
On 16 Nov 2011, at 08:46, Ertugrul Soeylemez wrote: But I think, despite the well-founded denotational semantics of Haskell, bottom does not play that much of a role. There is one? Where? Last time I looked (a while ago, admittedly) there was no denotational (or any formal) semantics for Haskell. - lots of stuff for fragments of Haskell-like languages or parts of Haskell, but not a full proper definitive semantics for *Haskell*, as found in the wild... Looking at http://en.wikibooks.org/wiki/Haskell/Denotational_semantics the first footnote states In fact, there are no written down and complete denotational semantics of Haskell. This would be a tedious task void of additional insight and we happily embrace the folklore and common sense semantics. However, if you have a proof-based tool used for reasoning about Haskell programs in a safety-critical environment, you might just need to do this tedious task, particularly in order to show your proof rules sound. - has anyone in that area done this? is it available ? Is there a definitive Operational Semantics? Axiomatic? PS - I love the mascot - thanks Heath ! Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife = sex) http://ertes.de/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204 Lero@TCD, Head of Foundations Methods Research Group Director of Teaching and Learning - Undergraduate, School of Computer Science and Statistics, Room G.39, O'Reilly Institute, Trinity College, University of Dublin http://www.scss.tcd.ie/Andrew.Butterfield/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to represent such polymorphism?
On 04/10/2011 07:08 AM, Dominique Devriese wrote: All, In case anyone is interested, I just want to point out an interesting article about the relation between Haskell type classes and C++ (overloading + concepts): http://sms.cs.chalmers.se/publications/papers/2008-WGP.pdf Dominique Thanks for that. A very interesting read... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to represent such polymorphism?
On 02/10/2011 02:04 PM, Du Xi wrote: --It still didn't compile. I think the reason is that the following is disallowed: f::a-b f x = x The type a - b doesn't mean what you think it does. It does /not/ mean that f is allowed to return any type it wants to. It means that f must be prepaired to return any type that /the caller/ wants it to. So, given ANY POSSIBLE INPUT, the function must be able to construct a value of ANY POSSIBLE TYPE. This is, of course, impossible. The only way you can implement a function with this type signature is to cheat. Also, you can't just take x, which has type a, and then pretend that it has type b instead. Haskell doesn't work like that. Your type signature says that the result type can be different than the input type, but your function definition forces the result to always be /the same/ type as the input. Hence, it is rejected. That aside, the fundamental problem here is that each tuple type is a different, completely unrelated type, as far as the type system is concerned. (x,y) and (x,y,z) might look similar to you, but to the type system they're as similar as, say, Either x y and StateT x y z. In Haskell, the only way to get a function to work for several unrelated types (but not /every/ possible type) is to use classes. Depending on exactly what you're trying to do, you might be better using lists, or perhaps some custom data type. It depends what you want to do. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is it possible to represent such polymorphism?
On 02/10/2011 07:15 PM, Du Xi wrote: I guess this is what I want, thank you all. Although I still wonder why something so simple in C++ is actually more verbose and requires less known features in Haskell...What was the design intent to disallow simple overloading? In C++, the code is inferred from the types. (I.e., if a function is overloaded, the correct implementation is selected depending on the types of the arguments.) In Haskell, the types are inferred from the code. (Which is why type signatures are optional.) Really, it's just approaching the same problem from a different direction. Also, as others have said, you're probably just approaching the problem from the wrong angle. You don't design an object-oriented program the same way you'd design a procedural program; if you do, you end up with a horrible design. Similarly, you don't design a functional program the same way you would design an object-oriented one. It takes time (and experience) to figure out how to approach FP - or any other radically different paradigm, I suppose... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data.IArray rant
It's rather that some considered the IArray API to be inadequate most of the time. Really, H98 arrays aren't very good at anything they do. For collective operations, you are supposed to convert the array to a list, work on the list and then convert it back to an array which just seems wrong. I am unconvinded that this is any more wrong than using a for loop in an imperative language. Remember that the lists are lazy, so it’s misleading to say “convert the array to a list” since what happens most of the time is that elements are taken out of the array and passed to the processing function and then thrown away before the next element is processed. You're still needlessly allocating and then garbage collecting memory though. My personal feeling is that Haskell programmers use lists a lot when what they really want are streams (in the sense of the stream-fusion library). I don't want you to actually *make* a physical list, I just want to abstract over something that sequentially generates data. But then, lists are in the standard Prelude, and hard-wired into the language syntax. Streams aren't exposed by any moderately standard library. Even the stream-fusion library treats streams as a sort of under the covers thing to deforest lists. My humble opinion is that half the time when people create physical lists, what they really mean is a data pipeline that doesn't need to physically materialise at all. But anyway... Haskell '98 arrays may have fancy indexing, but I've always wished that there had been a plain ordinary integer-indexed array construct, with the fancy indexing implemented on top of that, so your use of fancy indexing is /optional/. I get the distinct impression that the default array libraries are so barren just because nobody really used them much, and that was then and this is now, and it's a major pain to break something that so much code is written against... I just hope we don't end up with a bazillion different array implementations popping up. But we'll see. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Off-topic: Mathematics
On 30/08/2011 09:49 PM, Jerzy Karczmarczuk wrote: Knuth admitted that he had learnt a lot while teaching things he already knew. So did Feynman. And Landau. As counter-intuitive as it may seem, explaining something to somebody else forces you to order your thoughts and think through the knowledge you already have, so that you can present it to somebody else in something resembling a coherant form. It's not unusual for this process to clarify your own knowledge. At least, that's *my* excuse for constantly talking to myself... _ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Off-topic: Mathematics and modesty
On 30/08/2011 07:58 PM, Jerzy Karczmarczuk wrote: I think I know several mathematicians who learning that a person asking for help begins with trying to distinguish between knowledgeable, and those who just think they are, will simply - to say it politely - refuse to engage. I didn't intend to sound snobbish. It's just that there are people who will have read about XYZ in a book one time, and there are people who actually use XYZ every day of their working lives. The latter probably know a tad more about it. That's all. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Off-topic: Mathematics
On 29/08/2011 01:13 PM, Christopher Done wrote: There's also #math on freenode, but it's a scary wilderness. On 29 August 2011 13:34, Benedict Eastaughionf...@gmail.com wrote: On 29 August 2011 09:34, Andrew Coppinandrewcop...@btinternet.com wrote: This is fairly wildly off-topic but... does anybody know of a good forum where I can ask questions about mathematics and get authoritative answers? Apart from math.stackexchange.com and mathoverflow.net, which people have already mentioned, people often discuss mathematics on #haskell-blah on Freenode. I know of several places where I can ask maths questions and half a dozen people will take guesses at what the correct solution might be. I haven't yet found anywhere where I can say when would a chi-squared test be more appropriate than a KS test? and get an informed, knowledgeable answer. (Answers from people who /know/ what they're talking about rather than just /think/ they know.) Anyway, from this thread I've got the names of a few places to start looking. And that's really what I was hoping for. Thanks for the tips. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
I meant if you're trying to *implement* serialisation. The Bits class allows you to access bits one by one, but surely you'd want some way to know how many bits you need to keep? I think that falls into the realm of protocol design; if you're doing it in your program at runtime, you're probably doing it wrong. (The fixed size version makes sense for marshaling; it's *dynamic* sizes that need to be thought out beforehand.) If you're doing, say, cryptography, then thousand-bit random integers that need to be serialised are fairly common... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On 29/08/2011 09:00 AM, Brandon Allbery wrote: On Mon, Aug 29, 2011 at 03:40, Andrew Coppin andrewcop...@btinternet.com mailto:andrewcop...@btinternet.com wrote: I meant if you're trying to *implement* serialisation. The Bits class allows you to access bits one by one, but surely you'd want some way to know how many bits you need to keep? I think that falls into the realm of protocol design; if you're doing it in your program at runtime, you're probably doing it wrong. (The fixed size version makes sense for marshaling; it's *dynamic* sizes that need to be thought out beforehand.) If you're doing, say, cryptography, then thousand-bit random integers that need to be serialised are fairly common... Sure, and there are encodings that let you do this without needing bitSize (BER). You need a word count, but that's usually part of the structure holding the integer. OK. But since there's no way of getting a byte count for an Integer either... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Off-topic: Mathematics
This is fairly wildly off-topic but... does anybody know of a good forum where I can ask questions about mathematics and get authoritative answers? (Apart from go visit the nearest university, that is.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On 26/08/2011 10:51 PM, Steve Schafer wrote: On Fri, 26 Aug 2011 20:30:02 +0100, you wrote: You wouldn't want to know how many bits you need to store on disk to reliably recreate the value? I can't say that I have cared about that sort of thing in a very long time. Bits are rather cheap these days. I store data on disk, and the space it occupies is whatever it is; I don't worry about it. I meant if you're trying to *implement* serialisation. The Bits class allows you to access bits one by one, but surely you'd want some way to know how many bits you need to keep? Likewise, you say the standard PRNG can be used to generate random Integers, but what if you're trying to implement a new PRNG? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On 26/08/2011 02:40 AM, Daniel Peebles wrote: And as Daniel mentioned earlier, it's not at all obvious what we mean by bits used when it comes to negative numbers. I guess part of the problem is that the documentation asserts that bitSize will never depend on its argument. (So would will write things like bitSize undefined :: ThreadID or similar.) I can think of several possible results one might want from a bit size query: 1. The number of bits of precision which will be kept for values of this type. (For Word16, this is 16. For Integer, this is [almost] infinity.) 2. The amount of RAM that this value is using up. (But that would surely be measured in bytes, not bits. And processor registors make the picture more complicated.) 3. The bit count to the most significant bit, ignoring sign. 4. The bit count to the sign bit. Currently, bitSize implements #1. I'm not especially interested in #2. I would usually want #3 or #4. Consider the case of 123 (decimal). The 2s complement representation of +123 is ...000011 The 2s complement representation of -123 is ...111101 For query #3, I would expect both +123 and -123 to yield 7. For query #4, I would expect both to yield 8. (Since if you truncate both of those strings to 8 bits, then the positive value starts with 0, and the negative one start with 1.) Then of course, there's the difference between count of the bits and bit index, which one might expect to be zero-based. (So that the Nth bit represents 2^N.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] bitSize
On 26/08/2011 07:36 PM, Steve Schafer wrote: On Fri, 26 Aug 2011 18:24:37 +0100, you wrote: I would usually want #3 or #4. Out of curiosity, what for? While I do occasionally need to get a logarithmic size estimate of a number (which is basically what #3 and #4 are), the specific requirements in each case tend to vary, enough so that it's unlikely that a single function (other than simply taking the logarithm) can handle the majority of applications. You wouldn't want to know how many bits you need to store on disk to reliably recreate the value? Or how many bits of randomness you need to compute a value less than or equal to this one? I suppose I could use a binary logarithm. I'm just concerned that it would be rather slow. After all, I'm not interested in the exact logarithm (which is fractional), just the number of bits (which is a small integer)... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] do-re-mi
On 25/08/2011 02:59 AM, Albert Y. C. Lai wrote: do, a block, a monad block rec, a knot tied in the block mu, a name that calls itself (mu is pronounced as me in modern Greek) forM_, a long long list to run SO, a state aborting threads (SO is stack overflow) la, a state to follow SO T's, tranformers of monads that will bring us back to do That's genius! :-D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] bitSize
Quoting the Haddock documentation for Data.Bits.bitSize: Return the number of bits in the type of the argument. The actual value of the argument is ignored. The function bitSize is undefined for types that do not have a fixed bitsize, like Integer. Does anybody else think it would be *far* more useful if bitSize applied to an Integer would tell you how many bits that particular Integer is using? Especially given that it can vary? Is there a way to actually determine how many bits are in an Integer? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Performance of concurrent array access
On 23/08/2011 09:04 PM, Andreas Voellmy wrote: I compiled this with ghc --make -rtsopts -threaded -fforce-recomp -O2 DirectTableTest.hs. Running time ./DirectTableTest 1 +RTS -N1 takes about 1.4 seconds and running time ./DirectTableTest 2 +RTS -N2 take about 2.0 seconds! I found that changing the array type used in the implementation of DirectAddressTable from IOArray to IOUArray fixes this problem. With this change, the running time of time ./DirectTableTest 1 +RTS -N1 is takes about 1.4 seconds whereas the running time ./DirectTableTest 2 +RTS -N2 is about 1.0 seconds. Increasing to 4 cores gives a run time of 0.55 seconds. Finally, I tried one more variation. Instead of having the threads work on the same shared array, I had each thread work on its own array. This scales nicely (as you would expect), more or less like the second program, with either IOArray or IOUArray implementing the DirectAddressTable data structure. I understand why IOUArray might perform better than IOArray, but I don't know why it scales better to multiple threads and cores. Does anyone know why this might be happening or what I can do to find out what is going on? I haven't deeply studied your code. However, I'm going to take a guess this has to do with strictness. By using an IOArray, you're probably filling each cell with a reference to drop 7 cyclicChars or similar, which then only gets evaluated (in one thread) when you call print. By using an IOUArray, you're definitely forcing each character to be computed right away, by the thread doing the writing. That's /probably/ what the difference is. As a guess. (Not sure how you can easily prove/disprove the theory though.) You don't say which GHC version, but AFAIK recent releases of GHC have a seperate heap per thread (or was it per capability?), which probably makes a difference if you start giving each thread its own array. That and just plain ordinary cache coherance issues... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Invitation to connect on LinkedIn
LinkedIn I'd like to add you to my professional network on LinkedIn. - Andrew Andrew Smith B.Sc(Hons),MBA Founder and CEO at VTRL - Value Technology Research Ltd Edinburgh, United Kingdom Confirm that you know Andrew Smith B.Sc(Hons),MBA https://www.linkedin.com/e/uc6lxc-grc8ge3y-3d/isd/3853824536/atjCCKYr/ -- (c) 2011, LinkedIn Corporation___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe