Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread Sebastian Sylvan
On Wed, 15 Dec 2004 22:58:53 -0500, Robert Dockins <[EMAIL PROTECTED]> wrote: > On Thu, 2004-12-16 at 01:05 +0100, Sebastian Sylvan wrote: > > Another question! > > > > Is there a way to force the garbage collector to kick in? > > > > I''m trying to find out if my finalizer gets called correctly bu

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread Sebastian Sylvan
Okay. Yet another question. I have a datatype called SoundSample which is just a ForeignPtr to an actual sound resource. Playing a resource will in the C library return a handle to the channel. I use a simliar concept where playing a resource will return a SamplePlaybackRaw. The sound resource

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread Robert Dockins
On Thu, 2004-12-16 at 01:05 +0100, Sebastian Sylvan wrote: > Another question! > > Is there a way to force the garbage collector to kick in? > > I''m trying to find out if my finalizer gets called correctly but I > don't know if the garbage collector is run. I'm kind of surprised no one has yet

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread Ben Lippmeier
System.Mem.performGC? Sebastian Sylvan wrote: Another question! Is there a way to force the garbage collector to kick in? I''m trying to find out if my finalizer gets called correctly but I don't know if the garbage collector is run. /S ___ Haskell-Cafe

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread Sebastian Sylvan
Another question! Is there a way to force the garbage collector to kick in? I''m trying to find out if my finalizer gets called correctly but I don't know if the garbage collector is run. /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 ___ Has

Re: [Haskell-cafe] Parse text difficulty

2004-12-15 Thread Thomas Johnsson
>> > printastable :: [([Int],Word)] -> String >> > >> > printastable l = concat $ map (\(xs,w) -> (show xs) ++ " " ++ w ++ >> > "\n") l >> >> I'd use >> >> [ c | (xs,w) <- l, c <- (show xs) ++ " " ++ w ++ "\n" ] >> >> instead -- after all, list comprehensions provide a much nicer >> syntax for map,

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread David Roundy
On Wed, Dec 15, 2004 at 01:13:19PM +0100, Sebastian Sylvan wrote: > Another problem! > When a handle is not being referenced I don't want it to be garbage > collected if the isPlaying function returns True (in other words I > want the song to finish playing even if it's not being referenced > anymo

[Haskell-cafe] convergence of functions of Complex variables

2004-12-15 Thread William Lee Irwin III
This does not work as expected on Complex numbers due to some odd typechecking hassles apparently associated with abs. How do I get this to typecheck for both real (e.g. Double) and Complex arguments? \begin{code} module Jacobi (sn, cn, dn, sd, cd, nd, cs, ds, ns, sc, dc, nc) where scd x k | abs

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread Sebastian Sylvan
On Wed, 15 Dec 2004 07:55:42 -0500, David Roundy <[EMAIL PROTECTED]> wrote: > On Wed, Dec 15, 2004 at 01:13:19PM +0100, Sebastian Sylvan wrote: > > Another problem! > > When a handle is not being referenced I don't want it to be garbage > > collected if the isPlaying function returns True (in other

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread Sebastian Sylvan
On Wed, 15 Dec 2004 06:04:37 -0500, David Roundy <[EMAIL PROTECTED]> wrote: > On Wed, Dec 15, 2004 at 04:09:04AM +0100, Sebastian Sylvan wrote: > > FMUSIC_MODULE * F_API FMUSIC_LoadSong( > > const char *name > > ); > > > > By doing this in Haskell: > > > > data MusicModule = MusicModule > > > > for

Re: [Haskell-cafe] convergence of functions of Complex variables

2004-12-15 Thread Henning Thielemann
On Wed, 15 Dec 2004, William Lee Irwin III wrote: > On Wed, Dec 15, 2004 at 10:28:18AM +, Ross Paterson wrote: > > abs :: Num a => a -> a, whereas you want something that returns a Double. > > You could define > > class Norm a where > > norm :: a -> Double > > instance Norm Float wher

Re: [Haskell-cafe] convergence of functions of Complex variables

2004-12-15 Thread Jerzy Karczmarczuk
William Lee Irwin III wrote: This does not work as expected on Complex numbers due to some odd typechecking hassles apparently associated with abs. ... Ross Paterson wrote: abs :: Num a => a -> a, whereas you want something that returns a Double. You could define class Norm a where norm :

Re: [Haskell-cafe] FFI woes!

2004-12-15 Thread David Roundy
On Wed, Dec 15, 2004 at 04:09:04AM +0100, Sebastian Sylvan wrote: > FMUSIC_MODULE * F_API FMUSIC_LoadSong( > const char *name > ); > > By doing this in Haskell: > > data MusicModule = MusicModule > > foreign import ccall "fmod.h FMUSIC_LoadSong" fmusic_LoadSong :: > CString -> IO ForeignPtr Musi

Re: [Haskell-cafe] convergence of functions of Complex variables

2004-12-15 Thread William Lee Irwin III
On Wed, Dec 15, 2004 at 02:07:10AM -0800, William Lee Irwin III wrote: >> This does not work as expected on Complex numbers due to some odd >> typechecking hassles apparently associated with abs. How do I get this >> to typecheck for both real (e.g. Double) and Complex arguments? On Wed, Dec 15, 2

Re: [Haskell-cafe] convergence of functions of Complex variables

2004-12-15 Thread Ross Paterson
On Wed, Dec 15, 2004 at 02:07:10AM -0800, William Lee Irwin III wrote: > This does not work as expected on Complex numbers due to some odd > typechecking hassles apparently associated with abs. How do I get this > to typecheck for both real (e.g. Double) and Complex arguments? abs :: Num a => a ->

Re: [Haskell-cafe] The difference between ($) and application

2004-12-15 Thread Peter G. Hancock
> Jon Cast wrote (on Tue, 14 Dec 2004 at 22:02): > No. All that is needed for ($) to work is impredicativity (or, more > precisely, for the foralls in ($)'s type to be impredicative). That is > something that could easily be implemented in a compiler. I'm not clear > on why

Re: [Haskell-cafe] Named function fields vs. type classes

2004-12-15 Thread Keean Schupke
See the HList library (http://www.cwi.ni/~ralf/HList) and use an HList constrained by your interface. Keean. John Goerzen wrote: Hi, I often have a situation where I'm designing specialized components to do a more general task. Examples could include mail folder code (maildir, mbox, etc), conf

[Haskell-cafe] Monads vs. qualified types

2004-12-15 Thread William Lee Irwin III
To my chagrin, I discovered that the following code was not accepted while attempting to monadify a small interpreter for a language used for calculations in permutation representations of groups. One of the critical notions here is of closure under composition, e.g. a transcript of a command to ge