[Haskell-cafe] C variable access via FFI

2010-04-19 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 i

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

2010-04-19 Thread wren ng thornton
wren ng thornton wrote: Anders Kaseorg wrote: Isaac Dupree wrote: Do you see the difference? The effects are sequenced in different places. The return/join pair moves all the effects *outside* the operations such as catch... thus defeating the entire purpose of morphIO. Yes; my question is

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

2010-04-19 Thread wren ng thornton
Anders Kaseorg wrote: Isaac Dupree wrote: Do you see the difference? The effects are sequenced in different places. The return/join pair moves all the effects *outside* the operations such as catch... thus defeating the entire purpose of morphIO. Yes; my question is more whether Wren has a mo

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

2010-04-19 Thread Mujtaba Boori
Thanks Dan. Great help but my problem has not solved yet This doesn't work for type ((Float -> Float)->Bool) to make it easier ignore the rotation and suppose I want just multiplay with whatever (x ,y) and return the result to this type ((Float -> Float)->Bool) note this type is shorten and repl

[Haskell-cafe] Continual delivery status notification failures

2010-04-19 Thread Ivan Miljenovic
Can the owner of c10b66c97b5cd09384aa9f82ecd95...@orangeat.blackberry.com please fix their emails up (or the haskell-cafe admins remove that address), as I keep getting delivery status notification failure messages over a week after I send an email to the list (I would have emailed that address dir

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

2010-04-19 Thread Bas van Dijk
2010/4/19 Jonas Almström Duregård : >> If this is to be used with QuickCheck maybe it should be named that way. > Certainly worth considering. There seems to be no convenient way of > renaming packages on Hackage though, is there? AFAIK hackage has support for deprecating packages in favor of othe

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

2010-04-19 Thread Bas van Dijk
On Mon, Apr 19, 2010 at 5:54 PM, Simon Marlow wrote: > So I think I like this variant, even though it adds a little API overhead. >  Anyone else have any thoughts on this? I do think the RankNTypes version: mask :: ((forall b. IO b -> IO b) -> IO a) -> IO a is easier to use and explain because it

Re: [Haskell-cafe] Bulk Synchronous Parallel

2010-04-19 Thread Gregory Crosswhite
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 run on multiple machines and other NUMA architectures? Ch

Re: [Haskell-cafe] Bulk Synchronous Parallel

2010-04-19 Thread Sebastian Sylvan
On Mon, Apr 19, 2010 at 11:03 PM, Gregory Crosswhite < gcr...@phys.washington.edu> wrote: > Hey everyone, > > Has anyone done any work with bulk synchronous parallel computing in > Haskell? The idea behind the model is that you divide your computation into > a series of computation and communicat

Re: [Haskell-cafe] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Felipe Lessa
=On Mon, Apr 19, 2010 at 06:24:25PM +0200, Henning Thielemann wrote: > Christian Maeder schrieb: > > Henning Thielemann schrieb: > > > >> The updated Haskell code might be written to a new file by default. Then > >> I can interactively transfer the corrections I like to the original code > >> using

Re: [Haskell-cafe] Strange error with type classes + associated types

2010-04-19 Thread Brent Yorgey
On Mon, Apr 19, 2010 at 09:40:25AM -0700, Conal Elliott wrote: > On Sun, Apr 18, 2010 at 9:02 PM, Brent Yorgey wrote: > > > Conal, > > > > Thanks for looking into this! Making (:-*) into a proper type seems > > promising. I did try wrapping (:-*) in a newtype but that didn't > > help (although I

Re: [Haskell-cafe] US Patent for the idea of using Haskell to implement UAX #9

2010-04-19 Thread Paul Johnson
This patent has zero practical impact. When the patent was written there was no Unicode support, so the implementation translates the input into lists of integers instead of lists of characters. Crucially this step was also written into all three independent claims (which are the only bit of

[Haskell-cafe] Bulk Synchronous Parallel

2010-04-19 Thread Gregory Crosswhite
Hey everyone, Has anyone done any work with bulk synchronous parallel computing in Haskell? The idea behind the model is that you divide your computation into a series of computation and communication phases, and it has recently occurred to me that this might be an ideal setup for parallelizin

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

2010-04-19 Thread Ashley Yakeley
Why is a function that gets a bunch of strict ByteStrings out of a lazy one exposed? In any case, it sounds like a similar situation to (==) on Float and Double. There's a mismatch between the "Haskellish" desire for a law on (==), and the "convenient" desire for -0.0 == 0.0, or for exposing toChu

Re: [Haskell-cafe] US Patent for the idea of using Haskell to implement UAX #9

2010-04-19 Thread Paul Johnson
On 16/04/10 19:59, Daniel Fischer wrote: Am Freitag 16 April 2010 20:50:25 schrieb Brian Hulley: revealed a link to a US Patent (7120900) for the idea of implementing the Unicode Bidirectional Algorithm (UAX #9 http://www.unicode.org/reports/tr9) in Haskell, making use, as far as I can tell,

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Arnoldo Muller
Daniel thank you for all your advice. An additional ! bang pattern in convertIntToDouble fixed the issue! Also using a foldl' did the trick. Now the program runs as it should with a constant amount of memory and in a very small amount of time. I believe these problems are one of the major source

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

2010-04-19 Thread Edward Kmett
Because it is the most utilitarian way to get a bunch of strict ByteStrings out of a lazy one. Yes it exposes an implementation detail, but the alternatives involve an unnatural amount of copying. -Edward Kmett On Sat, Apr 17, 2010 at 6:37 PM, Ashley Yakeley wrote: > Ketil Malde wrote: > >> Do

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

2010-04-19 Thread Dan Weston
First of all, your function func (x,y) s dg =((x*(cos dg) - y*(sin dg)),(x*(sin dg) - y*(cos dg))) does NOT work for type (Float -> Float), unless you mean that that is the type of the unused parameter s. Also, your desired type ((Float -> Float) -> Bool) itself looks suspicious. It must accep

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Daniel Fischer
Am Montag 19 April 2010 17:53:27 schrieb Arnoldo Muller: > Hello Daniel: > > My % GC time is : 75.0% (81.4% elapsed) and I am compiling with -O2. Very bad. Can I see the code? > Thank you for clarifying about the pointers. Not to forget the Ints for counting. > > Slowly my memory grows up and

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Daniel Fischer
Am Montag 19 April 2010 17:17:11 schrieb Arnoldo Muller: > The strings will not be longer than 30 characters. For 20 -30 character strings, using ByteStrings should be better, in my tests about 40% faster, allocation figures slightly lower, resident memory much lower and bytes copied during GC v

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Arnoldo Muller
Hello all: I found my leak after adding some bang patterns in a different part of the program. The compiler was generating all the combinations of the list comprehensions and therefore the performance dropped very badly. BTW, hamming is 2 times faster than hamming2. Thank you as always! Arnoldo

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

2010-04-19 Thread Mujtaba Boori
sorry ok I am trying to make these calculation func (x,y) s dg =((x*(cos dg) - y*(sin dg)),(x*(sin dg) - y*(cos dg))) This work for type (Float -> Float) but how can make it work with ((Float -> Float) -> Bool) because my main function that I want use with. it takes (Float,Float) ->Bool) I

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

2010-04-19 Thread Ozgur Akgun
Can you at least give an example of how you intend to use this "func"? Since you do not describe it's behaviour, it is very hard to make a useful comment (at least for me) Best, On 19 April 2010 16:54, Mujtaba Boori wrote: > > Hello > I am sorry for the silly question. > > I have a function as t

Re: [Haskell-cafe] Strange error with type classes + associated types

2010-04-19 Thread Conal Elliott
On Sun, Apr 18, 2010 at 9:02 PM, Brent Yorgey wrote: > Conal, > > Thanks for looking into this! Making (:-*) into a proper type seems > promising. I did try wrapping (:-*) in a newtype but that didn't > help (although I didn't expect it to). > What do you mean by a "proper type"? I didn't know

Re: [Haskell-cafe] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Henning Thielemann
Christian Maeder schrieb: > Henning Thielemann schrieb: > >> The updated Haskell code might be written to a new file by default. Then >> I can interactively transfer the corrections I like to the original code >> using Kompare. I would also not use '-' as option. How would you extend >> the set of

Re: [Haskell-cafe] Re: help with Haskell programming

2010-04-19 Thread Jason Dagit
On Sun, Apr 18, 2010 at 10:25 AM, Sean Leather wrote: > > >> This is the annoying part about Haskell . I can not understand composition >> . >> > > One of the ways of understanding composition (and many other functions in > Haskell) is by trying to understand its type. Here it is shown by looking

[Haskell-cafe] Re: Patch to add process group support

2010-04-19 Thread Hamish Mackenzie
On 20 Apr 2010, at 00:57, Simon Marlow wrote: > My thoughts on the changes: > > - yes to adding new_group to the CreateProcess record, and > corresponding support to System.Process.Internals > > - no to adding runCommandNewGroup, and the other *NewGroup > functions. These were kept mostly fo

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

2010-04-19 Thread Jason Dagit
On Mon, Apr 19, 2010 at 3:01 AM, Daniil Elovkov < 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 the lightest way possible. So, > I'm looking at HaXml.SAX > > I'm

Re: [Haskell-cafe] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Christian Maeder
Henning Thielemann schrieb: > > On Mon, 19 Apr 2010, Christian Maeder wrote: > >> Dear Haskell friends, >> >> I like to announce a Haskell style scanner at >> http://hackage.haskell.org/package/scan > > At first I thought it is a scanner (for whatever purpose) implemented in > Haskell style. No

Re: [Haskell-cafe] Re: [Haskell] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Sebastian Fischer
I wrote: I did not find a way to configure scan to ignore "multiple blanks". The poor man's solution is to pipe the output through grep --invert-match --regexp="multiple ([0-9]*) blanks" I agree with Henning about the hyphen option. This often (usually?) means "don't read from a file

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

2010-04-19 Thread Simon Marlow
On 10/04/2010 19:42, Iavor Diatchki wrote: Hello, It seems that rank-2 types are sufficient to make the more polymorphic types: {-# LANGUAGE Rank2Types #-} import Control.Exception data Mask = Mask (forall a. IO a -> IO a) mask :: (Mask ->

[Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Mujtaba Boori
Hello I am sorry for the silly question. I have a function as the following func:: ((Float,Float) ->Bool) -> Float -> ((Float,Float) -> Bool) I am trying to make calculation in this type ((Float,Float) ->Bool) with Float and then pass the information to ((Float,Float) -> Bool) Thank again ap

[Haskell-cafe] Re: [Haskell] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Christian Maeder
Sebastian Fischer schrieb: > Hello Christian, > > On Apr 19, 2010, at 4:48 PM, Christian Maeder wrote: > >> I like to announce a Haskell style scanner at >> http://hackage.haskell.org/package/scan >> >> Feedback is welcome. > > I get lots of "multiple blanks" which I'd rather not "correct". > >

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Arnoldo Muller
Hello Daniel: My % GC time is : 75.0% (81.4% elapsed) and I am compiling with -O2. Thank you for clarifying about the pointers. Slowly my memory grows up and eventually it explodes. I would expect that the list comprehension is lazily evaluated and therefore at any given time I am only executing

Re: [Haskell-cafe] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Henning Thielemann
On Mon, 19 Apr 2010, Christian Maeder wrote: Dear Haskell friends, I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan At first I thought it is a scanner (for whatever purpose) implemented in Haskell style. No it checks whether a Haskell module follows a ce

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

2010-04-19 Thread Simon Marlow
On 10/04/2010 20:07, Iavor Diatchki wrote: Hello, I wonder if it might be possible to use just one primitive which atomically changes the interrupt mask for a thread? Here is an example of what I'm thinking: data MaskingState = Unmasked | MaskedInterruptible

[Haskell-cafe] Re: [Haskell] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Sebastian Fischer
Hello Christian, On Apr 19, 2010, at 4:48 PM, Christian Maeder wrote: I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan Feedback is welcome. I get lots of "multiple blanks" which I'd rather not "correct". I often use multiple blanks to achieve vertical la

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Arnoldo Muller
The strings will not be longer than 30 characters. I am doing sets of 2000 (total of 2000^2 distance computations) I am expecting that all the operations will be lazyly performed but at some point I get a memory error. Most of the memory is being allocated for the hamming distance and I am still

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Arnoldo Muller
Hello John: Well I could use a packed type. The only letters that will be found in the string are "ATCG" so yeah I don't need unicode and those things. Will try out with vector or ByteString. Thanks! :) On Mon, Apr 19, 2010 at 2:37 PM, John Lato wrote: > > Subject: Re: [Haskell-cafe] hamming d

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread John Lato
> From: Daniel Fischer > > Am Montag 19 April 2010 14:37:33 schrieb John Lato: >> Is it really necessary to use Strings?  I think a packed type, e.g. >> Vector or ByteString, would be much more efficient here. > > Not very much if the strings are fairly short (and the list isn't too long, > so the

[Haskell-cafe] ANN: scan-0.1.0.3, a Haskell style scanner

2010-04-19 Thread Christian Maeder
Dear Haskell friends, I like to announce a Haskell style scanner at http://hackage.haskell.org/package/scan documented under http://projects.haskell.org/style-scanner/ It's best used in conjunction with hlint http://community.haskell.org/~ndm/hlint/ and gives many suggestions regarding the file

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread Daniel Fischer
Am Montag 19 April 2010 14:37:33 schrieb John Lato: > Is it really necessary to use Strings?  I think a packed type, e.g. > Vector or ByteString, would be much more efficient here. Not very much if the strings are fairly short (and the list isn't too long, so there's not a big difference in cache

[Haskell-cafe] Re: Fwd: Re: Simple game: a monad for each player

2010-04-19 Thread Heinrich Apfelmus
Heinrich Apfelmus wrote: > Limestraël wrote: >> Okay, I start to understand better... >> >> Just, Heinrich, how would implement the mapMonad function in terms of the >> operational package? >> You just shown the signature. > > Ah, that has to be implemented by the library, the user cannot implemen

[Haskell-cafe] Re: Patch to add process group support

2010-04-19 Thread Simon Marlow
For future reference, the procedure for changes like this is to follow the Library Submissions guidelines at http://www.haskell.org/haskellwiki/Library_submissions. In this case you've already made a patch and a detailed proposal, so I don't see any reason why we shouldn't consider it anyway.

Re: [Haskell-cafe] hamming distance allocation

2010-04-19 Thread John Lato
> Subject: Re: [Haskell-cafe] hamming distance allocation > > Am Montag 19 April 2010 01:03:14 schrieb Arnoldo Muller: >> Hello all: >> >> I want to generate some hamming distance statistics about a set of >> strings. As explained in another e-mail in this list, I used the >> following code to call

Re: [Haskell-cafe] Re: hamming distance allocation

2010-04-19 Thread Daniel Fischer
Am Montag 19 April 2010 14:13:53 schrieb Heinrich Apfelmus: > Arnoldo Muller wrote: > > I want to generate some hamming distance statistics about a set of > > strings. > > > > filter (\x -> x /= 0) $ > > map (uncurry hammingX) [(xs, ys) | xs <- exampl, ys <- exampl] > > > > [...] > > > > -- f

[Haskell-cafe] Re: hamming distance allocation

2010-04-19 Thread Heinrich Apfelmus
Arnoldo Muller wrote: > I want to generate some hamming distance statistics about a set of strings. > > filter (\x -> x /= 0) $ > map (uncurry hammingX) [(xs, ys) | xs <- exampl, ys <- exampl] > > [...] > > -- function posted in this mailing list > hamming2 :: String -> String -> Int > hammi

[Haskell-cafe] memory needed for SAX parsing XML

2010-04-19 Thread Daniil Elovkov
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 the lightest way possible. So, I'm looking at HaXml.SAX I'm surprised to see that it takes about 56-60 MB of ram. This seems constant relative to xml file

[Haskell-cafe] Re: Move MonadIO to base

2010-04-19 Thread Anders Kaseorg
On Mon, 19 Apr 2010, Isaac Dupree wrote: > Do you see the difference? Yes; my question is more whether Wren has a more clever way to get an isomorphism (forall b. (m a -> IO b) -> IO b) <-> IO (m a) that would make the simpler interface work out. (Or maybe I misunderstood what he was getting a

Re: [Haskell-cafe] Functional Dependencies conflicts

2010-04-19 Thread Limestraël
It seems like a reasonable and not-too-painful solution, thanks! Concerning Haskell typesystem, I know it to be beautiful, but also kind of complex. One of the great Haskell assets is genericity, but this complexity sometimes encumbers this genericity. But still, Haskell is -- in terms of flexibil

Re: [Haskell-cafe] Re: Data instance for a GADT

2010-04-19 Thread José Pedro Magalhães
Hi Ozgur, At least template-haskell-2.4.0.0 (which comes with GHC 6.12) has syntax for type equality constraints [1], so I'm guessing it should support GADTs (I haven't actually tested it). It also has syntax for type families. Cheers, Pedro [1] http://hackage.haskell.org/packages/archive/templ