Re[2]: forall a (Ord a => a-> a) -> Int is an illegal type???

2006-02-08 Thread Bulat Ziganshin
Hello Brian, Thursday, February 09, 2006, 9:38:35 AM, you wrote: >> the past few months (!) and still can't understand why the following >> is an illegal type: >> >> forall a. ((Ord a => a-> a) -> Int) i don't know right answer burt may be because "Ord a" restriction and "forall a" )"dseclaratio

Re: forall a (Ord a => a-> a) -> Int is an illegal type???

2006-02-08 Thread Brian Hulley
Brian Hulley wrote: Hi - I've been puzzling over section 7.4.9.3 of the ghc users manual for the past few months (!) and still can't understand why the following is an illegal type: forall a. ((Ord a => a-> a) -> Int) whereas (forall a. Ord a => a->a) -> Int is legal. I can understand why the

forall a (Ord a => a-> a) -> Int is an illegal type???

2006-02-08 Thread Brian Hulley
Hi - I've been puzzling over section 7.4.9.3 of the ghc users manual for the past few months (!) and still can't understand why the following is an illegal type: forall a. ((Ord a => a-> a) -> Int) whereas (forall a. Ord a => a->a) -> Int is legal. I can understand why the second one *is* l

Re: Passing a matrix from C to Haskell

2006-02-08 Thread Ben Rudiak-Gould
Cyril Schmidt wrote: I was thinking of something like passing the array as Ptr Int#, but how do I fetch the elements that I am interested in? I think you want Ptr CInt and peekElemOff. If the array is declared in C as int a[100][20] and p :: Ptr CInt is a Haskell pointer to it, then a[y][

Re[2]: Passing a matrix from C to Haskell

2006-02-08 Thread Bulat Ziganshin
Hello Cyril, Wednesday, February 08, 2006, 7:39:51 PM, you wrote: >> peekArray :: Storable a => Int -> Ptr a -> IO [a] >> CS> This works, but peekArray is very slow. use the attached module. this will allow you to use usafeRead/unsafeWrite i written it while i'm online so it can contain any mum

Fwd: patch applied (ghc): make the smp way RTS-only, normal libraries now work with -smp

2006-02-08 Thread Bulat Ziganshin
i think that this should be interesting for GHC users This is a forwarded message From: Simon Marlow <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Date: Wednesday, February 08, 2006, 5:40:19 PM Subject: patch applied (ghc): make the smp way RTS-only, normal libraries now work with -smp ===8<==

Re: Passing a matrix from C to Haskell

2006-02-08 Thread Simon Marlow
Cyril Schmidt wrote: Simon Marlow wrote: Bulat Ziganshin wrote: [...] i think we should define "secret door" to construct StorableArray from a pointer to allow to use full power of MArray interface on foreign arrays You mean this? -- |Construct a 'StorableArray' from an arbitrary 'Foreig

Re: Passing a matrix from C to Haskell

2006-02-08 Thread Cyril Schmidt
> It is, however, documented at > http://www.haskell.org/HOpenGL/newAPI/base/Foreign-Storable.html > but I don't know which version of GHC it applies to. Sorry, I meant at http://www.haskell.org/HOpenGL/newAPI/base/Data-Array-Storable.html Cyril ___ Gla

Re: Passing a matrix from C to Haskell

2006-02-08 Thread Cyril Schmidt
Chris Kuklewicz wrote: > Cyril Schmidt wrote: >> I need to pass a big 2-dimensional array of doubles from a legacy >> C code to a Haskell module. Of this huge array, the Haskell code will >> actually use only >> a few elements (say, 10 out of 100x20 matrix). Unfortunately, the C code >> does not kn

Re: Passing a matrix from C to Haskell

2006-02-08 Thread Cyril Schmidt
Simon Marlow wrote: > Bulat Ziganshin wrote: [...] >> i think we should define "secret door" to construct StorableArray from >> a pointer to allow to use full power of MArray interface on foreign >> arrays > > You mean this? > > -- |Construct a 'StorableArray' from an arbitrary 'ForeignPtr'. It is

Re[2]: [GHC] #683: RULES for recursive functions don't work properly

2006-02-08 Thread Bulat Ziganshin
Hello Simon, Wednesday, February 08, 2006, 2:19:07 PM, you wrote: >> G> someone mentioned to me that this expression: >> G>mapM_ action [n..m] >> G> isn't being optimised properly, so I thought I'd look into it. Sure >> >> may be, what's me :) i use specially written function as faster >>

Re: Passing a matrix from C to Haskell

2006-02-08 Thread Simon Marlow
Bulat Ziganshin wrote: Hello Chris, Wednesday, February 08, 2006, 2:35:39 AM, you wrote: CK> You probably want Foreign.Marshal.Array CK> http://www.haskell.org/ghc/docs/6.4.1/html/libraries/base/Foreign-Marshal-Array.html CK> peekArray :: Storable a => Int -> Ptr a -> IO [a] i think we shou

Re: [GHC] #683: RULES for recursive functions don't work properly

2006-02-08 Thread Simon Marlow
Bulat Ziganshin wrote: Hello GHC, Tuesday, February 07, 2006, 8:03:49 PM, you wrote: G> someone mentioned to me that this expression: G>mapM_ action [n..m] G> isn't being optimised properly, so I thought I'd look into it. Sure may be, what's me :) i use specially written function as f

Re: UTF-8 decoding error

2006-02-08 Thread Christian Maeder
Simon Marlow wrote: Christian Maeder wrote: I'm tempted to replace "รค" bei "\228" in literals. What does haddock do with utf-8 in comments? Will DrIFT -- using read- and writeFile -- still work correctly? The problem I fear is that writeFile does not produce a utf-8 encoded file: writeFile "

Re: bug in compacting GC

2006-02-08 Thread Simon Marlow
Bulat Ziganshin wrote: Hello Simon, Monday, February 06, 2006, 5:20:17 PM, you wrote: SM> I think this may be a different bug - I can reproduce it, but not with SM> the current STABLE branch. It is probably the freeze/thaw bug that was SM> fixed after 6.4.1. SM> However, I've still seen str

Re[2]: Passing a matrix from C to Haskell

2006-02-08 Thread Bulat Ziganshin
Hello Chris, Wednesday, February 08, 2006, 2:35:39 AM, you wrote: CK> You probably want Foreign.Marshal.Array CK> http://www.haskell.org/ghc/docs/6.4.1/html/libraries/base/Foreign-Marshal-Array.html CK> peekArray :: Storable a => Int -> Ptr a -> IO [a] i think we should define "secret door" t

RE: optimistic evaluation

2006-02-08 Thread Simon Peyton-Jones
| What is the status of Rob Ennals' optimistic evaluation work? I'm told | that it has been removed from GHC. This is extremely depressing to me. More precisely, it never got into GHC. It was always on a heavily-modified branch. Rob's thesis was fantastic work. But although it sounded simple t