Re: [Haskell-cafe] needsaname :: ([a] - Maybe (b, [a])) - (b - [a]) - [a] - [a]

2007-07-06 Thread Donald Bruce Stewart
felipe.lessa: I've written it to run over lists, but it would not be difficult to make it run over ByteStrings instead, and exploit the 'no-copying' effect on the bits of the stream which were not modified, which would be very handy for programs processing large bytestrings. I wonder if

Re: [Haskell-cafe] A very edgy language (was: A very nontrivial parser)

2007-07-06 Thread Donald Bruce Stewart
trebla: Andrew Coppin wrote: Personally, I just try to avoid *all* language extensions - mainly because most of them are utterly incomprehensible. (But then, perhaps that's just because they all cover extremely rare edge cases?) Haskell is an extremely rare edge case to begin with.

Re: [Haskell-cafe] A very edgy language

2007-07-06 Thread Donald Bruce Stewart
trebla: Donald Bruce Stewart wrote: Give #haskell is a far larger community than: #lisp #erlang #scheme #ocaml As well as #java #javascript #ruby #lua #d #perl6 Maybe we need to reconsider where the (FP) mainstream is now? :-) I

[Haskell-cafe] Write a library today! Was: Binary serialization, was Re: Abstraction leakAKa

2007-07-05 Thread Donald Bruce Stewart
drtomc: I was explaining Haskell to a perl/python hacking friend recently and characterized things thus: Perl is a horrible language with fantastic libraries. Haskell is a fantastic language with horrible libraries. Actually, many of the libraries that exist for Haskell *are* fantastic,

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-05 Thread Donald Bruce Stewart
p.f.moore: On 05/07/07, Jonathan Cast [EMAIL PROTECTED] wrote: Can't say I agree. I've been learning Python, and have been very un-impressed so far with its library coverage, which I would rate no better than (in terms of the POSIX bindings, worse than) Haskell. It probably depends on

Re: [Haskell-cafe] interrupting an accept()ing thread

2007-07-05 Thread Donald Bruce Stewart
drtomc: On 7/6/07, Lukas Mai [EMAIL PROTECTED] wrote: Hello, cafe! Have you been reading my mind? See the other recent Cafe thread (um, titled something about System.Exit). Here's my solution: ... If you've got small examples illustrating how to use the various concurrency abstractions,

Re: [Haskell-cafe] A very nontrivial parser

2007-07-05 Thread Donald Bruce Stewart
andrewcoppin: Jonathan Cast wrote: On Thursday 05 July 2007, Andrew Coppin wrote: ...OK, anybody have a solution that works in Haskell 98? Rank-2 types are perhaps /the/ most common, widely accepted extension to Haskell 98, after the approved addendum for FFI and the draft

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Donald Bruce Stewart
phil: On Sun, Jul 01, 2007 at 06:07:13PM +0100, Andrew Coppin wrote: I haven't actually tried, but presumably a TCP connection is represented in the same way as a file, and so has the same problems. Basically doing binary I/O seems to be one of those things that in Haskell falls into the

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Donald Bruce Stewart
drtomc: Anyone trying to do any of this? I've done some work in this area. I'm particularly interested in manipulating ASN.1 in haskell. Actually, my first use of Parsec was an ASN.1 parser. I'd done one previously in Spirit (the Boost C++ rip-off of parsec), but semantic actions were

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Donald Bruce Stewart
phil: On Wed, Jul 04, 2007 at 09:02:15PM +1000, Donald Bruce Stewart wrote: phil: On Sun, Jul 01, 2007 at 06:07:13PM +0100, Andrew Coppin wrote: I haven't actually tried, but presumably a TCP connection is represented in the same way as a file, and so has the same problems. Basically

Re: [Haskell-cafe] Binary serialization, was Re: Abstraction leak

2007-07-04 Thread Donald Bruce Stewart
phil: On Wed, Jul 04, 2007 at 09:44:13PM +1000, Donald Bruce Stewart wrote: Binary instances are pretty easy to write. For a simple data type: instance Binary Exp where put (IntE i) = do put (0 :: Word8) put i

Re: [Haskell-cafe] folds with escapes

2007-07-04 Thread Donald Bruce Stewart
dm.maillists: On Thursday 05 July 2007 11:20, Michael Vanier wrote: Again, I'm sure this has been done before (and no doubt better); I'd appreciate any pointers to previous work along these lines. Takusen is, if I recall correctly, based around a generalised fold supporting accumulation

Re: [Haskell-cafe] Re: Abstraction leak

2007-07-04 Thread Donald Bruce Stewart
drtomc: On 7/4/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: Can we do a cheap bytestring binding to libxml, to avoid any initial String processing? For my part, it's not too big an issue. A version of HaXml or at least Parsec built on top of ByteString would be a good start. I know

Re: [Haskell-cafe] sha1 implementation thats only 12 times slower then C

2007-07-03 Thread Donald Bruce Stewart
aeyakovenko: inlining some of the functions definitely gave me a boost, so i am about 8.5 times slower then openssl sha1sum. I dont really understand the core output, but after inlining i got a completely different profile output, i am guessing its because the cost of the inlined functions

[Haskell-cafe] Organising teams for ICFP 2007

2007-06-30 Thread Donald Bruce Stewart
Interested in competing in the ICFP 2007 programming contest -- the hackers contest of choice! http://www.icfpcontest.org There's 2000 people on this mailing list, and 350 people in #haskell, we must be able to put together a few decent teams out of that talent pool To help people get

Re: [Haskell-cafe] sha1 implementation thats only 12 times slower then C

2007-06-30 Thread Donald Bruce Stewart
aeyakovenko: So I tried implementing a more efficient sha1 in haskell, and i got to about 12 times slower as C. The darcs implementation is also around 10 to 12 times slower, and the crypto one is about 450 times slower. I haven't yet unrolled the loop like the darcs implementation does, so

Re: [Haskell-cafe] ANN: newports.hs utility for freebsd

2007-06-29 Thread Donald Bruce Stewart
clawsie: i have written a small haskell program to solve a problem many users of freebsd may have - knowing what ports have been updated after a daily/weekly etc cvsup. this is a trivial bit of coding hardly worth attention, but if it might be of use to you, you can find it here:

Re: [Haskell-cafe] ANNOUNCE: hiccup, a toy tcl impersonator in haskell

2007-06-29 Thread Donald Bruce Stewart
consalus: A while back I saw a toy tcl interpreter in 550 lines of C called 'picol'. I was looking for a simple language to implement in haskell, so I made my own toy tcl interpreter. It was surprisingly easy to make, thanks to the magic of Haskell and Bytestrings. :) It handles a few things

