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),

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 - a,

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, 2004

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 MusicModule)

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 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 foreign import ccall

[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 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 anymore).

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] 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 it

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 where

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, filter and concat. I try to stay

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 but I don't