Re: [Haskell-cafe] How can I pass IOUArrays to FFI functions?

2007-08-20 Thread Ryan Ingram
> Your code is broken in a most evil and insidious way. Interesting. This is for a toy project, so I'm not too worried, but lets say I wanted to do this "correctly" and I was set on using IOUArray for some reason. (The Haskell wiki claims that StorableArray is slower; is that actually the case?)

Re: [Haskell-cafe] STM, IO and b-trees

2007-08-20 Thread Thomas Conway
On 8/21/07, Ben <[EMAIL PROTECTED]> wrote: > some basic questions: you have limits on key and value size? fixed > page sizes per tree? I have chosen Yes and Yes respectively, though these are *choices*. Personally, I think fixed sized pages are fine. Handling unlimited sized keys is not hard, esp

Re: [Haskell-cafe] How can I pass IOUArrays to FFI functions?

2007-08-20 Thread Stefan O'Rear
On Mon, Aug 20, 2007 at 11:03:45PM -0700, Ryan Ingram wrote: > Thanks to everyone, especially Bulat Ziganshin. > > In http://haskell.org/haskellwiki/Modern_array_libraries there is enough > information to do what I want. It specifically mentions that it's OK to > pass ByteArray# and MutableByteA

Re: [Haskell-cafe] How can I pass IOUArrays to FFI functions?

2007-08-20 Thread Ryan Ingram
Thanks to everyone, especially Bulat Ziganshin. In http://haskell.org/haskellwiki/Modern_array_libraries there is enough information to do what I want. It specifically mentions that it's OK to pass ByteArray# and MutableByteArray# to an "unsafe foreign" procedure as long as that procedure doesn'

Re: [Haskell-cafe] "Tying the knot" with unknown keys

2007-08-20 Thread Bertram Felgenhauer
David Ritchie MacIver wrote: > Essentially I have > > data FSM = State { transitions :: (Map Char FSM) } > > and > > transitions' :: Regexp -> Map Char Regexp > > I want to lift this so that the Regexps become states of the finite state > machine (while making sure I set up a loop in the data stru

Re: [Haskell-cafe] STM, IO and b-trees

2007-08-20 Thread Thomas Conway
On 8/21/07, Ben <[EMAIL PROTECTED]> wrote: > for sake of argument, suppose an enterprising haskell newbie wanted to > code up concurrent b-trees (really b-link trees) in haskell. if i am > understanding STM correctly, it will NOT help in any way with the > implementation, because of the IO-intensi

[Haskell-cafe] STM, IO and b-trees

2007-08-20 Thread Ben
for sake of argument, suppose an enterprising haskell newbie wanted to code up concurrent b-trees (really b-link trees) in haskell. if i am understanding STM correctly, it will NOT help in any way with the implementation, because of the IO-intensive nature of the algorithms? so i will have to reso

[Haskell-cafe] #haskell irc channel reaches 400 users

2007-08-20 Thread Donald Bruce Stewart
A small announcement :) 5 1/2 years after its inception, under the guiding hand of Shae Erisson (aka shapr), the #haskell IRC channel[1] on freenode has finally reached 400 users! To chart the growth, we can note that the channel was founded in late 2001, and had slow growth till 2006, reachin

Re: [Haskell-cafe] is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility?

2007-08-20 Thread Thomas Schilling
On 20 aug 2007, at 20.58, Thomas Hartman wrote: > Take a look at the Cabal.cabal file, how this is solved, atm. where is this, how can I take a look at it? http://darcs.haskell.org/cabal/Cabal.cabal See below for a little more explaination. > The next release of Cabal (and the current H

Re: [Haskell-cafe] Re: I'm stuck in my thought experiment

2007-08-20 Thread Levi Stephen
Al Falloon wrote: Maybe I am misunderstanding your requirements, but it seems to me that the simplest solution would be best in this case: data Widget = BlogWidget [Article] | TextWidget String | MenuWiget Menu | Rows Spacing [Widget] | Columns Spacing [Widget] You can also

Re: [Haskell-cafe] "Tying the knot" with unknown keys

2007-08-20 Thread Stefan O'Rear
On Mon, Aug 20, 2007 at 03:39:28PM -0700, Dan Piponi wrote: > On 8/20/07, David Ritchie MacIver <[EMAIL PROTECTED]> wrote: > > I was playing with some code for compiling regular expressions to finite > > state machines and I ran into the following problem. > > I've met exactly the same problem mys

Re: [Haskell-cafe] "Tying the knot" with unknown keys

2007-08-20 Thread Dan Piponi
On 8/20/07, David Ritchie MacIver <[EMAIL PROTECTED]> wrote: > I was playing with some code for compiling regular expressions to finite > state machines and I ran into the following problem. I've met exactly the same problem myself and you got me interested in it again. I think the tricky part is

[Haskell-cafe] Re: Parsing binary data.

