Re: [Haskell-cafe] Fast sorting with Bytestring

2008-06-18 Thread Stefan O'Rear
On Wed, Jun 18, 2008 at 08:19:10PM +0200, Georg Sauthoff wrote: Hi, I played a bit around with the nice bytestring package. At some point I implemented a simple sorting program, because I needed line-sorting a file with a custom line-compare function. I was a bit surprised, that the

Re: [Haskell-cafe] Glome.hs-0.3 and other things

2008-04-21 Thread Stefan O'Rear
On Mon, Apr 21, 2008 at 07:54:24PM +0100, Andrew Coppin wrote: Jim Snow wrote: Useful references: What Every Programmer Needs to Know About Memory http://lwn.net/Articles/250967/ After studying all this material, I do find myself feeling slightly concerned. The article shows how in C / C++

Re: [Haskell-cafe] The range operator

2008-04-04 Thread Stefan O'Rear
On Fri, Apr 04, 2008 at 08:58:06PM +0100, PR Stanley wrote: Hi folks [x, y..z] What's the role of x? Cheers, Paul First number in the output; also all pairs differ as much as the first two numbers do. Try e.g [1, 2 .. 10] and [0, 2 .. 10] Stefan signature.asc Description: Digital

Re: [Haskell-cafe] compilation succeeds -- execution fails

2008-03-30 Thread Stefan O'Rear
On Sat, Mar 29, 2008 at 10:21:32PM -0700, Jason Dusek wrote: Stefan O'Rear [EMAIL PROTECTED] wrote: The only type that you are allowed to assume corresponds to a C int is CInt, in the Foreign.C.Types module. This probably isn't the problem, but it could make problems of its own on a 64

Re: [Haskell-cafe] compilation succeeds -- execution fails

2008-03-29 Thread Stefan O'Rear
On Fri, Mar 28, 2008 at 11:33:52AM -0700, Jason Dusek wrote: Thomas Schilling [EMAIL PROTECTED] wrote: Did you try removing all .hi and .o files? Yes. I tried it again this morning, and I've got the same error -- same unknown symbol, c. I don't have trouble with most Haskell

Re: [Haskell-cafe] Termination of substitution

2008-03-12 Thread Stefan O'Rear
On Wed, Mar 12, 2008 at 09:05:03PM +, Neil Mitchell wrote: Hi I'm trying to show that a system of rules for manipulating Haskell expressions is terminating. The rules can be applied in any order, to any subexpression - and there is a problem if there is any possible infinite sequence.

Re: [Haskell-cafe] Termination of substitution

2008-03-12 Thread Stefan O'Rear
On Wed, Mar 12, 2008 at 02:30:41PM -0700, Taral wrote: On 3/12/08, Neil Mitchell [EMAIL PROTECTED] wrote: However, I don't believe this expression is type safe in Haskell. Using higher-order polymorphism: f (x :: forall a. a - a) = x x Interestingly, this doesn't work - f is a

Re: [Haskell-cafe] fast integer base-2 log function?

