Re: [Haskell-cafe] Re: Explaining monads

2007-08-13 Thread Brandon S. Allbery KF8NH
On Aug 13, 2007, at 16:29 , Benjamin Franksen wrote: Let's take the simplest example: Maybe. The effect in question is the premature abortion of a computation (when Nothing is returned). And of course Maybe sequences these effects, that's what you use it for: the _first_ action to be

Re: [Haskell-cafe] Bathroom reading

2007-08-14 Thread Brandon S. Allbery KF8NH
On Aug 14, 2007, at 11:17 , Dougal Stanton wrote: Let us say, hypothetically, you had a bathroom without any reading material. And having read all the Dilbert and Garfield you could seriously stomach, decide you should educate yourself while on the job. :-) Sounds to me like you want a

Re: [Haskell-cafe] Basic question....

2007-08-17 Thread Brandon S. Allbery KF8NH
On Aug 17, 2007, at 9:11 , rodrigo.bonifacio wrote: envKey :: EnvItem (Key, a) - String envKey EnvItem (key, value) = key envValue :: EnvValue(Key, a) - a envValue EnvItem (key, value) = value But this is resulting in the error: [Constructor EnvItem must have exactly 1 argument in

Re: [Haskell-cafe] GHC optimisations

2007-08-21 Thread Brandon S. Allbery KF8NH
On Aug 21, 2007, at 22:13 , Twan van Laarhoven wrote: Other rules that could be interesting are: forall a b. fromInteger a + fromInteger b = fromInteger (a + b) I don't think this will work, a and b have to be the same type. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL

Re: [Haskell-cafe] Re: Haskell vs GC'd imperative languages, threading, parallelizeability (is that a word? :-D )

2007-08-21 Thread Brandon S. Allbery KF8NH
On Aug 21, 2007, at 23:27 , Hugh Perkins wrote: Hmmm, that's interesting. I'd never considered lack of typing to be a good thing for system robustness before! The old watchphrase (before Netscape and Microsoft abused it beyond anyone's expectation) for Internet protocols was be liberal in

Re: [Haskell-cafe] Ideas

2007-08-25 Thread Brandon S. Allbery KF8NH
On Aug 25, 2007, at 14:43 , Andrew Coppin wrote: Neil Mitchell wrote: HI Flippi (google: Haskell Flippi) ...and yet haskell.org uses WikiMedia? (Which is written in something bizzare like Perl...) Yes, but WikiMedia is a result of years of work, Flippi is a lot less. Wikipedia

Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-29 Thread Brandon S. Allbery KF8NH
On Aug 29, 2007, at 23:34 , Hugh Perkins wrote: Hmmm, random thought along similar lines, I mean I know the answer to this thought is no, but I'm curious: could we get Haskell to run on a graphics card??? I thought someone had done that recently as a graduate thesis. -- brandon s. allbery

Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-30 Thread Brandon S. Allbery KF8NH
On Aug 30, 2007, at 2:34 , Radosław Grzanka wrote: obsolete and Pocket PC is probably better target. Anyway, does anyone else experience a feeling that at the time of buying yourself new gadget you are already in deprecated zone? ;) I've been feeling that way since 1982 -- brandon s.

Re: [Haskell-cafe] Haskell on the Playstation 3? :-)

2007-08-30 Thread Brandon S. Allbery KF8NH
On Aug 30, 2007, at 3:00 , Hugh Perkins wrote: On 8/30/07, Miguel [EMAIL PROTECTED] wrote: What about running Haskell on a PostScript printer? PostScript IS Turing-complete. Yes, because postscript printers are famous for being really fast ;-) You youngsters don't remember when

Re: [Haskell-cafe] let and fixed point operator

2007-08-31 Thread Brandon S. Allbery KF8NH
On Aug 31, 2007, at 16:01 , Sterling Clover wrote: In particular for a function -- n, m, etc or x, y, etc? What about for f' defined in a let block of f? If I use x y at the top level I need to use another set below -- is that where x' y' are more appropriate, or x1, y1? Usual style is

Re: [Haskell-cafe] Learn Prolog...

2007-09-02 Thread Brandon S. Allbery KF8NH
On Sep 2, 2007, at 2:08 , Peter Verswyvelen wrote: But after reading http://en.wikipedia.org/wiki/ Fifth_generation_computer, it seemed to me that Prolog was a dead language, having only pure theoretical purposes. Is this true? Tell that to the order pricing system I wrote in Prolog for a

Re: [Haskell-cafe] Re: [Off topic] Proving an impossibility

2007-09-04 Thread Brandon S. Allbery KF8NH
On Sep 4, 2007, at 5:02 , Miguel Mitrofanov wrote: It depends on arbitrary restrictions on what constitutes an (boolean) expression, something that is anathema to functional programmers :-) Spot the language: while if E then S; F else False fi do T od It reminds me of a

Re: [Haskell-cafe] Extending the idea of a general Num to other types?