Re: [Haskell-cafe] Preferred way to get data from a socket

2007-06-27 Thread Donald Bruce Stewart
bulat.ziganshin: Hello Donald, Wednesday, June 27, 2007, 6:37:07 AM, you wrote: I also know Bulat Ziganshin had put together a nice-looking Streams library (http://unix.freshmeat.net/projects/streams/) based on John Goerzen's previous HVIO work, but I wasn't sure if the ByteString

Re: [Haskell-cafe] ANN: Scripting.Lua 0.1

2007-06-26 Thread Donald Bruce Stewart
gracjanpolak: Hi all, I'm pleased to announce the first public release of Scripting.Lua. The package hslua-0.1 contains Haskell FFI bindings for a Lua interpreter along with some Haskell utility functions simplifying Haskell to Lua and Lua to Haskell calls. Full Lua interpreter is

Re: [Haskell-cafe] Preferred way to get data from a socket

2007-06-26 Thread Donald Bruce Stewart
chad.scherrer: I've never used sockets before, but I need to now, and I need to be able to get a lot of data quickly. I was thinking about doing something like this (below), but I'm wondering if there's a way that would be faster. Is the obvious way of doing this the right way? I'm happy to

Re: [Haskell-cafe] loading an Haskell symbol at run-time

2007-06-26 Thread Donald Bruce Stewart
tittoassini: Hi, to load an Haskell symbol at run-time is still necessary to use the load functions from the hs-plugins library (System.Plugins.Load) or is there some function in the GHC API that does the same job? yes, definitely possible. i think Lemmih put an example on the wiki a

Re: [Haskell-cafe] Preferred way to get data from a socket

2007-06-26 Thread Donald Bruce Stewart
chad.scherrer: Ok, cool. FWIW, the current documentation for Network says: For really fast I/O, it might be worth looking at the hGetBuf and hPutBuf family of functions in System.IO. But this looked pretty low-level to me, and I figured it might be outdated. I also know Bulat Ziganshin

Re: [Haskell-cafe] Wikipedia archiving bot - code review

2007-06-25 Thread Donald Bruce Stewart
gwern0: Hey everyone. So I've been learning Haskell for a while now, and I've found the best way to move from theory to practice is to just write something useful for yourself. Now, I'm keen on editing Wikipedia and I've long wanted some way to stop links to external websites from breaking on

Re: [Haskell-cafe] Parallel + exceptions

2007-06-24 Thread Donald Bruce Stewart
andrewcoppin: Bulat Ziganshin wrote: Hello Andrew, definitive reading: Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell http://research.microsoft.com/Users/simonpj/papers/marktoberdorf/marktoberdorf.ps.gz I've read

Re: [Haskell-cafe] Need for speed: the Burrows-Wheeler Transform

2007-06-23 Thread Donald Bruce Stewart
...OK...so how do I make Haskell go faster still? Presumably by transforming the code into an ugly mess that nobody can read any more...? http://haskell.org/haskellwiki/Performance -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Compile-time here document facility

2007-06-22 Thread Donald Bruce Stewart
bayer: I couldn't find a compile-time here document facility, so I wrote one using Template Haskell: Very nice! You should wrap it in a little .cabal file, and upload it to hackage.haskell.org, so we don't forget about it. Details on cabalising and uploading here:

Re: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-22 Thread Donald Bruce Stewart
jon: On Friday 22 June 2007 19:54:16 Philip Armstrong wrote: On Fri, Jun 22, 2007 at 10:11:27PM +0400, Bulat Ziganshin wrote: btw, *their* measurement said that ocaml is 7% faster :) Indeed. The gcc-4.0 compilied binary runs at about 15s IIRC, but it's still much better than 7% faster