2008-02-26 Thread Stefan O'Rear
On Tue, Feb 26, 2008 at 09:33:57PM +, Jens Blanck wrote: {-# LANGUAGE MagicHash #-} import GHC.Exts import Data.Bits -- experiment with using a LUT here (hint: FFI + static arrays in C) ilog2i0, ilog2i1, ilog2i2, ilog2i3, ilog2i4 :: Int - Int - Int ilog2i0 k x | x .. 0x

Re: [Haskell-cafe] Binary IEEE floating point format for AMQP

2008-02-24 Thread Stefan O'Rear
On Sun, Feb 24, 2008 at 12:21:00PM +, Paul Johnson wrote: I'm working on an implementation of the framing layer for AMQP (www.amqp.org). I almost had 0.9 finished when I found they had released the spec for 0.10, so I have to redo quite a lot of work. Amongst the new features of 0.10

Re: [Haskell-cafe] Where does ~ come from?

2008-02-20 Thread Stefan O'Rear
On Wed, Feb 20, 2008 at 07:18:42PM -0500, Steve Lihn wrote: If ~ does not have any special meaning and it could be ### or xyz, then how does GHC know to print a ~ b, but not ~ a b a ### b, but not ### a b xyz a b, but not a `xyz` b Simply because xyz is alphanumeric? Yes. Stefan

Re: [Haskell-cafe] GHC strange behavior

2008-02-16 Thread Stefan O'Rear
On Sun, Feb 17, 2008 at 03:07:15AM +0300, Ruslan Evdokimov wrote: 2008/2/17, Jonathan Cast [EMAIL PROTECTED]: Wild guess? If you leave o as a thunk, to be evaluated once the program has e, then it has numbers, so you keep the entire 10-million entry list in memory. Evaluating e and o in

Re: [Haskell-cafe] GHC strange behavior

2008-02-16 Thread Stefan O'Rear
On Sun, Feb 17, 2008 at 03:41:52AM +0300, Ruslan Evdokimov wrote: 2008/2/17, Stefan O'Rear [EMAIL PROTECTED]: This makes perfect sense - -N2 tells GHC to use two threads, and if you run two threads on a single-processor system it's implemented by running the threads alternatingly (around

Re: [Haskell-cafe] Doubting Haskell

2008-02-16 Thread Stefan O'Rear
On Sat, Feb 16, 2008 at 05:11:59PM -0800, Bryan O'Sullivan wrote: Donn Cave wrote: But in Haskell, you cannot read a file line by line without writing an exception handler, because end of file is an exception! Ah, yet another person who has never found System.IO.hIsEOF :-) Whereas in

Re: [Haskell-cafe] Doubting Haskell

2008-02-16 Thread Stefan O'Rear
On Sat, Feb 16, 2008 at 06:23:54PM -0800, Bryan O'Sullivan wrote: Stefan O'Rear wrote: I'll bet that breaks horribly in the not-so-corner case of /dev/tty. Actually, it doesn't. It seems to do a read behind the scenes if the buffer is empty, so it blocks until you type something. Well

Re: [Haskell-cafe] fast integer base-2 log function?

2008-02-14 Thread Stefan O'Rear
On Thu, Feb 14, 2008 at 08:23:29PM -0800, Uwe Hollerbach wrote: Stefan's routine is, as expected, much much faster still: I tested the first two routines on numbers with 5 million or so bits and they took ~20 seconds of CPU time, whereas I tested Stefan's routine with numbers with 50 million

Re: [Haskell-cafe] A question about monad laws

2008-02-11 Thread Stefan O'Rear
On Mon, Feb 11, 2008 at 01:59:09PM +, Neil Mitchell wrote: Hi (x = f) = g == x = (\v - f v = g) Or stated another way: (x = f) = g == x = (f = g) Which is totally wrong, woops. See this page for lots of details about the Monad Laws and quite a nice explanation of where you

Re: [Haskell-cafe] Proper exception handling

2008-02-10 Thread Stefan O'Rear
On Sun, Feb 10, 2008 at 02:49:39PM -0500, Thomas DuBuisson wrote: Cafe, Fact 1: ghc{,i} does not crash when executing this code. Fact 2: I do not want this to crash. Question: Is there some theoretical window between the 'catchDyn' exception handling and the recursive call to

Re: [Haskell-cafe] Slightly Offtopic in Part

2008-02-08 Thread Stefan O'Rear
On Fri, Feb 08, 2008 at 06:47:51PM -0800, Ryan Ingram wrote: I'm assuming you mean the rule described in http://en.wikibooks.org/wiki/Formal_Logic/Sentential_Logic/Inference_Rules type Disj a b = Either a b disj_elim :: Disj a b - (a - c) - (b - c) - c disj_elim (Left a) a2c b2c = a2c

Re: [Haskell-cafe] Mutable arrays

2008-02-06 Thread Stefan O'Rear
On Wed, Feb 06, 2008 at 08:57:43PM +, Andrew Butterfield wrote: In Clean, we not only have explicit access to the world, but we can partition it. Simplifying somewhat, we could open up pairs of file-handle (f1.in,f1.out), (f2.in,f2,out) ... (fn.in,fn.out), which does have to be done

Re: [Haskell-cafe] Mutable arrays

2008-02-05 Thread Stefan O'Rear
On Tue, Feb 05, 2008 at 06:00:38PM -0600, John Lato wrote: -- let ary_max = foldl1' max $ elems $ unsafeFreeze myArray If you use a boxed array type (IOArray or STArray) for myArray, and compiled with GHC, no copying is necessary (you may need to use type annotations to guarantee this).

Re: [Haskell-cafe] Haskell maximum stack depth

2008-02-04 Thread Stefan O'Rear
On Mon, Feb 04, 2008 at 10:13:12PM +, Adrian Hey wrote: Also remember that this behaviour never wastes more than 50% of the stack, which is a relatively small amount. Only if the stack is relatively small. Would you say the same about heap, or about a stack that only needed 50% of heap

Re: [Haskell-cafe] Mutable arrays

2008-02-02 Thread Stefan O'Rear
On Sat, Feb 02, 2008 at 12:57:47PM +, Rodrigo Queiro wrote: This is my attempt at some nicer code: maximum' (x:xs) = foldl' max x xs maximum' _ = undefined modifyArray :: (MArray a e m, Ix i) = (e - e) - a i e - m () modifyArray fn arr = do bounds - getBounds arr forM_

Re: [Haskell-cafe] derive Pretty?

2008-01-31 Thread Stefan O'Rear
On Thu, Jan 31, 2008 at 03:00:15PM -0800, Greg Fitzgerald wrote: Is it possible to automatically derive instances of Prettyhttp://haskell.org/ghc/docs/latest/html/libraries/haskell-src/Language-Haskell-Pretty.html? If no, what do most do when it comes to pretty-printing large data types? It

Re: [Haskell-cafe] Haskell maximum stack depth

2008-01-29 Thread Stefan O'Rear
On Tue, Jan 29, 2008 at 07:38:24PM +, Neil Mitchell wrote: A lot also depends on compiler (and associated rts), such as whether or not it translates to CPS, thereby in effect building a stack (in all but name) on the heap. If you burn a lot of heap, for not much gain, that's still a

Re: [Haskell-cafe] Haskell maximum stack depth

2008-01-29 Thread Stefan O'Rear
On Tue, Jan 29, 2008 at 09:28:56AM +, Neil Mitchell wrote: Hi Adrian, The bug is in ghc stack management. Why is it so important that the stack size is arbitrarily limited? It's not, but it makes some things easier and faster. A better question is why is it important for the stack

Re: [Haskell-cafe] Irrefutable pattern love and new regex engine.

2008-01-22 Thread Stefan O'Rear
On Tue, Jan 22, 2008 at 02:09:05PM -0800, Ryan Ingram wrote: On Tue, 2008-01-22 at 11:55 -0500, Michael Speer wrote: rexn ns pps = let ( ~( xs , rps ) , ~( ~( nxs ) , ~( rxs , rrps ) ) ) = ( exn nxs pps , Not one of

Re: [Haskell-cafe] where is the FFI glue code for STM?

2008-01-11 Thread Stefan O'Rear
On Fri, Jan 11, 2008 at 06:15:52PM -0600, Galchin Vasili wrote: Hello, I see where the top level code (written in Haskell)for STM. I have found STM.c;however, I can't seem to find the FFI glue code.? Thanks, Vasili There isn't any. readTVar# etc are primops. Stefan signature.asc

Re: [Haskell-cafe] Re: Is there anyone out there who can translate C# generics into Haskell?

2008-01-08 Thread Stefan O'Rear
On Tue, Jan 08, 2008 at 09:10:59PM +0100, Achim Schneider wrote: Don Stewart [EMAIL PROTECTED] wrote: jules: Achim Schneider wrote: things like data State = State { winSize :: IORef Size , t :: IORef Int , fps :: IORef Float ,

Re: [Haskell-cafe] Displaying # of reductions after each computation in ghci?

2008-01-08 Thread Stefan O'Rear
On Tue, Jan 08, 2008 at 09:48:37PM +, Fernando Rodriguez wrote: Is there a way to configure ghci to display the number of reuctions after each compution (as in winhugs)? No. (rambling explanation snipped awaiting further request) Stefan signature.asc Description: Digital signature

Re: [Haskell-cafe] Trouble with types

2007-12-24 Thread Stefan O'Rear
On Tue, Dec 25, 2007 at 08:11:34AM +0300, Konstantin Vladimirov wrote: [haskell] module TypeTrouble where class FirstClass a where firstFunction :: (SecondClass b) = a - b class SecondClass a where secondFunction :: a - Double [/haskell] I need, the firstFunction of

Re: [Haskell-cafe] Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Stefan O'Rear
On Sat, Dec 22, 2007 at 06:00:29PM +, Joost Behrends wrote: Hi, while still working on optimizing (naively programmed) primefactors i watched a very strange behavior of ghc. The last version below takes 2.34 minutes on my system for computing 2^61+1 = 3*768614,336404,564651. Importing

Re: [Haskell-cafe] Is a type synonym declaration really a synonym ?

2007-12-22 Thread Stefan O'Rear
On Sat, Dec 22, 2007 at 10:22:46PM +0100, alpheccar wrote: Can someone confirm me that: type TA = A :+: B type TB = C :+: D type T = TA :+: TB is not equivalent to type T = A :+: B :+: C :+: D where I have defined infixr 6 :+: data (f :+: g) data A data B data C data D I have a

Re: [Haskell-cafe] Re: Importing Data.Char speeds up ghc around 70%

2007-12-22 Thread Stefan O'Rear
On Sat, Dec 22, 2007 at 04:40:00PM -0500, Sterling Clover wrote: I'm curious if you get the same performance difference importing GHC.Listinstead of Data.Char? I chased some dependencies, and Data.Char imports GHC.Arr, which in turn imports GHC.List, which provides a bunch of fusion rules

Re: [Haskell-cafe] Why does this blow the stack?

2007-12-21 Thread Stefan O'Rear
On Fri, Dec 21, 2007 at 03:16:17PM -0800, David Benbennick wrote: On Dec 21, 2007 2:30 PM, Don Stewart [EMAIL PROTECTED] wrote: dbenbenn: Thanks for fixing this. But doesn't GHC have strictness analysis? Sure does! The problem here was an explicit recusive loop though, with just

Re: [Haskell-cafe] Smart Constructor Puzzle

2007-12-20 Thread Stefan O'Rear
On Thu, Dec 20, 2007 at 11:39:42PM -0500, Ronald Guida wrote: data PZero = PZero deriving (Show) data PSucc a = PSucc a deriving (Show) type P1 = PSucc PZero type P2 = PSucc P1 type P3 = PSucc P2 -- etc ... Now here's the puzzle. I want to create a function vecLength that

Re: [Haskell-cafe] class default method proposal

2007-12-11 Thread Stefan O'Rear
On Tue, Dec 11, 2007 at 02:20:52PM +, Duncan Coutts wrote: I'd just like to float an idea that's related to the Class Alias proposal[1] but is perhaps somewhat simpler. We all know that Functor should have been a superclass of Monad, and indeed we now know that Applicative should be too.

Re: [Haskell-cafe] ST Monad - what's wrong?

2007-12-09 Thread Stefan O'Rear
On Sun, Dec 09, 2007 at 12:11:42PM +0100, Nicu Ionita wrote: Hi, I'm trying to use the ST monad in order to turn an almost pure function into a pure one: reading a precalculated list of primes into a prime set. But the following code brings an error: primes :: Set Integer primes =

Re: [Haskell-cafe] Problem with Gtk2hs

2007-12-08 Thread Stefan O'Rear
On Sat, Dec 08, 2007 at 08:33:36PM +, Andrew Coppin wrote: I just spent the evening writing a library that's a thin layer over Gtk2hs. It took an age to get it to compile, but eventually it worked. Yay! When I ran it, I got this: Test2: gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp:58:0: No

Re: [Haskell-cafe] Graph theory analysis of Haskell code

2007-12-06 Thread Stefan O'Rear
On Fri, Dec 07, 2007 at 10:16:43AM +1000, Ivan Miljenovic wrote: On 07/12/2007, Tommy McGuire [EMAIL PROTECTED] wrote: I was actually thinking that something like that would be more valuable for a language like C, where types are not represented in the control flow. By the way, in a

Re: [Haskell-cafe] ghc overlapping instances

2007-12-04 Thread Stefan O'Rear
On Tue, Dec 04, 2007 at 03:36:20PM +0100, Steffen Mazanek wrote: Hello, I want to quickcheck a property on a datatype representing programs (=[Stmt]) and need to define a specific instance instance Arbitrary [Stmt] (mainly to restrict the size of the list). In quickcheck an instance

Re: [Haskell-cafe] isSpace

2007-12-04 Thread Stefan O'Rear
On Tue, Dec 04, 2007 at 05:13:19PM +, Ryan Bloor wrote: hi I am having trouble with a function that is supposed to eliminate spaces from the start of a String and return the resulting string. I reckon a dropWhile could be used but the isSpace bit is causing me problems... words ::

Re: [Haskell-cafe] Why is this strict in its arguments?

2007-12-04 Thread Stefan O'Rear
On Tue, Dec 04, 2007 at 09:41:36PM +, Paulo J. Matos wrote: Hello all, As you might have possibly read in some previous blog posts: http://users.ecs.soton.ac.uk/pocm06r/fpsig/?p=10 http://users.ecs.soton.ac.uk/pocm06r/fpsig/?p=11 we (the FPSIG group) defined: data BTree a = Leaf a

Re: [Haskell-cafe] Why is this strict in its arguments?

2007-12-04 Thread Stefan O'Rear
On Tue, Dec 04, 2007 at 03:07:01PM -0800, Ryan Ingram wrote: Is there a reason why strictness is defined as f _|_ = _|_ instead of, for example, forall x :: Exception. f (throw x) = throw x where an exception thrown from pure code is observable in IO. In the second case we need to

Re: [Haskell-cafe] Why is this strict in its arguments?

2007-12-04 Thread Stefan O'Rear
On Tue, Dec 04, 2007 at 03:35:28PM -0800, Ryan Ingram wrote: On 12/4/07, Stefan O'Rear [EMAIL PROTECTED] wrote: Is there a reason why 2 + 2 is defined as 4 instead of, for example, 5? Wow. That wasn't really necessary. 4 has a clear meaning (the number after the number after

Re: [Haskell-cafe] Why is this strict in its arguments?

2007-12-04 Thread Stefan O'Rear
On Tue, Dec 04, 2007 at 07:43:36PM -0800, Ryan Ingram wrote: On 12/4/07, Stefan O'Rear [EMAIL PROTECTED] wrote: When you see an expression of the form: f a you generally want to evaluate a before applying; but if a is _|_, this will only give the correct result if f a = _|_. Merely

Re: [Haskell-cafe] foild function for expressions

2007-12-03 Thread Stefan O'Rear
On Mon, Dec 03, 2007 at 09:27:45PM -0600, Derek Elkins wrote: On Mon, 2007-12-03 at 19:13 -0800, Stefan O'Rear wrote: On Mon, Dec 03, 2007 at 09:18:18AM -0800, Carlo Vivari wrote: Hi! I'm a begginer in haskell and I have a problem with an exercise, I expect someone could help me

Re: [Haskell-cafe] foild function for expressions

2007-12-03 Thread Stefan O'Rear
On Mon, Dec 03, 2007 at 09:18:18AM -0800, Carlo Vivari wrote: Hi! I'm a begginer in haskell and I have a problem with an exercise, I expect someone could help me: In one hand I have a declaration of an algebra data, like this: data AlgExp a = AlgExp { litI :: Int - a, litB :: Bool

Re: [Haskell-cafe] Advice for clean code.

2007-12-03 Thread Stefan O'Rear
On Mon, Dec 03, 2007 at 08:47:48PM -0600, David McBride wrote: I am still in the early stages learning haskell, which is my first foray into functional programming. Well there's no better way to learn than to write something, so I started writing a game. Mostly the thing looks good so far,

Re: [Haskell-cafe] Looking for smallest power of 2 = Integer

2007-12-03 Thread Stefan O'Rear
On Mon, Dec 03, 2007 at 11:40:14PM -0500, Brandon S. Allbery KF8NH wrote: On Dec 3, 2007, at 23:36 , Dan Piponi wrote: Is there anything in any of the interfaces to Integer that will allow me to quickly find the highest bit set in an Integer? If not, does Isn't Integer unlimited (well,

Re: [Haskell-cafe] Trees

2007-12-02 Thread Stefan O'Rear
On Mon, Dec 03, 2007 at 08:13:57AM +0100, Adrian Neumann wrote: Good morning, as an exercise for my Algorithms and Programming course I have to program a couple of simple functions over trees. Until now everything we did in Java could be done in Haskell (usually much nicer too) using the

Re: [Haskell-cafe] Re: Modelling a mutable variable store

2007-12-01 Thread Stefan O'Rear
On Sun, Dec 02, 2007 at 03:54:05AM +, Kannan Goundan wrote: On Sat, 01 Dec 2007 21:22:53 -0600, Derek Elkins wrote: Use ST. First-class state isn't too great unless you specifically want that. I did try using ST but ran into a problem because its type variable (s) ended up

Re: [Haskell-cafe] Haskell interface file (.hi) format?

2007-12-01 Thread Stefan O'Rear
On Sun, Dec 02, 2007 at 05:45:48AM +0100, Tomasz Zielonka wrote: On Fri, Nov 30, 2007 at 08:55:51AM +, Neil Mitchell wrote: Hi Prelude :b Control.Concurrent.MVar module 'Control.Concurrent.MVar' is not interpreted :b now defaults to :breakpoint, you want :browse That's

Re: [Haskell-cafe] A tale of Project Euler

2007-11-29 Thread Stefan O'Rear
On Thu, Nov 29, 2007 at 09:10:16PM +, Andrew Coppin wrote: Sebastian Sylvan wrote: On Nov 29, 2007 6:43 PM, Andrew Coppin [EMAIL PROTECTED] wrote: I don't understand the ST monad. There's not a whole lot to understand if you just want to use it (though it's all very cool

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

2007-11-29 Thread Stefan O'Rear
On Thu, Nov 29, 2007 at 09:48:22AM +0100, apfelmus wrote: Well, I only remember that it took _me_ a page of C code :D Basically due to a hand-coded intset and user interaction (no REPL for C, after all). In my C programming, I've taken to using gdb as a REPL: [EMAIL PROTECTED]:/tmp$ vi foo.c

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

2007-11-29 Thread Stefan O'Rear
On Thu, Nov 29, 2007 at 12:40:00PM +, Simon Marlow wrote: What I'd *really* like to see is a bunch of links on the front page leading to pages that describe the main differences between Haskell and some other language (C, Python, Java, C#, F#, ...). The easiest way to grasp what

Re: [Haskell-cafe] Re: nhc vs ghc

2007-11-24 Thread Stefan O'Rear
On Sat, Nov 24, 2007 at 10:44:45AM +, Neil Mitchell wrote: Hi can anyone provide a concise list of the major differences between nhc98 and ghc? for example, can i build a cabal package with nhc98? i get that ghc and nhc98 are not interchangeable, otherwise i am not sure The

Re: [Haskell-cafe] Pretty-printing peg solitaire boards

2007-11-24 Thread Stefan O'Rear
On Sun, Nov 25, 2007 at 03:40:26AM -0200, Maurí­cio wrote: Hi, I'm trying to pretty-print (with Text . PrettyPrint . HughesPJ) a set of peg solitaire boards. No matter what I try, I always get this: 00# 00# #00 000 000 000 000 : 00# 00#

Re: [Haskell-cafe] Over-allocation

2007-11-21 Thread Stefan O'Rear
On Wed, Nov 21, 2007 at 01:31:35PM +, Gracjan Polak wrote: Hi, My program is eating too much memory: The source.txt is 800kb, and I expect files of size 100 times more, say 80MB, so using -H800M will not help here much. The profile -p says: COST CENTRE

Re: [Haskell-cafe] Tetris

2007-11-20 Thread Stefan O'Rear
On Tue, Nov 20, 2007 at 07:27:48PM +, Andrew Coppin wrote: (Nitpick: Don't you need Gtk2hs in order to *use* OpenGL? I mean, you have to open a window to render into somehow, and that's outside the OpenGL standard...) You need *something*, but it need not be Gtk. GLUT and GLX will also

Re: [Haskell-cafe] gtk2hs problem

2007-11-20 Thread Stefan O'Rear
On Tue, Nov 20, 2007 at 03:18:03PM -0800, Gregory Propf wrote: I've written a small program using the gtk2hs library and it crashes at unpredictable times with X windows errors like the one below. I looked for the messages online and found various people talking about buggy gtk libraries

Re: [Haskell-cafe] Translations and Haskell

2007-11-19 Thread Stefan O'Rear
On Mon, Nov 19, 2007 at 05:39:44PM -0800, Jeremy Shaw wrote: You might also allow: i18n (multine ++ string) provided that all the arguments of ++ are string literals. This is because, AFAIK, there is no other way to split a long string across multiple source lines in a portable

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 04:01:34PM +, Andrew Coppin wrote: Suppose I write something like this: foo :: [Int] foo = concat (replicate 4 [4,7,2,9]) The value of foo is completely determined at compile-time. So, will the compiler generate calls to concat and replicate, or will it just

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 04:10:58PM +, Andrew Coppin wrote: Stefan O'Rear wrote: On Sat, Nov 17, 2007 at 04:01:34PM +, Andrew Coppin wrote: Suppose I write something like this: foo :: [Int] foo = concat (replicate 4 [4,7,2,9]) The value of foo is completely determined

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 04:31:33PM +, Andrew Coppin wrote: Both. A curious feature of the STG machine is that constructor thunks and evaluated data are represented identically in memory. Ooo... As per the Lambdacats Boxed cat has a uniform representation? Well, presumably the guys who

Re: [Haskell-cafe] Small optimisation question

2007-11-17 Thread Stefan O'Rear
On Sat, Nov 17, 2007 at 12:39:14PM -0600, Jake McArthur wrote: On Nov 17, 2007, at 11:26 AM, Stefan O'Rear wrote: The STG-machine was brilliant when it was designed, but times have changed. In particular, indirect jumps are no longer cheap. Pointer tagging has allowed STG to hobble

Re: [Haskell-cafe] Using Data.Binary for compression

2007-11-14 Thread Stefan O'Rear
On Wed, Nov 14, 2007 at 10:03:52PM -0800, Chad Scherrer wrote: Hi, I'd like to be able to use Data.Binary (or similar) for compression. Say I have an abstract type Symbol, and for each value of Symbol I have a representation in terms of some number of bits. For compression to be efficient,

Re: [Haskell-cafe] Performance help

2007-11-13 Thread Stefan O'Rear
On Tue, Nov 13, 2007 at 02:45:33PM -0800, Justin Bailey wrote: On Nov 13, 2007 2:21 PM, Ryan Ingram [EMAIL PROTECTED] wrote: Never mind, I realized this is a ring buffer with `mod` s. That's another slow operation when you're doing code as tight as this. If you can guarantee the ring is

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

2007-11-11 Thread Stefan O'Rear
On Sun, Nov 11, 2007 at 11:07:29AM +, Neil Mitchell wrote: Hi ...if GHC is written in Haskell, how the heck did they compile GHC in the first place? GHC was not the first Haskell compiler, hbc was the main compiler at some point, so I suspect they used hbc. There was also lazy ML

Re: [Haskell-cafe] Trouble using unboxed arrays

2007-11-10 Thread Stefan O'Rear
On Sat, Nov 10, 2007 at 11:09:54AM -0800, Justin Bailey wrote: I would like to create a data structure that uses an unboxed array as one of its components. I would like the data structure to be parameterized over the type of the elements of the array. Further, I'd like to build the array using

Re: [Haskell-cafe] MD5?

2007-11-09 Thread Stefan O'Rear
On Fri, Nov 09, 2007 at 09:05:58PM +, Andrew Coppin wrote: The MD5SUM.EXE file I have chokes if you ask it to hash a file in another directory. It will hash from stdin, or from a file in the current directory, but point-blank refuses to hash anything else. So I'd have to write my

Re: [Haskell-cafe] Building Haskell stuff on Windows

2007-11-09 Thread Stefan O'Rear
On Fri, Nov 09, 2007 at 07:38:28PM +, Andrew Coppin wrote: ...there's a libraries list? (And a Cabal list??) http://haskell.org/mailman/listinfo/ Stefan signature.asc Description: Digital signature ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Fri, Nov 09, 2007 at 01:39:55AM +0100, Thomas Schilling wrote: On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs Even for GCC (/not/ G_H_C)? No, GCC implements -Ox properly. I

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 05:03:54PM -0800, Stefan O'Rear wrote: On Fri, Nov 09, 2007 at 01:39:55AM +0100, Thomas Schilling wrote: On Thu, 2007-11-08 at 16:24 -0800, Stefan O'Rear wrote: On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs

Re: [Haskell-cafe] Haskell performance question

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 07:57:23PM +0100, Thomas Schilling wrote: $ ghc --make -O2 ghc-bench.hs and got: $ time ./ghc-bench 2.0e7 real0m0.714s user0m0.576s sys 0m0.132s $ time ./ghcbC 2000.00 real0m0.305s user0m0.164s sys 0m0.132s This

Re: [Haskell-cafe] MD5? (was: Haskell performance question)

2007-11-08 Thread Stefan O'Rear
On Thu, Nov 08, 2007 at 06:14:20PM -0500, Thomas M. DuBuisson wrote: Glad you asked! http://sequence.complete.org/node/367 I just posted that last night! Once I get a a community.haskell.org login I will put the code on darcs. The short of it it: 1) The code is still ugly, I haven't

Re: [Haskell-cafe] Memory-mapped arrays? (IArray interfaces, slices, and so on)

2007-11-07 Thread Stefan O'Rear
On Wed, Nov 07, 2007 at 10:10:16PM +, Jules Bean wrote: Joel Reymont wrote: Is there such a thing as memory-mapped arrays in GHC? In principle, there could be an IArray instance to memory-mapped files. (There could also be a mutable version, but just the IArray version would be

Re: [Haskell-cafe] [OT] GHC uninstall on Linux

2007-11-07 Thread Stefan O'Rear
On Wed, Nov 07, 2007 at 10:41:53AM +0100, Dusan Kolar wrote: Hello all, I use tar.bz2 binary distribution of GHC compiler as my distro does not use any supported packaging system. Everything is fine, but... I want to install the new version of the GHC compiler. Is there any (easy) way, how

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-10-31 Thread Stefan O'Rear
On Wed, Oct 31, 2007 at 03:37:12PM +, Neil Mitchell wrote: Hi I've been working on optimising Haskell for a little while (http://www-users.cs.york.ac.uk/~ndm/supero/), so here are my thoughts on this. The Clean and Haskell languages both reduce to pretty much the same Core language,

Re: [Haskell-cafe] Re: Why can't Haskell be faster?

2007-10-31 Thread Stefan O'Rear
On Thu, Nov 01, 2007 at 02:30:17AM +, Neil Mitchell wrote: Hi I don't think the register allocater is being rewritten so much as it is being written: From talking to Ben, who rewrote the register allocator over the summer, he said that the new graph based register allocator is

Re: [Haskell-cafe] Newbie Question on Setting the GHC Search Path

2007-10-29 Thread Stefan O'Rear
On Mon, Oct 29, 2007 at 04:25:45AM -0700, Benjamin L. Russell wrote: One factor that is slightly unusual about this phenomenon is that it only occurs with GHC, but not with Hugs 98. Typing :cd D:\From C Drive\Documents and Settings\DekuDekuplex\Programming Practice\Haskell\GHC Are you

Re: [Haskell-cafe] Re: [Haskell] Image manipulation

2007-10-29 Thread Stefan O'Rear
On Mon, Oct 29, 2007 at 02:39:58PM -0700, Tim Chevalier wrote: [redirecting to haskell-cafe] On 10/29/07, Brent Yorgey [EMAIL PROTECTED] wrote: Haskell is a wonderful language, so I hate to say this...but personally I don't see the benefit of using Haskell here, unless the manipulations you

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 11:26:46AM -0400, Prabhakar Ragde wrote: Jerzy Karczmarczuk wrote: Just a trivial comment... 1. Don't speak about comparing *languages* when you compare *algorithms*, and in particular data structures. 2. Please, DO code the above in C, using linked lists. Compare

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 08:40:28PM +0100, Daniel Fischer wrote: Am Sonntag, 28. Oktober 2007 20:09 schrieb Derek Elkins: snip That fits with my experience writing low level numeric code -- Integer can be a killer. Inline machine operations v. out-of-line calls to an arbitrary

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 01:25:19PM -0700, Don Stewart wrote: Finally, we can manually translate the C code into a confusing set of nested loops with interleaved IO, main = loop 1 where loop !i | i 1 = return () | otherwise = if i == go i 0 1 then

Re: [Haskell-cafe] Fusion for fun and profi (Was: newbie optimization question)

2007-10-28 Thread Stefan O'Rear
On Sun, Oct 28, 2007 at 01:43:07PM -0700, Don Stewart wrote: stefanor: IO blocks unboxing in GHC. How fast is your mock-C code refactored to do IO outside of the loops only? It doesn't! The above code yields: Main.$wloop :: GHC.Prim.Int# - GHC.Prim.State#

Re: [Haskell-cafe] Binary constants in Haskell

2007-10-25 Thread Stefan O'Rear
On Thu, Oct 25, 2007 at 02:40:36PM +0200, Josef Svenningsson wrote: On 10/24/07, Neil Mitchell [EMAIL PROTECTED] wrote: Hi Are there binary constants in Haskell, as we have, for instance, 0o232 for octal and 0xD29A for hexadecimal? No, though it is an interesting idea.

Re: [Haskell-cafe] Binary constants in Haskell

2007-10-25 Thread Stefan O'Rear
On Thu, Oct 25, 2007 at 09:41:27PM +0200, Henning Thielemann wrote: Total functions, full laziness, and compile time evaluation of finite non-bottom CAFs... If I write a program that approximates a big but fixed number of digits of Pi - how can we prevent the compiler from computing Pi,

Re: [Haskell-cafe] ANN: Math.OEIS 0.1

2007-10-22 Thread Stefan O'Rear
On Mon, Oct 22, 2007 at 07:20:47AM -0400, Brent Yorgey wrote: * returning a lazy infinite list for infinite sequences via an embedded general AI and Mathematica interpreter. Assuming you have a licensed copy of Mathematica, get in touch with Cale Gibbard; he has done all the work for

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

2007-10-21 Thread Stefan O'Rear
On Sun, Oct 21, 2007 at 10:02:25PM -0400, Brandon S. Allbery KF8NH wrote: 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

Re: [Haskell-cafe] Transformation sequence

2007-10-20 Thread Stefan O'Rear
On Sat, Oct 20, 2007 at 08:05:37PM +0100, Andrew Coppin wrote: Brent Yorgey wrote: Hmm... I'm having trouble understanding exactly what you want. In particular, I don't understand what this statement: But what I *really* want is to print out the transformation *sequence*. has to do with

Re: [Haskell-cafe] Re: [Haskell] Announce: generating free theorems, online and offline

2007-10-18 Thread Stefan O'Rear
On Thu, Oct 18, 2007 at 03:36:01AM -0400, [EMAIL PROTECTED] wrote: (As an aside: The H98 report still list the right-zero law as being a law for MonadPlus, even though most MonadPlus instances don't obey it. That's actually a defect in the report.) All the MonadPlus I can think of

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

2007-10-18 Thread Stefan O'Rear
On Fri, Oct 19, 2007 at 03:06:21AM +0200, [EMAIL PROTECTED] wrote: Stefan O'Rear writes: ... Latex page sources are infinitely superior to unadorned images of unknown providence. Of course, most certainly! But I failed to understand the relation to Wikipedia. OK, I see. If you look

Re: [Haskell-cafe] Re: [Haskell] Announce: generating free theorems, online and offline

2007-10-18 Thread Stefan O'Rear
On Thu, Oct 18, 2007 at 08:39:04PM -0400, David Menendez wrote: On 10/18/07, Stefan O'Rear [EMAIL PROTECTED] wrote: On Thu, Oct 18, 2007 at 03:36:01AM -0400, [EMAIL PROTECTED] wrote: (As an aside: The H98 report still list the right-zero law as being a law for MonadPlus, even though most

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

2007-10-18 Thread Stefan O'Rear
On Fri, Oct 19, 2007 at 02:45:45AM +0200, [EMAIL PROTECTED] wrote: PR Stanley writes: One of the reasons I'm interested in Wikipedia and Wikibook is because you're more likely to find Latex source code used for typesetting the maths. Latex is the one and only 100% tool right now. A lot of

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

2007-10-17 Thread Stefan O'Rear
On Wed, Oct 17, 2007 at 08:46:41AM -0700, Donn Cave wrote: On Wed, 17 Oct 2007, Simon Marlow wrote: ... Note that forkProcess doesn't currently work with +RTS -N2 (or any value larger than 1), and it isn't likely to in the future. I suspect forkProcess should be deprecated. The

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-17 Thread Stefan O'Rear
On Wed, Oct 17, 2007 at 03:06:33PM -0700, Dan Weston wrote: 2) the function must halt for all defined arguments fix :: forall p . (p - p) - p fix f = let x = f x in x consider: foo :: ((a - a) - a) - a foo x = x id foo is a valid proof of a true theorem, but does not halt for the defined

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-17 Thread Stefan O'Rear
On Wed, Oct 17, 2007 at 06:45:04PM -0700, Dan Weston wrote: _|_ does not provide a witness to a theorem in any consistent logic (otherwise everything could be proved from it), yet it inhabits every type in Haskell. If the only invalid type instance is _|_, then a necessary and sufficient

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

2007-10-17 Thread Stefan O'Rear
On Thu, Oct 18, 2007 at 02:31:10AM +0100, PR Stanley wrote: Hi Do you trust mathematical materials on Wikipedia? Paul Yes, unless they look like they were written by a crackpot. It's kinda hard to introduce errors when any sufficiently unobvious fact is accompanied by a proof sketch. Stefan

Re: [Haskell-cafe] Tutorial: Curry-Howard Correspondence

2007-10-17 Thread Stefan O'Rear
inhabits SN[a - b], and TERM2 inhabits SN[a], then (TERM1) (TERM2) inhabits SN[b]. No mention of evaluation required. Is it clear now? Stefan Stefan O'Rear wrote: On Wed, Oct 17, 2007 at 03:06:33PM -0700, Dan Weston wrote: 2) the function must halt for all defined arguments fix

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

2007-10-16 Thread Stefan O'Rear
On Tue, Oct 16, 2007 at 01:57:01PM +0100, Simon Marlow wrote: Certainly, this is something we want to support. However, there's an important difference between shared-library linking and Haskell: in Haskell, a superset of an API is not backwards-compatible, because it has the potential to

  1   2   3   4   5   >