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: Assembly decoding help?

2008-03-04 Thread Stefan O'Rear
On Tue, Mar 04, 2008 at 05:07:03PM -0800, Justin Bailey wrote: I'm trying to get a feel for the assembly output by GHC on my platform. Below is a module containing one function and the associated assembly. I've put in comments what I think is going on, but I'd appreciate it if anyone could

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: a help for install

2008-02-18 Thread Stefan O'Rear
On Mon, Feb 18, 2008 at 12:46:19PM -0600, Carlos Gomez A. wrote: hi, my name is carlos I need information for correct installor what are dependencies on ghc ? I have a Debian System. I have this message error to install the ghc: Debian-System/haskell/ghc-6.8.2# ./configure

Re: ghci feature request: partially read modules

2008-02-16 Thread Stefan O'Rear
On Sat, Feb 16, 2008 at 04:53:24PM +0100, Johannes Waldmann wrote: Hello. Here is one ghci feature that I find mildly annoying: If ghci (re-)reads a module that contains some error, then it considers the module loading as a complete failure, and at the prompt I get the Prelude

Re: ghci feature request: partially read modules

2008-02-16 Thread Stefan O'Rear
On Sat, Feb 16, 2008 at 06:58:29PM +0100, Johannes Waldmann wrote: Sure. Syntax errors are usually easy to spot and fix (for the programmer who uses some reasonable code layout); the motivation for my proposal was type errors. I think it would be perfectly acceptable if ghci rejects

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: GHC lazy eval optimization bug

2008-02-03 Thread Stefan O'Rear
On Sun, Feb 03, 2008 at 02:37:42PM -0500, Adam P Jenkins wrote: The haskell program below demonstrates an optimization bug with the GHC compiler. I have tried this with ghc 6.8.1 on my MacBook Pro and on a Linux i686 machine. This email should build as a literate haskell program. Build the

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] Should the following program be accepted by ghc?

2008-01-15 Thread Stefan O'Rear
On Wed, Jan 16, 2008 at 01:02:43PM +0800, Martin Sulzmann wrote: Bruno Oliveira writes: I have been playing with ghc6.8.1 and type families and the following program is accepted without any type-checking error: data a :=: b where Eq :: a :=: a ... Ofcourse, that before

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: there isn't any difference, is there, with unboxed tuples?

2008-01-04 Thread Stefan O'Rear
On Fri, Jan 04, 2008 at 09:36:33PM -0500, Isaac Dupree wrote: -- unboxed types in function results are automatically lifted... or what was the term meaning they could be _|_, failing to terminate, (because of the function-ness)? -- unboxed tuples are specially restricted to be only allowed,

Re: whole program optimization

2007-12-27 Thread Stefan O'Rear
On Thu, Dec 27, 2007 at 01:47:44PM +0100, Wolfgang Jeltsch wrote: Am Sonntag, 23. Dezember 2007 13:35 schrieb Isaac Dupree: GHC optimizes less effectively when parts of a program are in different modules, or are exported from a module. By the way, does GHC do cross-package optimization

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: whole program optimization

2007-12-23 Thread Stefan O'Rear
On Sun, Dec 23, 2007 at 07:35:20AM -0500, Isaac Dupree wrote: GHC optimizes less effectively when parts of a program are in different modules, or are exported from a module. Therefore, merging all the code into one module Main (main) would help. Unfortunately, Haskell source syntax is

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: ForeignPtr performance

2007-12-17 Thread Stefan O'Rear
On Mon, Dec 17, 2007 at 02:12:31PM +0300, Bulat Ziganshin wrote: Hello Simon, Monday, December 17, 2007, 1:33:19 PM, you wrote: My question is: what exactly does GHC.Prim.touch# do? This appears to it's a no-op (for ghc 6.6+ at least). its only task is to notify ghc optimizer that

Re: newtypes and optimization

2007-12-12 Thread Stefan O'Rear
On Wed, Dec 12, 2007 at 11:02:15AM -0700, Scott Dillard wrote: with strictness annotations and INLINEs for everything. I also tried automatic newtype deriving, with no luck. Why does a newtype defeat so much of the optimization? Thanks, Scott (Not a GHC developer, but someone fairly

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] 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: ghci changing 'm' to 'g'

2007-11-21 Thread Stefan O'Rear
On Wed, Nov 21, 2007 at 01:16:34PM -0500, Olivier Boudry wrote: On Nov 21, 2007 1:07 PM, Greg Fitzgerald [EMAIL PROTECTED] wrote: Running 6.8.1 on Windows XP, typing 'main' while :r is still processing causes the 'm' in 'main' to morph to a 'g'. :r [1 of 2] Compiling

Re: ghci changing 'm' to 'g'

2007-11-21 Thread Stefan O'Rear
On Thu, Nov 22, 2007 at 01:12:16AM +0200, Yitzchak Gale wrote: Greg Fitzgerald wrote: Running 6.8.1 on Windows XP, typing 'main' while :r is still processing causes the 'm' in 'main' to morph to a 'g'. Olivier Boudry wrote: it (also works with :l). Stefan O'Rear wrote: It's very old

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: Exposed module still hidden, why?

2007-11-20 Thread Stefan O'Rear
On Tue, Nov 20, 2007 at 12:18:57PM -0800, Greg Fitzgerald wrote: Using GHC 6.8.1 on Windows XP, after having used ghc-pkg to expose ' directory-1.0.0.0', I am getting an error when I build haddock that says the package is hidden. When I type ghc-pkg list, the package is not in parenthesis.

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: [GHC] #1894: Add a total order on type constructors

2007-11-16 Thread Stefan O'Rear
On Fri, Nov 16, 2007 at 03:59:00PM +, Ian Lynagh wrote: On Thu, Nov 15, 2007 at 03:59:46PM -0800, Stefan O'Rear wrote: On Thu, Nov 15, 2007 at 11:52:31PM -, GHC wrote: * cc: sorear (added) * difficulty: = Unknown Ticket URL: http://hackage.haskell.org/trac/ghc

Re: [GHC] #1894: Add a total order on type constructors

2007-11-15 Thread Stefan O'Rear
On Thu, Nov 15, 2007 at 11:52:31PM -, GHC wrote: #1894: Add a total order on type constructors -+-- Reporter: guest| Owner: Type: feature request |

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: Extensible Records

2007-11-11 Thread Stefan O'Rear
On Sun, Nov 11, 2007 at 03:02:56PM +0300, Bulat Ziganshin wrote: Hello Barney, Sunday, November 11, 2007, 2:34:14 PM, you wrote: An important application which is made impossible by this approach is i propose to start Records project by composing list of requirements/applications to

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: Extensible Records

2007-11-10 Thread Stefan O'Rear
On Sat, Nov 10, 2007 at 06:35:34PM -0500, Seth Kurtzberg wrote: 6.10? I think that's a typo as the current version is 6.8.1. Or did I misunderstand what you were saying? 6.8.1 is released, there is abolutely no way new features are going to enter a published version. Hence, 6.10. Stefan

Re: Extensible Records

2007-11-10 Thread Stefan O'Rear
On Sat, Nov 10, 2007 at 06:35:34PM -0500, Seth Kurtzberg wrote: Is there any chance of seeing extensible records in GHC 6.10? There seems to be widespread agreement that the current situation is unacceptable, but the official GHC policy is that there are too many good ideas to choose from -

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

  1   2   3   4   5   6   >