Re: [Haskell-cafe] Graphical Haskell

2007-06-22 Thread Donald Bruce Stewart
bf3: Wow thanks for all the info! This certainly can get me started. And yet I have some more questions (sorry!): - Unfortunately this project won't be open source; if my first tests are successful, I will try to convince my employer (who wants to develop such a graphical language) to use

Re: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-20 Thread Donald Bruce Stewart
ttmrichter: On Wed, 2007-20-06 at 15:21 +1000, Donald Bruce Stewart wrote: -- unsigned char *MD5(const unsigned char *d, unsigned long n, un signed char *md); foreign import ccall openssl/md5.h MD5 c_md5 :: Ptr CChar - CULong - Ptr CChar - IO (Ptr Word8

Re: [Haskell-cafe] hSetBuffering woes

2007-06-19 Thread Donald Bruce Stewart
eeoam: Bryan O'Sullivan wrote: Eric wrote: I'm writing a simple HTTP server and am trying to implement the POST method. That's a rather general problem statement, indeed :-) For an application like this, I'd suggest that explicit resource management is the way to go, and that you

Re: [Haskell-cafe] Reading/writing packed bytes from file

2007-06-19 Thread Donald Bruce Stewart
jeff: I've read the documentation for some of the marshalling packages out there for Haskell, and I'm left confused as to which one I should be using and how to actually do what I want to do. I have a file, a little over 2gb, of packed data in the format (recordcount) records of:

Re: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-19 Thread Donald Bruce Stewart
aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684 ./md5sum real0m0.023s user0m0.000s sys 0m0.008s this is my

Re: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-19 Thread Donald Bruce Stewart
dons: aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684 ./md5sum real0m0.023s user0m0.000s sys

Re: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-19 Thread Donald Bruce Stewart
stefanor: On Wed, Jun 20, 2007 at 01:24:00PM +1000, Donald Bruce Stewart wrote: aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum

Re: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-19 Thread Donald Bruce Stewart
aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684 ./md5sum real0m0.023s user0m0.000s sys

Re: [Haskell-cafe] Haskell, crypto and OpenSSL

2007-06-19 Thread Donald Bruce Stewart
dons: -- Fast md5 using OpenSSL and non-copying bytestrings md5sum :: B.ByteString - String md5sum p = unsafePerformIO $ B.unsafeUseAsCStringLen p $ \(ptr,n) - do digest - c_md5 ptr (fromIntegral n) nullPtr liftM concat $ forM [0..15] $ \n - do

Re: [Haskell-cafe] Re: Efficient signal processing

2007-06-18 Thread Donald Bruce Stewart
lemming: On Sun, 17 Jun 2007, Donald Bruce Stewart wrote: simonmarhaskell: Henning Thielemann wrote: The program is compiled with GHC-6.4 and option -O2, CPU clock 1.7 GHz. ByteString is much faster with GHC 6.6, IIRC. We optimised the representation of ForeignPtr

Re: [Haskell-cafe] Re: Efficient signal processing

2007-06-16 Thread Donald Bruce Stewart
simonmarhaskell: Henning Thielemann wrote: The program is compiled with GHC-6.4 and option -O2, CPU clock 1.7 GHz. ByteString is much faster with GHC 6.6, IIRC. We optimised the representation of ForeignPtr, and ByteString takes advantage of that. I recommend upgrading. Yes, a 2x

Re: [Haskell-cafe] TorDNSEL

2007-06-13 Thread Donald Bruce Stewart
newsham: I wanted to point out: http://exitlist.torproject.org/ written in Haskell. I haven't seen any announcements or info on this list (apologies if someone else mentioned it already). For the record, I'm not affiliated with the project in any way. Is the source available? --

Re: [Haskell-cafe] haskell version of fractal benchmark

2007-06-09 Thread Donald Bruce Stewart
dons: sic: * Andrew Coppin [EMAIL PROTECTED] [070608 02:45]: Bayley, Alistair wrote: [[1]mailto:[EMAIL PROTECTED] On Behalf Of Andrew Coppin Donald Bruce Stewart wrote: Some things to remember using Doubles: * {-# OPTIONS -fexcess-precision

Re: [Haskell-cafe] haskell version of fractal benchmark

2007-06-08 Thread Donald Bruce Stewart
andrewcoppin: Donald Bruce Stewart wrote: Some things to remember using Doubles: * {-# OPTIONS -fexcess-precision #-} * -fvia-C * -fbang-patterns * -optc-O2 -optc-mfpmath=sse -optc-msse2 * -optc-march=pentium4 1. What do all those things do? Check the GHC

Re: [Haskell-cafe] haskell version of fractal benchmark

2007-06-08 Thread Donald Bruce Stewart
Alistair_Bayley: [mailto:[EMAIL PROTECTED] On Behalf Of Donald Bruce Stewart 3) -fbang-patterns Better than `seq` Better in the more convenient to write sense, right? AFAIUI, seq and bang patterns should be equivalent. Yes, in the 'more convenient' sense. Adding strictness

[Haskell-cafe] Fast number parsing with strict bytestrings [Was: Re: Seemingly subtle change causes large performance variation]

2007-06-07 Thread Donald Bruce Stewart
mdanish: Hello, I've been playing with the INTEST problem on SPOJ which demonstrates the ability to write a program which processes large quantities of input data. http://www.spoj.pl/problems/INTEST/ But when I make a slight modification, the program chews up a ton more memory and

Re: [Haskell-cafe] Fast number parsing with strict bytestrings [Was: Re: Seemingly subtle change causes large performance variation]

2007-06-07 Thread Donald Bruce Stewart
dons: mdanish: Hello, I've been playing with the INTEST problem on SPOJ which demonstrates the ability to write a program which processes large quantities of input data. http://www.spoj.pl/problems/INTEST/ But when I make a slight modification, the program chews up a ton more

Re: [Haskell-cafe] haskell version of fractal benchmark

2007-06-07 Thread Donald Bruce Stewart
clawsie: i recently saw a (yet-another) benchark comparing various languages: http://www.timestretch.com/FractalBenchmark.html while no haskell example was listed, i thought i would try a naive implementation myself for comparison. it is available here:

Re: [Haskell-cafe] Fast number parsing with strict bytestrings [Was: Re: Seemingly subtle change causes large performance variation]

2007-06-07 Thread Donald Bruce Stewart
dons: dons: mdanish: Hello, I've been playing with the INTEST problem on SPOJ which demonstrates the ability to write a program which processes large quantities of input data. http://www.spoj.pl/problems/INTEST/ But when I make a slight modification, the program chews

Re: [Haskell-cafe] (pre)compiled Haskell compiler for True64/Alpha

2007-06-06 Thread Donald Bruce Stewart
lutz: Does anyone have a haskell compiler for True64 (formerly known as OSF/1) on Alpha hardware? I'm currently unable to compile the first bootstrap compiler. Any hint which compiler should I start with? I'll send detailed error reports only if I do not succeed in the next hours. I

Re: [Haskell-cafe] I just don't get it (data structures and OO)

2007-06-03 Thread Donald Bruce Stewart
Phlex: Hello all, I'm coming from the OO world, and there's something i don't quite understand in the way haskellers manipulate data (as all functional programmers i guess). Let's say i have a deep nested data structure. Universe containing galaxies, containing solar systems,

Re: [Haskell-cafe] Re: I just don't get it (data structures and OO)

2007-06-03 Thread Donald Bruce Stewart
apfelmus: Phlex wrote: Donald Bruce Stewart wrote: Imagine updating a node in a tree by just detaching and reattaching a pointer. [1] [1] / \ / \ [2] [3] update node 5 [2] [3] / \ with value 7

Re: [Haskell-cafe] Re: Just for a laugh...

2007-06-03 Thread Donald Bruce Stewart
almeidaraf: On 6/3/07, Rafael Almeida [EMAIL PROTECTED] wrote: The site seems to be asking for the internal floating point representation. So it doesn't matter if it's IEEE 754, if the ints are 2-complements, or whatever. I used this code as a quick hack for one of my programs, but I think

Re: [Haskell-cafe] Just for a laugh...

2007-06-01 Thread Donald Bruce Stewart
bulat.ziganshin: Hello Andrew, Thursday, May 31, 2007, 11:47:28 PM, you wrote: (Otherwise... wasn't there some library somewhere for serialising values in binary?) Binary, AltBinary (see latest HCAR), just an example using AltBinary: main = do let s = encode (1.1::Float)

Re: [Haskell-cafe] Just for a laugh...

2007-06-01 Thread Donald Bruce Stewart
jules: Donald Bruce Stewart wrote: let s = encode (1.1 :: Float) :t s s :: Data.ByteString.Lazy.ByteString s LPS [\NUL\NUL\140\204\205\255\255\255\255\255\255\255\233] decode s :: Float 1.1 But doesn't Data.Binary serialise to a guaranteed

Re: [Haskell-cafe] Just for a laugh...

2007-06-01 Thread Donald Bruce Stewart
andrewcoppin: Donald Bruce Stewart wrote: See also the older NewBinary, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/NewBinary-0.1 Now that's just ironic... Incidentally, I've been thinking. You *might* want the binary representation of things if you were going

Re: [Haskell-cafe] Has anyone looked into adding subtyping to Haskell?

2007-05-31 Thread Donald Bruce Stewart
stefan: Al, Has there been any work on extending Haskell's type system with structural subtyping? Koji Kagawaga. Polymorphic variants in Haskell. In Andres Loeh, editor, Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, Portland, Oregon, USA, September 17, 2006, pages

Re: [Haskell-cafe] Efficiency question

2007-05-30 Thread Donald Bruce Stewart
rwiggerink: I'm pretty new to Haskell, so forgive me if my question is due to my non-functional way of thinking... I have the following code: module Main where main = print solution solution = solve 100 solve d = countUniqueFractions d 2 1 0 canBeSimplified (a,b) = gcd a

Re: [Haskell-cafe] Darcs users [was: New book: Real-World Haskell!]

2007-05-30 Thread Donald Bruce Stewart
jon: On Wednesday 30 May 2007 06:58:36 Ketil Malde wrote: On Tue, 2007-05-29 at 14:05 -0500, Doug Kirk wrote: I *want* people (and companies) to move to Haskell As a complete noob considering making a commercial venture into Haskell, may I ask what people's opinions are on this? Are

Re: [Haskell-cafe] The C Equiv of != in Haskell miscommunication thread

2007-05-29 Thread Donald Bruce Stewart
kahl: P.S. Have some cute code: Control.Monad.Fix.fix ((1:) . scanl (+) 1) Cute! But what an un-cute qualified name: :t Control.Monad.Fix.fix Control.Monad.Fix.fix :: (a - a) - a Has nothing to do with monads, and would perhaps be considered as ``out of

[Haskell-cafe] data PLZ a

2007-05-29 Thread Donald Bruce Stewart
We got the names wrong! data PLZ a = AWSUM_THX a | O_NOES String instance Monad PLZ where return= AWSUM_THX fail = O_NOES O_NOES s= _ = O_NOES s AWSUM_THX x = f = f x Thanks to mauke on #haskell. -- Don

Re: [Haskell-cafe] data PLZ a

2007-05-29 Thread Donald Bruce Stewart
d.w.mead: is that your implementation of LOLCODE? :P On 5/29/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: We got the names wrong! data PLZ a = AWSUM_THX a | O_NOES String instance Monad PLZ where return= AWSUM_THX

Re: [Haskell-cafe] Cute code [was: The C Equiv of != in Haskell miscommunication thread]

2007-05-29 Thread Donald Bruce Stewart
vincent: i see that the definition of fix (from Control.Monad.Fix) could not be any simpler: fix f = let x = f x in x same goes for the type: Prelude :t Control.Monad.Fix.fix Control.Monad.Fix.fix :: (a - a) - a it's just that i find it difficult to get concrete intellectual

Re: [Haskell-cafe] Coding Standards (Coding Conventions)

2007-05-28 Thread Donald Bruce Stewart
pvolgger: I wonder if there are any Coding Standards or Coding Conventions for Haskell. Does anybody know something about it? We've collected some style guides on the wiki. You could also look at projects whose code you think is in good style. http://haskell.org/haskellwiki/Category:Style

Re: [Haskell-cafe] Coding Standards (Coding Conventions)

2007-05-28 Thread Donald Bruce Stewart
conrad: On 28/05/07, Donald Bruce Stewart [EMAIL PROTECTED] wrote: Our small little window manager, xmonad, also has a pretty strict style guide. where? Perhaps I need coffee, but I couldn't find this in the source (xmonad, x11-extras, XMonadContrib) or documentation links from xmonad.org

Re: [Haskell-cafe] Slower with ByteStrings?

2007-05-28 Thread Donald Bruce Stewart
bulat.ziganshin: Hello Bryan, Sunday, May 27, 2007, 3:30:50 AM, you wrote: I think, given my simple algorithm that means that (==) for ByteStrings is slower than (==) for String. Is this possible? Yes indeed. Over ByteStrings, (==) is implemented as a call to memcmp. For small

Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread Donald Bruce Stewart
junkywunky: type Person = (NI, Age, Balance) type Bank = [Person] credit :: Bank - [Person] credit [(a,b,c)] = [(a,b,c)] This code works when I type in: credit [(1,2,3)] but doesn't work when I type in: credit [(1,2,3),(4,5,6)] You're pattern matching in 'credit' on a list of

Re: [Haskell-cafe] Newbie list question

2007-05-27 Thread Donald Bruce Stewart
junkywunky: That's the thing. I want to return a list of people who are not overdrawn. Something like: type NI = Int type Age = Int type Balance = Int type Person = (NI, Age, Balance) type Bank = [Person] credit :: Bank - [Person] credit [(a,b,c)] = [(a,b,c)] if c = 0

Re: [Haskell-cafe] More on the random idea

2007-05-27 Thread Donald Bruce Stewart
isaacdupree: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Isaac Dupree wrote: The expression is bound to a random top level identifier (harmless to guess) What about the non-recursive case ...expr... of x - take 2048 (show x) this way expr can't refer to x (it doesn't at

Re: [Haskell-cafe] Cannot compile Network.CGI programs

2007-05-26 Thread Donald Bruce Stewart
aneumann: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Hi, I installed the Network.CGI package and tried to compile the Hello World example on my Ubuntu machine. ghc cgi.hs -o cgi Missing --make to link against the cgi and network and mtl packages. Also, -O or -O2, you may as

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
andrewcoppin: Since the online lambdabot still doesn't seem to want to talk to me, I've been thinking about how I might rectify the situation... Apparently GHC has a flag that makes it execute a Haskell expression directly. For example, C:\ ghc -e map (2*) [1,2,3] [2,4,6] Now, if I

[Haskell-cafe] Darcs users [was: New book: Real-World Haskell!]

2007-05-26 Thread Donald Bruce Stewart
On 26/05/07, Matthew Sackman [EMAIL PROTECTED] wrote: (On the other hand, I don't know of anyone outside immediate haskellers using Darcs.) Good idea to get some data on this, instead of speculating. Let's do that. A quick google reveals the Haskell crew is far from alone as users.

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
claus.reinke: Oh, but there is the *minor* detail that I am literally allowing unauthenticated users to perform arbitrary code execution. For example, .. AFAIK, Lambdabot dissalows any expression that performs IO. In Haskell, this is beautifully easy: reject any expression having an IO type.

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
it would really be nice if someone would sit down and sort this all out in detail. there'd still be no guarantee that such a Haskell sandbox was totally safe, but at least all issues and solutions could be shared, making it as safe as the community knows how. The #haskell people have been

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
isaacdupree: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Donald Bruce Stewart wrote: Lambdabot uses 1) type guarantee of no-IO at the top level, along with 2) a trusted module base (pure module only, that are trusted to not export evil things), as well as 3) restricting only to H98

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
overdrigzed: As far as I know, hs-plugins works by taking an expression, writing it to a file, calling GHC to parse it, transform it to Core, optimise it, transform it to STG, optimise it, transform it to C--, optimise it, transform it to ANSI C,

Re: [Haskell-cafe] More on the random idea

2007-05-26 Thread Donald Bruce Stewart
claus.reinke: The #haskell people have been working on this for about 3 years now. The result is the 'runplugs' program, which I've talked about in previous mails. http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/RunPlugs.hs It uses hs-plugins for the evaluation, along with the

Re: [Haskell-cafe] Slower with ByteStrings?

2007-05-26 Thread Donald Bruce Stewart
bos: Jason Dagit wrote: I think, given my simple algorithm that means that (==) for ByteStrings is slower than (==) for String. Is this possible? Yes indeed. Over ByteStrings, (==) is implemented as a call to memcmp. For small strings, this loses by a large margin because it has to go

Re: [Haskell-cafe] Why this exception occurs ?

2007-05-25 Thread Donald Bruce Stewart
leaveye.guo: Hi. In GHCi ver 6.6, why this happens ? Prelude Data.ByteString Data.ByteString.pack $! Prelude.map (`rem` 256) $ [0..511] *** Exception: divide by zero Interesting... Is that just, Data.ByteString.pack $ [0..255] ++ [0..255] ? -- Don

Re: [Haskell-cafe] Why this exception occurs ?

2007-05-25 Thread Donald Bruce Stewart
leaveye.guo: Hi. In GHCi ver 6.6, why this happens ? Prelude Data.ByteString Data.ByteString.pack $! Prelude.map (`rem` 256) $ [0..511] *** Exception: divide by zero It's the use of `rem` on Word8, by the way: Prelude (0 `rem` 256) :: Data.Word.Word8 *** Exception: divide by

Re: [Haskell-cafe] Why this exception occurs ?

2007-05-25 Thread Donald Bruce Stewart
dons: leaveye.guo: Hi. In GHCi ver 6.6, why this happens ? Prelude Data.ByteString Data.ByteString.pack $! Prelude.map (`rem` 256) $ [0..511] *** Exception: divide by zero It's the use of `rem` on Word8, by the way: Prelude (0 `rem` 256) :: Data.Word.Word8 ***

Re: [Haskell-cafe] Why this exception occurs ?

2007-05-25 Thread Donald Bruce Stewart
ketil: On Fri, 2007-05-25 at 17:33 +1000, Donald Bruce Stewart wrote: Sorry, I should clarify, think about how to represent: 256 :: Word8 So the error isn't really divide by zero, but overflow. I've been bitten by this, too, and L.Guo should count him/herself lucky to get

Re: [Haskell-cafe] instance Monad AppF - Faster than the list monad?

2007-05-25 Thread Donald Bruce Stewart
greenrd: The following Haskell 98 module implements a generalisation of Prelude.ShowS for any type. Should be pretty easy to incorporate this into code which currently uses the list monad non-trivially, and get better performance - but can this be right? Surely someone would have published

Re: [Haskell-cafe] (no subject)

2007-05-24 Thread Donald Bruce Stewart
leaveye.guo: Hi MailList Haskell-Cafe: Till now, which module / package / lib can i use to access binary file ? And is this easy to use in GHC ? Data.Binary? Or perhaps just Data.ByteString, available on hackage,

Re: [Haskell-cafe] (no subject)

2007-05-24 Thread Donald Bruce Stewart
leaveye.guo: Thanks for your suggestion, and sorry for the subject. I have read the introduction of Data.ByteString, it is helpful. And also, there is one problem left. When i read a binary file, data is truncated at the charactor EOF. Which function could do this work correctly ? Hmm.

Re: [Haskell-cafe] (no subject)

2007-05-24 Thread Donald Bruce Stewart
marco-oweber: On Thu, May 24, 2007 at 02:38:05PM +0800, L.Guo wrote: Thanks for your suggestion, and sorry for the subject. I have read the introduction of Data.ByteString, it is helpful. And also, there is one problem left. When i read a binary file, data is truncated at the

Re: Re: [Haskell-cafe] (no subject)

2007-05-24 Thread Donald Bruce Stewart
leaveye.guo: to Ketil : Tring openBinaryFile, I notice that I cannot make one usable buffer, just because I can not find one function to malloc a memory or just get one change-able buffer. :-$ No 'malloc' here in Haskell land: that's done automatically. Recall that 'getContents' will

Re: Re: [Haskell-cafe] (no subject)

2007-05-24 Thread Donald Bruce Stewart
leaveye.guo: To read the handle openBinaryFile returns, both the hGetBuf and hGetBufNonBlocking needs one parameter _buf_ of type Ptr a. I can not get one data of that type. In the doc, there is only nullPtr, and also some type cast functions. I failed to find some other buffer-maker

Re: [Haskell-cafe] New book: Real-World Haskell!

2007-05-24 Thread Donald Bruce Stewart
bos: I'll condense my remaining replies to this thread into a single message, to save people a little noise. I'd just add that the response is literally overwhelming! Some 100-odd volunteers to review, and a lot of mail besides. Please bear with us as we try to surface under this mountain of

Re: [Haskell-cafe] Re: Editor

2007-05-22 Thread Donald Bruce Stewart
Alistair_Bayley: I'm sure that I can quite reliably hit the command editor keybindings I use many, many times faster than if I had to select them from a menu. Note that the claimed time-consuming part is not to actually press the keybinding, but to chose and remember which one

Re: [Haskell-cafe] Currying: The Rationale

2007-05-22 Thread Donald Bruce Stewart
prstanley: Hi What is the rationale behind currying? is it for breaking subroutines into pure one-to-one mappings? We don't have 'subroutines' as such, but otherwise yes. Also, it gives us partial application - we don't have to apply all the parameters at once, and we can do

[Haskell-cafe] Wanted: extended static checking for xmonad

2007-05-21 Thread Donald Bruce Stewart
When working on xmonad, we're trying to produce very clean, correct code -- a window manager that just works. To do this, we're looking to employ more static checking tools to the code base. Currently we use: * QuickCheck (checks high level window manager behaviour) * Catch (Neil's

Re: [Haskell-cafe] Random idea

2007-05-20 Thread Donald Bruce Stewart
andrewcoppin: Greetings. I was thinking... we already have Lambdabot sitting in an IRC channel. How hard would it be to mangle Lambdabot to the point where it works over HTTP? You know - so you could type some Haskell into a form on a Lambdabot web server is here:

Re: [Haskell-cafe] What really happens

2007-05-19 Thread Donald Bruce Stewart
andrewcoppin: Hi everybody. Is there any circumstances under which an expression like map (2*) would perform an in-place update rather than generating a new list? (Obviously Yes, should be fine, if the result is consumed. We have fusion frameworks that do this. this depends on which

Re: [Haskell-cafe] Pesky monads...

2007-05-19 Thread Donald Bruce Stewart
matt: It occurred to me that the predicate will generally be a monadic function itself, so here's a refined version: :: Monad m = (a - m Bool) - (a - m a) - a - m a untilM pred f x = do c - pred x if c then return x else f x = untilM pred f

Re: [Haskell-cafe] idlelog

2007-05-19 Thread Donald Bruce Stewart
lpenz: Hi I made a program that detects user presence in a linux box by checking for keyboard interruptions in /proc/interrupts. Problem is, it is supposed to run for a long time, and it keeps about 40MB for itself. Yeah, this is one more help me with this memory problem mails...

Re: [Haskell-cafe] global variables

2007-05-17 Thread Donald Bruce Stewart
eeoam: H|i, Does anyone know of a simple and straightforward way to use global variables in Haskell? E. The usual way is to run the code that needs a global variable in a State monad. The next answer is: you don't really need global variables, since you don't have mutable variables

Re: [Haskell-cafe] CUFP website

2007-05-16 Thread Donald Bruce Stewart
cyril.schmidt: I noticed recently that the website of CUFP conference (Commercial Uses of Function Programming), which used to be at http://www.galois.com/cufp, is not accessible anymore. Does anybody know where it moved? Try http://cufp.galois.com/ -- Don

Re: [Haskell-cafe] Co-arbitrary

2007-05-08 Thread Donald Bruce Stewart
joelr1: Would someone kindly explain why we need co-arbitrary in QuickCheck and how to define it? Generating random function generators. A nice explanation was given recently on the programming subreddit: The CoArbitrary class continues to confuse me

Re: [Haskell-cafe] Intermediate Haskell Books?

2007-05-06 Thread Donald Bruce Stewart
aneumann: -BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 Are there any good books about intermediate to advanced Haskell? The descriptions here http://haskell.org/haskellwiki/Books_and_tutorials aren't very helpful. Not in real-world paper form, yet. Mostly advanced techniques and

[Haskell-cafe] Mounting haskell.org wiki under WikipediaFS?

2007-05-06 Thread Donald Bruce Stewart
Anyone tried editing haskell.org's wiki as text, using: http://wikipediafs.sourceforge.net/ WikipediaFS is a mountable Linux virtual file system that enables you to deal with Wikipedia (or any Mediawiki-based site) articles as if they were real files. It is thus possible to use a real text

[Haskell-cafe] Haskell Weekly News: May 07, 2007

2007-05-06 Thread Donald Bruce Stewart
--- Haskell Weekly News http://sequence.complete.org/hwn/20070507 Issue 62 - May 07, 2007 --- Welcome to issue 62 of HWN, a weekly newsletter covering

<    1   2   3   4   5   6   >