2007-08-20 Thread Aaron Denney
On 2007-08-19, Matthew Sackman <[EMAIL PROTECTED]> wrote: > Recently, Adam Langley responded so: >> On 8/18/07, Matthew Sackman <[EMAIL PROTECTED]> wrote: >> > Also, one thing to watch out for is the fact the existing Get and Put >> > instances may not do anything like what you expect. For example,

RE: [Haskell-cafe] GHC optimisations

2007-08-20 Thread Simon Peyton-Jones
GHC does some constant folding, but little by way of strength reduction, or using shifts instead of multiplication. It's pretty easy to add more: it's all done in a single module. Look at primOpRules in the module PrelRules. Patches welcome! But please also supply test-suite tests that check

Re: [Haskell-cafe] GHC optimisations

2007-08-20 Thread Stefan O'Rear
On Mon, Aug 20, 2007 at 06:30:27PM +0100, Andrew Coppin wrote: > Stefan O'Rear wrote: >> On Sun, Aug 19, 2007 at 12:53:07PM +0100, Andrew Coppin wrote: >> >>> Does GHC do stuff like converting (2*) into (shift 1) or converting x + x >>> into 2*x? >> >> For a good time, compile some code which u

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Stefan O'Rear
On Mon, Aug 20, 2007 at 11:21:01AM -0500, Lanny Ripple wrote: > Not really more efficient but plays to the language implementation's > strengths. > > Imagine > > take 10 $ foo (10^9) > > and > > take 10 $ bar (10^9) > > bar wouldn't evaluate until the 10^9 was done. (And I just ground my > l

Re: [Haskell-cafe] is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility?

2007-08-20 Thread Neil Mitchell
Hi Distribution/Simple/InstallDirs.hs:267:36: > Not in scope: `dropDrive' > > [EMAIL PROTECTED]:~/installs/cabal-head/cabal>ls -l `which ghc` > lrwxrwxrwx 1 root root 31 2007-08-20 11:08 /usr/local/bin/ghc -> > /usr/local/bin/ghc-6.7.20070816 You'll need to upgrade the filepath library as we

Re: [Haskell-cafe] is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility?

2007-08-20 Thread Thomas Hartman
> Take a look at the Cabal.cabal file, how this is solved, atm. where is this, how can I take a look at it? > The next release of Cabal (and the current HEAD) supports conditionals I couldn't install head, but since I'm running 6.7, do I already have it? [EMAIL PROTECTED]:~/installs/cabal-head

Re: [Haskell-cafe] Parsing binary data.

2007-08-20 Thread Adam Langley
On 8/19/07, Matthew Sackman <[EMAIL PROTECTED]> wrote: > But it's vastly harder to do that for floats / non-integers. Now I know > that the number classes in the Prelude are basically broken anyway and > all really need rewriting, but it does seem completely arbitrary that > Words somehow are only

Re: [Haskell-cafe] How can I pass IOUArrays to FFI functions?

2007-08-20 Thread Stefan O'Rear
On Mon, Aug 20, 2007 at 05:27:04AM -0700, Ryan Ingram wrote: > I have a C function of type >void f ( HsWord32* p0, HsWord32* p1, HsWord32 size ); > > along with the FFI declaration: >foreign import ccall unsafe f :: Ptr Word32 -> Ptr Word32 -> Word32 -> IO > () > > In my Haskell code I ha

Re: [Haskell-cafe] Re: Bi-directional Maps

2007-08-20 Thread Rich Neswold
On 8/20/07, apfelmus <[EMAIL PROTECTED]> wrote: > > Andrew Wagner wrote: > > It occurred to me that it would be useful to explicitly > > have a Bi-directional Map, which does the maintenance of keeping the > > Maps synchronized behind the scenes. Thus, Bimap was born! > > ... most of the map functi

Re: [Haskell-cafe] can't build haxml under ghc 6.7, says HughesPJ is hidden... but ghc-pkg doesn't say it's hidden...

2007-08-20 Thread Thomas Hartman
so you get $ runghc Setup.hs configure Setup.hs: Multiple description files found. Please use only one of : ["HaXml.cabal","HaXml-darcs.cabal"] is there a way to specify which cabal file should be used, or do you just have to move a file out out the way with eg mv HaXml.cabal HaXml.cabal.t

Re: [Haskell-cafe] is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility?

2007-08-20 Thread Thomas Schilling
On 20 aug 2007, at 18.37, Thomas Hartman wrote: cafe, is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility? I just patched HDBC head to compile under ghc 6.7. Unfortunately it now won't compile in 6.6.1. is there a way for build-depend

Re: [Haskell-cafe] GHC optimisations

2007-08-20 Thread Andrew Coppin
Stefan O'Rear wrote: On Sun, Aug 19, 2007 at 12:53:07PM +0100, Andrew Coppin wrote: Does GHC do stuff like converting (2*) into (shift 1) or converting x + x into 2*x? For a good time, compile some code which uses even or odd :: Int -> Bool using -O2 -fasm -ddump-asm... The compiler *

[Haskell-cafe] cabal install of HDBC-odbc fails on ghc 6.7, -I flag causes problems

2007-08-20 Thread Thomas Hartman
problemw with the -I flag to ghc are causing cabal install to fail for hdbc-odbc (darcs head). man ghc still reports that -I is a valid flag after installing ghc 6.7 from darcs head a couple days ago. I think the problem might be the space after the -I flag (which is bad for both 6.6.1 and 6.7

[Haskell-cafe] is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility?

2007-08-20 Thread Thomas Hartman
cafe, is there a way to patch the build-depends line of a cabal file without breaking backwards compatibility? I just patched HDBC head to compile under ghc 6.7. Unfortunately it now won't compile in 6.6.1. is there a way for build-depends to detect which version of ghc you're on? also I see

Re: [Haskell-cafe] "Tying the knot" with unknown keys

2007-08-20 Thread Bertram Felgenhauer
David Ritchie MacIver wrote: > I was playing with some code for compiling regular expressions to finite > state machines and I ran into the following problem. I've solved it, but > I'm not terribly happy with my solution and was wondering if someone could > come up with a better one. :-) > > Ess

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Lanny Ripple
Lanny Ripple wrote: Not really more efficient but plays to the language implementation's strengths. Imagine take 10 $ foo (10^9) and take 10 $ bar (10^9) bar wouldn't evaluate until the 10^9 was done. (And I just ground my laptop to a halt checking that. :) foo on the other hand w

Re: [Haskell-cafe] Newbie question: Where is StackOverflow on the Wiki?

2007-08-20 Thread Lanny Ripple
Not really more efficient but plays to the language implementation's strengths. Imagine take 10 $ foo (10^9) and take 10 $ bar (10^9) bar wouldn't evaluate until the 10^9 was done. (And I just ground my laptop to a halt checking that. :) foo on the other hand would run out to 10^6 a

Re: [Haskell-cafe] Diagnosing stack overflow

2007-08-20 Thread Justin Bailey
On 8/18/07, Matthew Brecknell <[EMAIL PROTECTED]> wrote: > Justin Bailey: > > Would "retainer profiling" help me see what was building up > > this large thunk/closure? > > I'm not really familiar enough with GHC's profiling to answer that, but > I'll take a guess. You're experimental programs have

Re: [Haskell-cafe] How can I pass IOUArrays to FFI functions?

2007-08-20 Thread Spencer Janssen
On Monday 20 August 2007 07:27:04 Ryan Ingram wrote: > I have a C function of type >void f ( HsWord32* p0, HsWord32* p1, HsWord32 size ); > > along with the FFI declaration: >foreign import ccall unsafe f :: Ptr Word32 -> Ptr Word32 -> Word32 -> > IO () > > In my Haskell code I have an unbo

Re: [Haskell-cafe] How can I pass IOUArrays to FFI functions?

2007-08-20 Thread Donald Bruce Stewart
ryani.spam: > >I have a C function of type > > void f ( HsWord32* p0, HsWord32* p1, HsWord32 size ); > > > >along with the FFI declaration: > > foreign import ccall unsafe f :: Ptr Word32 -> Ptr Word32 >-> Word32 -> IO () > > > >In my Haskell code I have an unbo

[Haskell-cafe] How can I pass IOUArrays to FFI functions?

2007-08-20 Thread Ryan Ingram
I have a C function of type void f ( HsWord32* p0, HsWord32* p1, HsWord32 size ); along with the FFI declaration: foreign import ccall unsafe f :: Ptr Word32 -> Ptr Word32 -> Word32 -> IO () In my Haskell code I have an unboxed IO array of Word32; IOUArray Int Word32. I want to pass the poi

[Haskell-cafe] Re: Using Collections: ElemsView and KeysView

2007-08-20 Thread Jean-Philippe Bernardy
foldr on ElemsView is defined as such: > foldr f i (ElemsView c) = foldr (f . snd) i c so, for example: > getElementList = toList . ElemViews When I designed this code (some years ago), I didn't like the "fold" of Map to have the type: > fold :: (a -> b -> b) -> b -> Map k a -> b This just

[Haskell-cafe] "Tying the knot" with unknown keys

2007-08-20 Thread David Ritchie MacIver
I was playing with some code for compiling regular expressions to finite state machines and I ran into the following problem. I've solved it, but I'm not terribly happy with my solution and was wondering if someone could come up with a better one. :-) Essentially I have data FSM = State { tra

[Haskell-cafe] Re: Bi-directional Maps

2007-08-20 Thread apfelmus
Andrew Wagner wrote: So, in writing my chess engine, I've been trying to maintain 2 Map objects. One maps squares on the board to Ints, the other maps Ints to actual Pieces. It occurred to me that it would be useful to explicitly have a Bi-directional Map, which does the maintenance of keeping th