[Haskell-cafe] C variable access via FFI

2010-04-20 Thread Tom Hawkins
I have a bunch of global variables in C I would like to directly read and write from Haskell. Is this possible with FFI, or must I write a bunch of C wrapper functions for the interface, i.e. a 'get' and a 'set' for each variable? I'm building a simulator for one of our embedded systems. The C

Re: [Haskell-cafe] memory needed for SAX parsing XML

2010-04-20 Thread Daniil Elovkov
Jason Dagit wrote: On Mon, Apr 19, 2010 at 3:01 AM, Daniil Elovkov daniil.elov...@googlemail.com mailto:daniil.elov...@googlemail.com wrote: Hello haskellers! I'm trying to process an xml file with as little footprint as possible. SAX is alright for my case, and I think that's

Re: [Haskell-cafe] newbie question how to pass data

2010-04-20 Thread Stephen Tetley
Hi If you are working with characteristic functions (Point - Bool or Point - Colour...) the common way to do this is to manufacture a Num instance for functions. This gives you syntax overloading of the (+, -, *) operators. Similarly you might want to overload (or have to overload) Floating,

Re: [Haskell-cafe] newbie question how to pass data

2010-04-20 Thread Mujtaba Boori
Great job Stephen. Thank for explaining . I got it to work. On Tue, Apr 20, 2010 at 9:21 AM, Stephen Tetley stephen.tet...@gmail.comwrote: Hi If you are working with characteristic functions (Point - Bool or Point - Colour...) the common way to do this is to manufacture a Num instance for

[Haskell-cafe] Re: hamming distance allocation

2010-04-20 Thread Heinrich Apfelmus
Daniel Fischer wrote: Heinrich Apfelmus: For instance, your expression can be replaced by filter (/=0) [hammingX x y | (x:xs) - tails example, y - xs] which cuts the total running time in half. It's still quadratic in the length of example . I'm sure there are faster algorithms out

Re: [Haskell-cafe] C variable access via FFI

2010-04-20 Thread Bas van Dijk
On Tue, Apr 20, 2010 at 8:48 AM, Tom Hawkins tomahawk...@gmail.com wrote: I have a bunch of global variables in C I would like to directly read and write from Haskell.  Is this possible with FFI, or must I write a bunch of C wrapper functions for the interface, i.e. a 'get' and a 'set' for

Re: [Haskell-cafe] C variable access via FFI

2010-04-20 Thread Bertram Felgenhauer
Tom Hawkins wrote: I have a bunch of global variables in C I would like to directly read and write from Haskell. Is this possible with FFI, Yes it is, as explained in section 4.1.1. in the FFI specification [1]. An import for a global variable int bar would look like this: foreign

Re: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-20 Thread Simon Marlow
On 09/04/2010 12:14, Bertram Felgenhauer wrote: Simon Marlow wrote: On 09/04/2010 09:40, Bertram Felgenhauer wrote: timeout t io = mask $ \restore - do result- newEmptyMVar tid- forkIO $ restore (io= putMVar result) threadDelay t `onException` killThread

Re: [Haskell-cafe] ANNOUNCE: Agata-0.2.0

2010-04-20 Thread Neil Mitchell
Hi, Have you seen the derive package? It also generates QuickCheck instances in virtually the same way - plus it can generate source code and do lots of other types of instances. http://community.haskell.org/~ndm/derive/ Thanks, Neil 2010/4/20 Bas van Dijk v.dijk@gmail.com: 2010/4/19

Re: [Haskell-cafe] ANNOUNCE: Agata-0.2.0

2010-04-20 Thread Sebastiaan Visser
Jonas, You can also derive (Co)Arbitrary instances automatically using the regular-extras package based on the Regular generic programming library. The advantage of using a library like Regular is that you do not have to write any Template Haskell code. The library generates a nice algebraic

[Haskell-cafe] Profiling

2010-04-20 Thread rodrigo.bonifacio
Dear all, I am trying to compile a project with the "-prof -auto-all" profile options. But the compiler returns: "Could not find module `Text.ParserCombinators.Parsec.Language':Perhaps you haven't installed the profiling libraries for package `parsec-3.1.0'?Use -v to see a list of the

Re: [Haskell-cafe] Profiling

2010-04-20 Thread Ivan Lazar Miljenovic
rodrigo.bonifacio rodrigo.bonifa...@uol.com.br writes: Could not find module `Text.ParserCombinators.Parsec.Language': Perhaps you haven't installed the profiling libraries for package `parsec-3.1.0'? Use -v to see a list of the files searched for. How did you install parsec? You

Re: GUI (was: Re: [Haskell-cafe] DLL on Windows)

