Re: [Haskell-cafe] Bit Field Marshalling

2008-11-07 Thread Lutz Donnerhacke
* Michael D. Adams wrote: But as far as I can tell, hsc2hs doesn't support bit fields. On top of that I'm not sure I can make any safe assumptions about what order the bit fields are packed (LSB or MSB first). C standard allows padding and reorder of struct entries in order to match alignment

Re: [Haskell-cafe] Re: Monad.Reader with updates

2008-11-07 Thread Brent Yorgey
On Fri, Nov 07, 2008 at 10:41:01AM +0100, Achim Schneider wrote: But then, you either want a ReaderT r State s or StateT s Reader r, depending on how you want to write your code... the main thing that confuses me right now is that nesting order doesn't seem to matter that much in this case

[Haskell-cafe] Re: Monad.Reader with updates

2008-11-07 Thread Mauricio
Hi Mauricio. What you want actually already exists in QuickCheck as the Gen monad. newtype Gen a = Gen (Int - StdGen - a) instance Monad Gen where return a= Gen (\n r - a) Gen m = k = Gen (\n r0 - let (r1,r2) = split r0 Gen m' = k (m n r1)

[Haskell-cafe] Re: Monad.Reader with updates

2008-11-07 Thread Achim Schneider
Maurcio [EMAIL PROTECTED] wrote: [...] Are you sure you don't want to use monad transformers? No. Do you have a sugestion on how could I do it in this situation? Not really, mainly because if monad transformers don't confuse you you should double-check if you aren't one of

[Haskell-cafe] Re: Bit Field Marshalling

2008-11-07 Thread Achim Schneider
Michael D. Adams [EMAIL PROTECTED] wrote: What options are there for working around it? In case it's feasible, use http://www.matroska.org/technical/specs/rfc/index.html on both sides. I just can't stop to advertise that one. -- (c) this sig last receiving data processing entity. Inspect

Re: [Haskell-cafe] Bit Field Marshalling

2008-11-07 Thread Dan Weston
C standard allows padding and reorder of struct entries Almost. The ISO C standard does allow structs padding, but *not* reordering: http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf ISO/IEC 9899:1999 C Standard ยง6.7.2.1.13 Within a structure object, the non-bit-field members and the

[Haskell-cafe] Convolution

2008-11-07 Thread Andrew Coppin
A simple and straight-forward way to define the DSP operations of correlation and convolution is as follows: correlate1 :: [Double] - [Double] - Double correlate1 ks = sum . zipWith (*) ks correlate :: [Double] - [Double] - [Double] correlate ks [] = [] correlate ks xs = correlate1 ks xs

Re: [Haskell-cafe] Convolution

2008-11-07 Thread Henning Thielemann
On Fri, 7 Nov 2008, Andrew Coppin wrote: A simple and straight-forward way to define the DSP operations of correlation and convolution is as follows: correlate1 :: [Double] - [Double] - Double correlate1 ks = sum . zipWith (*) ks correlate :: [Double] - [Double] - [Double] correlate ks [] =

Re: [Haskell-cafe] Convolution

2008-11-07 Thread Andrew Coppin
Henning Thielemann wrote: I think the verb is 'convolve'. Possibly. If ks is infinite it will not work. Indeed. If the correlate function could be altered to use Prelude list functions only, I would think the above code works quite well with stream fusion too. (Presumably you could do

Re: [Haskell-cafe] performance difference for binary-0.4.3.1 with ghc-6.8.3 and ghc-6.10

2008-11-07 Thread Don Stewart
jwlato: On Mon, Oct 27, 2008 at 12:34 AM, Alexander Dunlap [EMAIL PROTECTED] wrote: On Sun, Oct 26, 2008 at 9:36 AM, John Lato [EMAIL PROTECTED] wrote: Hello, I was experimenting with using ghc-6.10.0.20081007 on a project, and it seems that binary-0.4.3.1 has markedly worse

Re: [Haskell-cafe] Bit Field Marshalling

2008-11-07 Thread Michael D. Adams
On Fri, Nov 7, 2008 at 3:46 AM, Lutz Donnerhacke [EMAIL PROTECTED] wrote: * Michael D. Adams wrote: But as far as I can tell, hsc2hs doesn't support bit fields. On top of that I'm not sure I can make any safe assumptions about what order the bit fields are packed (LSB or MSB first). ...