2007-09-05 Thread Brandon S. Allbery KF8NH
On Sep 5, 2007, at 6:47 , Ketil Malde wrote: On Wed, 2007-09-05 at 09:56 +0100, Simon Peyton-Jones wrote: Good point. Not so easy for multi-parameter type classes! E.g. No instance for (Bar String Int). So we could have String is not an instance of class Foo -- single param

Re: [Haskell-cafe] Learning advice

2007-09-07 Thread Brandon S. Allbery KF8NH
On Sep 7, 2007, at 14:37 , Albert Y. C. Lai wrote: Brent Yorgey wrote: Then one day he met someone else who said she was also a race car driver, but her car was different -- she called it a Haskar. It had a top speed of 400 miles per hour, no steering wheel (you just lean whichever way

Re: [Haskell-cafe] Custom unary operator extension?

2007-09-09 Thread Brandon S. Allbery KF8NH
On Sep 9, 2007, at 9:09 , Peter Verswyvelen wrote: I think that the benefits of prefix or postfix symbolic operators were not worth dispensing with the comfortable section syntax. Well, that's personal I guess, but I would prefer the syntax (? / 100) and (100 / ?), which is just a single

Re: [Haskell-cafe] Comments and/or Criticisms

2007-09-10 Thread Brandon S. Allbery KF8NH
On Sep 10, 2007, at 1:47 , Stuart Cook wrote: On 9/10/07, PR Stanley [EMAIL PROTECTED] wrote: --count occurrences of chars in string countCS :: [Char] - [(Char, Int)] countCS xs = [(x, (countC x xs)) | x - [' '..'z'], (countC x xs) 0] A few things to note: My naive take on it: import

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-11 Thread Brandon S. Allbery KF8NH
On Sep 11, 2007, at 7:01 , Jules Bean wrote: The actual format used by Data.Binary is not explicitly described in any standard (although in most cases it's moderately obvious, and anyone can read the code), and it's not formally guaranteed that it will never change in a later version

Re: [Haskell-cafe] getting crazy with character encoding

2007-09-12 Thread Brandon S. Allbery KF8NH
On Sep 12, 2007, at 10:18 , Andrea Rossato wrote: supposed that, in a Linux system, in an utf-8 locale, you create a file with non ascii characters. For instance: touch abèèè Now, I would expect that the output of a shell command such as ls ab* would be a string/list of 5 chars. Instead I

Re: [Haskell-cafe] Memory leak or wrong use of Array ?

2007-09-14 Thread Brandon S. Allbery KF8NH
On Sep 14, 2007, at 21:35 , L.Guo wrote: Thanks for your advice about thunk, though I do not understand *thunk* very well. Is there any other discriptions about thunk ? A thunk is, in general, a piece of code which represents a suspended or delayed action. In Haskell, it represents a lazy

Re: [Haskell-cafe] length defined with foldr

2007-09-19 Thread Brandon S. Allbery KF8NH
On Sep 19, 2007, at 23:17 , PR Stanley wrote: length = foldr (. n . 1 + n) 0 Any idea how to define length with foldr. The above definition doesn't make much sense. Still fighting with the botched OCR? length = foldr (\_ n - 1 + n) 0 -- brandon s. allbery

Re: [Haskell-cafe] Spot the difference!

2007-09-19 Thread Brandon S. Allbery KF8NH
On Sep 20, 2007, at 0:03 , PR Stanley wrote: \_ n - 1 + n \_ - (\n - 1 + n) The outcome seems to be identical. is there a substantive difference between the two definitions? The second one seems to be more expressive of the currying principle. Any thoughts? I *think* the former is

Re: [Haskell-cafe] Spot the difference!

2007-09-19 Thread Brandon S. Allbery KF8NH
On Sep 20, 2007, at 0:16 , PR Stanley wrote: I must confess that the use of \_ had me a little confused at first but thinking about it I can see that it makes perfect sense to have an argument or a wildcard character for any value. Sure. Remember, arguments are pattern matches in Haskell

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Brandon S. Allbery KF8NH
On Sep 25, 2007, at 5:48 , Andrew Coppin wrote: Dougal Stanton wrote: In this instance I would suggest: (1) Text.Printf You've got to be kidding... I went to all the trouble of learning a scary logic programming language [sic] just to avoid that damned printf() function! :-/ Enh.

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Brandon S. Allbery KF8NH
On Sep 25, 2007, at 5:56 , Andrew Coppin wrote: More seriously, I have no idea how you'd implement this in Haskell. Presumably the standard show instance for Int, Double, etc. is in native C? You could probably reimplement it in Haskell for the integer case, but not for floating-point...

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Brandon S. Allbery KF8NH
On Sep 25, 2007, at 5:45 , Andrew Coppin wrote: Still, since Haskell seems to be devoid of any more advanced way of formatting numbers beyond low-level character jiggling... Text.Printf.printf is your friend. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Brandon S. Allbery KF8NH
On Sep 25, 2007, at 6:55 , Andrew Coppin wrote: This is why I found it so surprising - and annoying - that you can't use a 2-argument function in a point-free expression. You can, it just requires more juggling. Play around with lambdabot's @pl for a bit. -- brandon s. allbery

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Brandon S. Allbery KF8NH
On Sep 25, 2007, at 7:25 , Andrew Coppin wrote: Chaddaï Fouché wrote: 2007/9/25, Andrew Coppin [EMAIL PROTECTED]: printf don't always perform IO : if you ask it for a String it will happily turn into sprintf for you, if you use it in the IO Monad, it will indeed perform IO, but there's

Re: [Haskell-cafe] Re: Very crazy

2007-09-25 Thread Brandon S. Allbery KF8NH
On Sep 25, 2007, at 7:24 , Andrew Coppin wrote: which *just happens* to be what we want. But in the general case where you want f3 (f2 (f1 x y z)) there's nothing you can do except leave point-free. You mean leave point-ful. And the point-free version of that is (((f3 . f2) .) .) . f1

Re: [Haskell-cafe] Data types and field labels and Show

2007-09-27 Thread Brandon S. Allbery KF8NH
On Sep 27, 2007, at 14:14 , bbrown wrote: instance Show SimplePlayer where show a = Simple posX [ ++ show a{posX} ++ ] instance Show SimplePlayer where show a = Simple posX [ ++ show (posX a) ++ ] You might also want to consider deriving(Show). -- brandon s. allbery

Re: [Haskell-cafe] Rewriting filter with foldr

2007-09-30 Thread Brandon S. Allbery KF8NH
On Sep 30, 2007, at 11:57 , PR Stanley wrote: Well, note that foldr takes a function of x, which produces a function of xs. This function of xs either conses x onto it, or leaves it unchanged. We can write this down explicitly by removing the xs parameter and just writing what

Re: [Haskell-cafe] Extract source code from literate Haskell (LHS) files

2007-09-30 Thread Brandon S. Allbery KF8NH
On Sep 30, 2007, at 14:39 , Peter Verswyvelen wrote: This is of course very easy to do manually, but does a command line tool exist for extracting source code from literate Haskell files? unlit in the GHC library directory? -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL

Re: [Haskell-cafe] Unfriendly hs-plugins error

2007-10-01 Thread Brandon S. Allbery KF8NH
On Oct 1, 2007, at 21:59 , Björn Buckwalter wrote: Dear all, I'm getting a rather unfriendly error when trying to load a plugin with hs-plugins: my_program: Ix{Int}.index: Index (65536) out of range ((0,7)) This tends to mean that hs-plugins doesn't understand the format of the .hi

Re: [Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-02 Thread Brandon S. Allbery KF8NH
On Oct 2, 2007, at 9:52 , Alex Queiroz wrote: (parseDottedList ls) | (parseProperList ls) I've factored out the common left sub-expression in parseLeftList. The problem is that ... is a valid identifier so when inside the left of the list the parser sees a single dot, it tries to match

Re: [Haskell-cafe] Parsing R5RS Scheme with Parsec

2007-10-02 Thread Brandon S. Allbery KF8NH
On Oct 2, 2007, at 10:36 , Alex Queiroz wrote: This does not work. The parser chokes in parseLeftList, because it finds a single dot which is not the beginning of Sorry, just woke up and still not quite tracking right, so I modified the wrong snippet of code. The trick is to

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-02 Thread Brandon S. Allbery KF8NH
On Oct 2, 2007, at 21:12 , Isaac Dupree wrote: Stefan O'Rear wrote: On Tue, Oct 02, 2007 at 11:05:38PM +0200, Johan Tibell wrote: I do not believe that anyone was seriously advocating multiple blessed encodings. The main question is *which* encoding to bless. 99+ % of text I encounter is

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-05 Thread Brandon S. Allbery KF8NH
On Oct 5, 2007, at 12:33 , Henning Thielemann wrote: http://www.henning-thielemann.de/CHater.html#CvsM3_ControlFlow I can has English? :) If the first large table is any indication, though, we may need to define inconsistent. C syntax shown there is quite consistent; what it isn't, is

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-10 Thread Brandon S. Allbery KF8NH
On Oct 10, 2007, at 20:14 , Michael Vanier wrote: I haven't been following this discussion closely, but here's an idea: use reverse psychology. Haskell -- You're probably not smart enough to understand it. Nothing like appealing to people's machismo to get them interested. Haskell

Re: [Haskell-cafe] Filesystem questions

2007-10-12 Thread Brandon S. Allbery KF8NH
All these questions are actually Windows-centric; the answers are different on Unix. On Oct 12, 2007, at 13:21 , Andrew Coppin wrote: I notice that getDirectoryContents appears to return its results in alphabetical order. Is this behaviour actually guaranteed? There is no guarantee,

Re: [Haskell-cafe] WinAmp plugin?

2007-10-12 Thread Brandon S. Allbery KF8NH
On Oct 12, 2007, at 14:26 , Andrew Coppin wrote: pierre wrote: Wouldn't it be better to write not just a visualization plugin, but a whole player from scratсh? :-) ...this idea also occurred to me. ;-) Why, do *you* know how to decode MP3 data? Don't Do That. Use someone else's

Re: [Haskell-cafe] Re: Type-level arithmetic

2007-10-12 Thread Brandon S. Allbery KF8NH
On Oct 12, 2007, at 16:25 , Tim Chevalier wrote: On 10/12/07, Steve Schafer [EMAIL PROTECTED] wrote: On Fri, 12 Oct 2007 13:03:16 -0700, you wrote: It's different because the property that (for example) head requires a nonempty list is checked at compile time instead of run time. No, I

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-12 Thread Brandon S. Allbery KF8NH
On Oct 12, 2007, at 18:35 , Albert Y. C. Lai wrote: You are not expected to be convinced this, but it seems continuations completely characterize system programming. :) Didn't someone already prove all monads can be implemented in terms of Cont? (here you see why schemers are so wedded

Re: [Haskell-cafe] Re: Type-level arithmetic

2007-10-12 Thread Brandon S. Allbery KF8NH
On Oct 12, 2007, at 19:26 , Tim Chevalier wrote: On 10/12/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: You two are talking past each other. You're talking about dependent typing, etc. Steve's complaint is not about dependent typing; he's saying Andrew is looking for something

Re: [Haskell-cafe] How to thoroughly clean up Haskell stuff on linux

2007-10-12 Thread Brandon S. Allbery KF8NH
On Oct 12, 2007, at 17:38 , Lihn, Steve wrote: Installing: --prefix=~/cabal/lib/haddock-0.8/ghc-6.4 This looks suspicious to me: the ~ metacharacter is only understood by shells, and only in certain circumstances (i.e. only at the beginning of a word, not after a =), and by the time

Re: [Haskell-cafe] Re: Type-level arithmetic

2007-10-12 Thread Brandon S. Allbery KF8NH
On Oct 12, 2007, at 19:42 , Dan Piponi wrote: On 10/12/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: He wants to write entire programs in the type system, something like the crazies who write programs in C++ templates such that template expansion does all the work at compile time

Re: [Haskell-cafe] Re: How to thoroughly clean up Haskell stuff on linux

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 3:51 , Aaron Denney wrote: On 2007-10-12, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: On Oct 12, 2007, at 17:38 , Lihn, Steve wrote: Installing: --prefix=~/cabal/lib/haddock-0.8/ghc-6.4 This looks suspicious to me: the ~ metacharacter is only understood

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 6:52 , ntupel wrote: On Fri, 2007-10-12 at 20:25 -0700, Stefan O'Rear wrote: On Sat, Oct 13, 2007 at 12:09:57AM +0200, ntupel wrote: setup :: (Ord a, IArray a2 a, IArray a1 e, Num a) = [e] - [a] - (a1 Int e, a1 Int e, a2 Int a) calcAlias :: (Ord e, Num e, IArray a e, Ix

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 11:40 , ntupel wrote: On Sat, 2007-10-13 at 09:56 -0400, Brandon S. Allbery KF8NH wrote: Now you need to start forcing things; given laziness, things tend to only get forced when in IO, which leads to time being accounted to the routine where the forcing happened

Re: [Haskell-cafe] Performance problem with random numbers

2007-10-13 Thread Brandon S. Allbery KF8NH
On Oct 13, 2007, at 13:30 , ntupel wrote: On Sat, 2007-10-13 at 12:42 -0400, Brandon S. Allbery KF8NH wrote: Your apparently simple StdGen argument is actually a sort of program state (represented by unevaluated thunks, not by a state monad; see below) which gets altered with every invocation

Re: Laziness (was: [Haskell-cafe] Performance problem with random numbers)

2007-10-14 Thread Brandon S. Allbery KF8NH
On Oct 14, 2007, at 17:54 , ntupel wrote: Now my problem still is, that I don't know how to speed things up. I tried putting seq and $! at various places with no apparent improvement. Maybe I need to find a different data structure for my random module and lazy lists are simply not

Re: [Haskell-cafe] On the verge of ... giving up!

2007-10-14 Thread Brandon S. Allbery KF8NH
On Oct 14, 2007, at 22:54 , Richard A. O'Keefe wrote: The really amazing thing about the IO Monad in Haskell is that there *isn't* any magic going on. An level of understanding adequate for using the I/O and State monads stuff (that is, adequate for practically anything analogous to what you

Re: [Haskell-cafe] On the verge of ... giving up! [OT]

2007-10-15 Thread Brandon S. Allbery KF8NH
On Oct 15, 2007, at 7:01 , Yitzchak Gale wrote: But I think we are still at the stage where a programmer who wants practical results is better off starting out by learning how to use monads in practice, not by delving into category theory. No argument from a Haskell standpoint. Still, when

Re: [Haskell-cafe] do

2007-10-15 Thread Brandon S. Allbery KF8NH
On Oct 15, 2007, at 7:02 , [EMAIL PROTECTED] wrote: IO is different, you *cannot* make it non-monadic. Not really true; it's just much more painful. You just e.g. explicitly do what the ghc library's implementation of IO does: construct a chain of functions with an opaque (and

Re: [Haskell-cafe] do

2007-10-15 Thread Brandon S. Allbery KF8NH
On Oct 15, 2007, at 7:02 , david48 wrote: On 10/15/07, Peter Verswyvelen [EMAIL PROTECTED] wrote: Yes, exactly, but how does one call the way of programming without monads / do notation then, explicitly passing the object? Does this approach have a name? Or just non-monadic style? the

Re: [Haskell-cafe] Re: On the verge of ... giving up!

2007-10-15 Thread Brandon S. Allbery KF8NH
On Oct 15, 2007, at 7:59 , Felipe Lessa wrote: On 10/15/07, apfelmus [EMAIL PROTECTED] wrote: lasts :: Int - [a] - [a] lasts n xs = head $ [x | (x,[]) - zip (tails xs) (tails $ drop n xs)] (...) main n = print . sum . map read . lasts n . lines = getContents But that's a a

Re: [Haskell-cafe] do

2007-10-15 Thread Brandon S. Allbery KF8NH
On Oct 15, 2007, at 9:48 , Brandon S. Allbery KF8NH wrote: On Oct 15, 2007, at 7:02 , [EMAIL PROTECTED] wrote: IO is different, you *cannot* make it non-monadic. Not really true; it's just much more painful. Expanding on this slightly: the neat thing about Haskell's monads

Re: [Haskell-cafe] do

2007-10-15 Thread Brandon S. Allbery KF8NH
On Oct 15, 2007, at 13:32 , Peter Verswyvelen wrote: [EMAIL PROTECTED] wrote: Yes, *different approach*. So, there *are* differences. Compilers, anyway, are special applications. I wanted to see - responding to Brandon - a normal Haskell program, which does IO without monads, that't all.

Re: [Haskell-cafe] Re: do

2007-10-15 Thread Brandon S. Allbery KF8NH
On Oct 15, 2007, at 19:00 , ChrisK wrote: Brandon S. Allbery KF8NH wrote: Use the source of unsafePerformIO as an example of how to write code which passes around RealWorld explicitly, but without unencapsulating it like unsafePerformIO does. The main problem here, I think

Re: [Haskell-cafe] Re: do

2007-10-15 Thread Brandon S. Allbery KF8NH
I actually got this done several hours ago, but my DSL is being annoying tonight... Anyway, here's a simple example of how to do explicit/non-monadic I/O in GHC. (It *only* works in GHC; other compilers have different internal implementations of IO.) I specifically modeled it to

Re: [Haskell-cafe] Re: [Haskell] Re: Trying to install binary-0.4

2007-10-16 Thread Brandon S. Allbery KF8NH
On Oct 16, 2007, at 4:21 , Ketil Malde wrote: The major/minor scheme has worked nicely for .so for ages. i'm not so sure about that. it may be better than alternatives, but [..] Also, it sees a lot of testing, at least in current Linux distributions. The point is that the end-user

Re: [Haskell-cafe] RE: [Haskell] Re: Trying to install binary-0.4

2007-10-16 Thread Brandon S. Allbery KF8NH
On Oct 16, 2007, at 9:01 , Bayley, Alistair wrote: From: Simon Marlow [mailto:[EMAIL PROTECTED] The lexicographical ordering would make 10.0 9.3. In general, A.B C.D iff A C or A == C B D. When we say the latest version we mean greatest, implying that version numbers increase with

Re: [Haskell-cafe] Re: Bug in runInteractiveProcess?

2007-10-16 Thread Brandon S. Allbery KF8NH
On Oct 16, 2007, at 21:40 , Richard A. O'Keefe wrote: F_GETFD and F_SETFD are the things to look for; FD_CLOEXEC is a fancy way of saying 1 in historic UNIXes. The OSF/1 /usr/include/sys/ fcntl.h says that FD_CLOEXEC is POSIX REQUIRED. This facility is most certainly part of the Single Unix

Re: [Haskell-cafe] Re: Bug in runInteractiveProcess?

2007-10-16 Thread Brandon S. Allbery KF8NH
On Oct 17, 2007, at 0:39 , Donn Cave wrote: On Oct 16, 2007, at 7:31 PM, Brandon S. Allbery KF8NH wrote: I could dig for official confirmation, but this is my understanding of both POSIX and SUS, and portable C programs generally #define FD_CLOEXEC to 1 if it doesn't already exist

Re: [Haskell-cafe] Re: Bug in runInteractiveProcess?

2007-10-17 Thread Brandon S. Allbery KF8NH
On Oct 17, 2007, at 1:32 , Donn Cave wrote: On Oct 16, 2007, at 9:52 PM, Brandon S. Allbery KF8NH wrote: Either implementation causes problems; security folks tend to prefer that all file descriptors other than 0-2 (0-4 on Windows?) be closed, and 0-2(4) be forced open (on /dev/null

Re: [Haskell-cafe] Do you trust Wikipedia?

2007-10-17 Thread Brandon S. Allbery KF8NH
On Oct 17, 2007, at 22:25 , Dan Weston wrote: I find the mathematics is more accurate on http://www.conservapedia.com Their facts get checked by the Almighty Himself! ;) I Kings 7:23? :p -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator

Re: [Haskell-cafe] Re: Proposal: register a package as providing several API versions

2007-10-18 Thread Brandon S. Allbery KF8NH
On Oct 18, 2007, at 4:57 , Simon Marlow wrote: depend on API versions (including minor versions) that you haven't tested, or (b) use explicit import lists and allow minor version changes only. Incedentally, this reminds me that GHC should have a warning for not using explicit import lists

Re: [Haskell-cafe] Pixel plotter

2007-10-19 Thread Brandon S. Allbery KF8NH
On Oct 19, 2007, at 15:14 , Andrew Coppin wrote: Peter Verswyvelen wrote: I find it a petty the library does not work with GHCi :-( It has to do with the threaded RTS I guess. Any hints how I could fix this? Yeah, lots of things seem to dislike running in GHCi. (I'm guessing this is to

Re: [Haskell-cafe] Polymorphic (typeclass) values in a list?

2007-10-19 Thread Brandon S. Allbery KF8NH
On Oct 19, 2007, at 12:11 , Sebastian Sylvan wrote: On 19/10/2007, Kalman Noel [EMAIL PROTECTED] wrote: data ExistsNumber = forall a. Num a = Number a I'm without a Haskell compiler, but shouldn't that be exists a.? The problem is that exists is not valid in either Haskell 98 or any

Re: [Haskell-cafe] Do you trust Wikipedia?

2007-10-18 Thread Brandon S. Allbery KF8NH
On Oct 18, 2007, at 19:53 , John Meacham wrote: On Thu, Oct 18, 2007 at 02:31:10AM +0100, PR Stanley wrote: Do you trust mathematical materials on Wikipedia? Certainly! I honestly think wikipedia is one of man's greatest achievements, and it is just in its infancy. For what it's worth,

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Brandon S. Allbery KF8NH
On Oct 20, 2007, at 15:05 , Andrew Coppin wrote: I can quite happily construct a program which, given the first line, yields the last line. But getting it to print all the intermediate steps is harder. And, like I said, when something is hard in Haskell, it usually means you're doing it

Re: [Haskell-cafe] Re: Hiding side effects in a data structure

2007-10-21 Thread Brandon S. Allbery KF8NH
On Oct 21, 2007, at 6:29 , Jon Fairbairn wrote: No, they (or at least links to them) typically are that bad! Mind you, as far as fragment identification is concerned, so are a lot of html pages. But even if the links do have fragment ids, pdfs still impose a significant overhead: I don't want

Re: [Haskell-cafe] Re: Polymorphic (typeclass) values in a list?

2007-10-21 Thread Brandon S. Allbery KF8NH
On Oct 21, 2007, at 6:41 , Peter Hercek wrote: Brandon S. Allbery KF8NH wrote: On Oct 19, 2007, at 12:11 , Sebastian Sylvan wrote: On 19/10/2007, Kalman Noel [EMAIL PROTECTED] wrote: data ExistsNumber = forall a. Num a = Number a I'm without a Haskell compiler, but shouldn't

Re: [Haskell-cafe] How much of Haskell was possible 20 years ago?

2007-10-21 Thread Brandon S. Allbery KF8NH
On Oct 21, 2007, at 14:40 , Maurí cio wrote: I like Haskell, and use it as my main language. However, compiling a Haskell program usually takes a lot of memory and CPU. So I was To some extent this is just a matter of Haskell not having been around that long ago: as ghc evolves, it's been

Re: [Haskell-cafe] Re: How much of Haskell was possible 20 years ago?

2007-10-21 Thread Brandon S. Allbery KF8NH
On Oct 21, 2007, at 15:21 , Maurí cio wrote: Of course. But I think of somethink like a Intel 386 with 4MB of memory. It's kinda surprising to me how many people think that just because current/modern implementations of things use memory wastefully, this is somehow mandatory. When

Re: [Haskell-cafe] Re: How much of Haskell was possible 20 years ago?

2007-10-21 Thread Brandon S. Allbery KF8NH
On Oct 21, 2007, at 15:31 , [EMAIL PROTECTED] wrote: Mauricio writes: ... But I think of somethink like a Intel 386 with 4MB of memory. It seems you decided to ignore my message. OK. Whoa there! Why assume malice? I got both his quoted response and your message at about the same time,

Re: [Haskell-cafe] Re: How much of Haskell was possible 20 years ago?

2007-10-21 Thread Brandon S. Allbery KF8NH
On Oct 21, 2007, at 21:31 , Maurí cio wrote: Anyway, what I would like would be a theoretical answer. Is there something fundamentally diferent between a C compiler and a Haskell one that makes the former fits into 30Kb but not the other? If I am not sure *modern* C would have fit into 30KB.

Re: [Haskell-cafe] What algorithm to use ?

2007-10-22 Thread Brandon S. Allbery KF8NH
On Oct 22, 2007, at 4:09 , manu wrote: However looking at the number of permutations (26! = 40329146112660563558400), quickly dampened my enthusiasm... There must be some algorithm (dynamic programming ?), that cuts down the number of calculations involved in order to find the right

Re: [Haskell-cafe] Function Types

2007-10-22 Thread Brandon S. Allbery KF8NH
On Oct 22, 2007, at 22:41 , PR Stanley wrote: f x = x x :: a f x :: b therefore f :: a - b x = a and x = b therefore a = b therefore f :: a - a Simple mappings are easy to work out. It's the more detailed stuff I'm not sure about. f g x y = g x (y x) I think you're looking for

Re: [Haskell-cafe] lazily traversing a foreign data structure

2007-10-25 Thread Brandon S. Allbery KF8NH
On Oct 25, 2007, at 13:04 , Derek Elkins wrote: Just use unsafeInterleaveIO in the obvious definition to read all the keys. That said, it's not called unsafeInterleaveIO for no reason. I think it might actually be safe in this case: if the file changes out from under your lazy I/O, far

Re: [Haskell-cafe] lazily traversing a foreign data structure

2007-10-25 Thread Brandon S. Allbery KF8NH
On Oct 25, 2007, at 14:21 , Ryan Ingram wrote: On 10/25/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: I think it might actually be safe in this case: if the file changes out from under your lazy I/O, far worse things happen in the gdbm library layer than in the unsafe-IO Haskell

Re: [Haskell-cafe] binary operator modifiers

2007-10-29 Thread Brandon S. Allbery KF8NH
On Oct 29, 2007, at 3:36 , Tim Newsham wrote: or go through the trouble of defining a bunch of binops f + g = liftM2 (+) f g n + g = return n + g f + n = f + return n read' = liftM read This looks a lot like Control.Applicative to me. -- brandon s. allbery

Re: [Haskell-cafe] do/if/then/else confusion

2007-11-01 Thread Brandon S. Allbery KF8NH
On Nov 1, 2007, at 13:47 , David Carter wrote: else rest - readdirAll d You need another do here to use the - syntax. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and

Re: [Haskell-cafe] Re: Semantics of uniqueness types for IO (Was: Why can't Haskell be faster?)

2007-11-02 Thread Brandon S. Allbery KF8NH
On Nov 2, 2007, at 6:35 , apfelmus wrote: during function evaluation. Then, we'd need a purity lemma that states that any function not involving the type *World as in- and output is indeed pure, which may be a bit tricky to prove in the presence of higher-order functions and polymorphism.

Re: [Haskell-cafe] Re: Semantics of uniqueness types for IO (Was: Why can't Haskell be faster?)

2007-11-02 Thread Brandon S. Allbery KF8NH
On Nov 2, 2007, at 11:51 , Jonathan Cast wrote: I will grant that hiding *World / RealWorld# inside IO is cleaner from a practical standpoint, though. Just not from a semantic one. On the contrary. GHC's IO newtype isn't an implementation of IO in Haskell at all. It's an implementation in

Re: [Haskell-cafe] The question of ByteString

2007-11-02 Thread Brandon S. Allbery KF8NH
On Nov 2, 2007, at 17:35 , Andrew Coppin wrote: These are the things I'm thinking about. Is there some deep theoretical reason why things are the way they are? Or is it merely that nobody has yet had time to make something better? ByteString solves the problem of text strings (and raw

Re: [Haskell-cafe] The question of ByteString

2007-11-03 Thread Brandon S. Allbery KF8NH
On Nov 3, 2007, at 5:34 , Andrew Coppin wrote: (BTW, anybody have any clue what's happening with stream fusion? I remember reading the paper saying hey, this is how it works and it's cool and we're going to try to replace the whole list library with new stream implementations, but that's

Re: [Haskell-cafe] Monte Carlo Pi calculation (newbie learnings)

2007-11-05 Thread Brandon S. Allbery KF8NH
On Nov 5, 2007, at 16:21 , Alex Young wrote: C:\Users\Alex\Documents\HaskellLearning\MonteCarloghc BetterPi.hs C:\Users\Alex\Documents\HaskellLearning\MonteCarlomain.exe 100 Stack space overflow: current size 8388608 bytes. Use `+RTS -Ksize' to increase it. But:

Re: [Haskell-cafe] Go parallel

2007-11-05 Thread Brandon S. Allbery KF8NH
On Nov 5, 2007, at 15:46 , Andrew Coppin wrote: You can spark a thread for each computation of fn, like such: writeArray framebuffer p `parApp` fn p where parApp f x = x `par` f x Hmm, that may be a little *too* fine-grained. (But then, just because I spark 175,862 threads doesn't mean

Re: [Haskell-cafe] Re: ghc -e with standard input

2007-11-05 Thread Brandon S. Allbery KF8NH
On Nov 6, 2007, at 0:16 , Maurí cio wrote: Actually, what I want is to select a region of text from emacs and get back the result of that evaluated as haskell code. So, I need something that is fast to type, since I'll use it all the time. Maybe I should learn how to write a small shell script

Re: [Haskell-cafe] Re: ghc -e with standard input

2007-11-05 Thread Brandon S. Allbery KF8NH
On Nov 6, 2007, at 0:48 , Maurí cio wrote: Brandon S. Allbery KF8NH escreveu: On Nov 6, 2007, at 0:16 , Maurí cio wrote: Actually, what I want is to select a region of text from emacs and get back the result of that evaluated as haskell code. So, I need something that is fast to type, since

Re: [Haskell-cafe] An exceptional exception

2007-11-09 Thread Brandon S. Allbery KF8NH
On Nov 9, 2007, at 15:01 , Andrew Coppin wrote: 4. Not actually related to exceptions, but doesDirectoryExist C:\ yields False. (Even though getDirectoryContents C:\ yields the correct result.) So I can't even use that to filter out invalid directory names. This is an ancient and

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Brandon S. Allbery KF8NH
On Nov 11, 2007, at 12:16 , Andrew Coppin wrote: However, it seems the general point of confusion is that writing (say) a minimally-working C compiler intuitively seems quite easy (after all, C is an extremely low-level language), whereas the constructs in Haskell bear no resemblence to

Re: [Haskell-cafe] Somewhat random history question - chicken and egg

2007-11-11 Thread Brandon S. Allbery KF8NH
On Nov 11, 2007, at 17:26 , [EMAIL PROTECTED] wrote: Andrew Coppin writes: Brent Yorgey wrote: Expressiveness certainly makes it easier, but nothing (other than sanity...) stops you from writing a Haskell compiler in, say, COBOL. *I* would stop you. Friends don't let friends

Re: [Haskell-cafe] Re: Weird ghci behaviour?

2007-11-13 Thread Brandon S. Allbery KF8NH
On Nov 13, 2007, at 13:32 , Dan Piponi wrote: On Nov 13, 2007 3:00 AM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: Dan, can you suggest any words we could add to the documentation that would have prevented you stumbling? I guess the thing that would have helped best would

Re: [Haskell-cafe] Re: Weird ghci behaviour?

2007-11-14 Thread Brandon S. Allbery KF8NH
On Nov 14, 2007, at 3:28 , Simon Peyton-Jones wrote: I agree that an informative error message is worth 100 manual pages. The trouble is that at this stage GHCi doesn't even *know* that 'x' ever existed, because it's not mentioned in the interface file, so it's hard to do even give the

Re: [Haskell-cafe] why PArr slower than list ?

2007-11-14 Thread Brandon S. Allbery KF8NH
On Nov 14, 2007, at 21:50 , Albert Lee wrote: dotp :: Num a = [:a:] - [:a:] - a You're forcing Num a = a here, whereas the list one probably specializes to Integer. Seems like a bad way to go to me; polymorphism is expensive. (Whether it's *that* expensive, I couldn't tell you.) --

Re: [Haskell-cafe] Sillyness in the standard libs.

2007-11-19 Thread Brandon S. Allbery KF8NH
On Nov 19, 2007, at 16:06 , Arthur van Leeuwen wrote: here is a puzzle for you: try converting a System.Posix.Types.EpochTime into either a System.Time.CalendarTime or a Data.Time.Clock.UTCTime without going through read . show or a similar detour through strings. fromEnum and/or toEnum

Re: [Haskell-cafe] expanded standard lib

2007-11-19 Thread Brandon S. Allbery KF8NH
On Nov 19, 2007, at 15:13 , Neil Mitchell wrote: - The packages seem to be of quite variable quality. Some are excellent, some are rather poor (or just not maintained any more). The problem is that only one person gets to comment on the quality of a library, the author, who is about the

Re: [Haskell-cafe] expanded standard lib

2007-11-19 Thread Brandon S. Allbery KF8NH
On Nov 19, 2007, at 15:47 , Radosław Grzanka wrote: If you look at the stability tag of ghc libraries you will see that a lot of them are marked as provisional (Network.URI for example) or experimental (Control.Monad.Trans). This may not refer to what most people care about; the experimental

Re: [Haskell-cafe] Sillyness in the standard libs.

2007-11-19 Thread Brandon S. Allbery KF8NH
On Nov 19, 2007, at 16:50 , Henning Thielemann wrote: On Mon, 19 Nov 2007, Brandon S. Allbery KF8NH wrote: fromEnum and/or toEnum are helpful for this kind of thing, and I am occasionally tempted to bind cast = toEnum . fromEnum because I need it so much. Really? I'd like to know which

Re: [Haskell-cafe] Sillyness in the standard libs.

2007-11-19 Thread Brandon S. Allbery KF8NH
On Nov 19, 2007, at 17:10 , Brandon S. Allbery KF8NH wrote: CTime; POSIX allows (or used to allow) it to be a floating type in order to allow some non-UNIXlikes to represent POSIX times. But given that CTime is Enum, Foreign.C.Types already violates this; so why isn't it Hrm

  1   2   3   4   5   6   7   8   9   10   >