2010-04-20 Thread Neil Mitchell
:-( - it seems that cabal install wx isn't how you install it on Windows, not by a long shot. I'm currently a Gtk2hs user. If wx got to the point where cabal install wx either installed wx, including all it's non-Haskell dependencies, or printed out a message you're a windows user who hasn't

Re: [Haskell-cafe] Profiling

2010-04-20 Thread C K Kashyap
Hi Ivan, I tried doing cabal install parsec = 3 --reinstall --enable-library-profiling This complained about bytestring ... so I did this - cabal install bytestring --reinstall --enable-library-profiling And this complained about base - Data/ByteString.hs:278:7: Could not find module

Re: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-04-20 Thread Isaac Dupree
On 04/20/10 06:56, Simon Marlow wrote: On 09/04/2010 12:14, Bertram Felgenhauer wrote: Simon Marlow wrote: On 09/04/2010 09:40, Bertram Felgenhauer wrote: timeout t io = mask $ \restore - do result- newEmptyMVar tid- forkIO $ restore (io= putMVar result) threadDelay t `onException` killThread

Re: [Haskell-cafe] Profiling

2010-04-20 Thread Daniel Fischer
Am Dienstag 20 April 2010 18:59:23 schrieb C K Kashyap: Hi Ivan, I tried doing cabal install parsec = 3 --reinstall --enable-library-profiling This complained about bytestring ... so I did this - cabal install bytestring --reinstall --enable-library-profiling And this complained about

Re: [Haskell-cafe] Bulk Synchronous Parallel

2010-04-20 Thread Jason Dusek
2010/04/19 Gregory Crosswhite gcr...@phys.washington.edu: Thanks for the link;  my ultimate interest, though, is in an architecture that could scale to multiple machines rather than multiple cores with shared memory on a single machine.  Has there been any interest and/or progress in making

Re: [Haskell-cafe] Profiling

2010-04-20 Thread C K Kashyap
Thanks Daniel, that worked. On Tue, Apr 20, 2010 at 11:24 PM, Daniel Fischer daniel.is.fisc...@web.dewrote: Am Dienstag 20 April 2010 18:59:23 schrieb C K Kashyap: Hi Ivan, I tried doing cabal install parsec = 3 --reinstall --enable-library-profiling This complained about

[Haskell-cafe] ANNOUNCE: hamlet 0.0.0

2010-04-20 Thread Michael Snoyman
Hi all, I'd like to announce the first release of Hamlet[1], a templating system which is fully compile-time checked. Templates are parsed via quasi-quoting, giving you greater confidence in the validity of your templates. The syntax is inspired by Haml[2]; however, it is most definitely its own

Re: [Haskell-cafe] ANNOUNCE: Agata-0.2.0

2010-04-20 Thread Jonas Almström Duregård
Hi Neil and Sebastiaan, Thanks for the constructive criticism ;). As far as i can tell, derive only works for regular and linear recursive types and Regular uses frequencies to regulate size. (Also Regular doesn't seem to work for QuickCheck-2). I think I may have used a too simple example in

Re: [Haskell-cafe] Why does the transformers/mtl 'Error' class exist?

2010-04-20 Thread Ryan Ingram
On Sat, Apr 17, 2010 at 2:52 PM, Henning Thielemann schlepp...@henning-thielemann.de wrote: Ryan Ingram schrieb: It's used in the implementation of fail for those monads. class Monad m where   ...   fail :: String - m a   fail = error  -- default implementation which is then used to

Re: [Haskell-cafe] what does the '~' mean ?

2010-04-20 Thread Ryan Ingram
On Thu, Apr 15, 2010 at 10:59 PM, zaxis z_a...@163.com wrote: instance (BinaryDefer a, BinaryDefer b) = BinaryDefer (a,b) where    put (a,b) = put2 a b    get = get2 (,)    size x = let ~(a,b) = x in size a + size b    putFixed (a,b) = putFixed2 a b    getFixed = getFixed2 (,) in `size`

Re: [Haskell-cafe] C variable access via FFI

2010-04-20 Thread John Meacham
On Tue, Apr 20, 2010 at 01:48:16AM -0500, Tom Hawkins wrote: I have a bunch of global variables in C I would like to directly read and write from Haskell. Is this possible with FFI, or must I write a bunch of C wrapper functions for the interface, i.e. a 'get' and a 'set' for each variable?

[Haskell-cafe] ANN: forkable-monad 0.1

2010-04-20 Thread David Anderson
Dear Haskellers, I'm happy, and only slightly intimidated, to announce the initial release of forkable-monad. The short version is that forkable-monad exports a replacement forkIO that lets you do this: type MyMonad = ReaderT Config (StateT Ctx IO) startThread :: MyMonad ThreadId startThread =

[Haskell-cafe] Re: Re: instance Eq (a - b)

2010-04-20 Thread Edward Kmett
I don't mind the 0.0 == -0.0 case, its the NaN /= NaN one that gets me. ;) The former just says that the equivalence relation you are using isn't structural. The latter breaks the notion that you have an equivalence relation by breaking reflexivity. Eq doesn't state anywhere that the instances

Re: [Haskell-cafe] Re: Move MonadIO to base

2010-04-20 Thread Anders Kaseorg
On Tue, 20 Apr 2010, wren ng thornton wrote: -- | The isomorphic Haskell98 version class Monad m = MonadJoinIO m where -- | Embed the IO into the monad m joinIO :: IO (m a) - m a -- | Extract the IO computation to the top level, -- rendering

Re: [Haskell-cafe] Bulk Synchronous Parallel

2010-04-20 Thread Alexander Solla
On Apr 20, 2010, at 11:05 AM, Jason Dusek wrote: Thanks for the link; my ultimate interest, though, is in an architecture that could scale to multiple machines rather than multiple cores with shared memory on a single machine. Has there been any interest and/or progress in making DPH