[Haskell-cafe] Observations about foldM

2009-08-18 Thread Jason McCarty
[This message is literate Haskell] Hi -cafe, I was trying to use Monad.foldM in the State monad recently and ran into some performance issues. They were eventually fixed with seq, but along the way I made some discoveries, which I thought I would share. The Report defines foldM as foldM

Re: [Haskell-cafe] Control.Parallel on 6.10.4 - Mac OS X version

2009-08-18 Thread Don Stewart
k2msmith: > I'm using the Control.Parallel package on ghc version 6.10.4 and I don't seem > to be getting any parallel threads or sparks created at all with the > "-threaded" compilation option using runtime flags "+RTS -N2". I'm using > simple examples from the paper "A Tutorial on Parallel and C

[Haskell-cafe] Control.Parallel on 6.10.4 - Mac OS X version

2009-08-18 Thread Kevin Smith
I'm using the Control.Parallel package on ghc version 6.10.4 and I don't seem to be getting any parallel threads or sparks created at all with the "-threaded" compilation option using runtime flags "+RTS -N2". I'm using simple examples from the paper "A Tutorial on Parallel and Concurrent Programm

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Eric Wong
Sorry for a mistake. "Shiyou Wang" is my identity in a private chinese group. Sorry for the confusing. :-( Eric ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Shiyou Wang
> By "simulation way", do you mean "object-oriented way"? they are similar, but not equal, I think. OO is great for simulation, but simulation does not necessarily use OO. Virtual machine simulates real machines, you can use OO language to do it, but most use C in the real world I think. So, simu

[Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Maurí­cio CA
When I was using C and Python, I used to think of most applications in an simulation way. I think it's right to say that programs are simulations. But now I have to change my mind in Haskell, I have to think in a data-flow way, that is: data in, processing using function composition, data out.

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Jason Dagit
On Tue, Aug 18, 2009 at 5:19 PM, Eric Wong wrote: > Thanks for all your post. > > When I was using C and Python, I used to think of most applications in an > simulation way.  I think it's right to say that programs are simulations. On a philosophical note, this is a sign of expertise. Humans tend

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Jason Dusek
2009/08/18 Eric Wong : > When I was using C and Python, I used to think of most > applications in an simulation way. By "simulation way", do you mean "object-oriented way"? -- Jason Dusek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://w

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Eric Wong
Thanks for all your post. When I was using C and Python, I used to think of most applications in an simulation way. I think it's right to say that programs are simulations. But now I have to change my mind in Haskell, I have to think in a data-flow way, that is: data in, processing using function

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Peter Verswyvelen
It is interesting to note that recent work on AFRP (arrow-based FRP) - namely "Causal Commutative Arrows" - optimizes a complete circuit of arrows ("interconnected objects" if you prefer to think that way) that all have local state and local feedback loops into one large state and feedback loop,

[Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Ertugrul Soeylemez
Eric Wong wrote: > I used to think about a physical engine in a similar way, and I think > it can work. But in some simulations that objects have lots of > dependencies on others can be tricky. For instance, object o1 depends > on o2, if we represent them in pure values, when we update o2, then o

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Peter Verswyvelen
You could read: http://www.cs.nott.ac.uk/~nhn/FoPAD2007/Talks/nhn-FoPAD2007.pdf http://haskell.cs.yale.edu/yale/papers/haskell-workshop03/yampa-arcade.pdf http://www.cs.nott.ac.uk/~nhn/Talks/HW2002-FRPContinued.pdf http://www.haskell.org/yale/papers/haskellworkshop02/index.html http://www.haskell.o

Re: [Haskell-cafe] Text.Html introduction

2009-08-18 Thread Sjoerd Visscher
Here is something: http://cpansearch.perl.org/src/AUTRIJUS/Language-Haskell-0.01/hugs98-Nov2003/fptools/hslibs/text/html/doc/doc.htm (Link found in an old haskell-cafe message) Sjoerd On Aug 18, 2009, at 4:18 PM, Johan Tibell wrote: On Tue, Aug 18, 2009 at 4:02 PM, Colin Paul Adams wrote: ht

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Eric Wong
I used to think about a physical engine in a similar way, and I think it can work. But in some simulations that objects have lots of dependencies on others can be tricky. For instance, object o1 depends on o2, if we represent them in pure values, when we update o2, then o1 must be updated with a

Re : [Haskell-cafe] simulation in the haskell way

2009-08-18 Thread jean legrand
> Then what's the best way to simulate private states or just > instead how to > solve simulation problems such as a physical engine using > the haskell way? perhaps Hipmunk ? http://hackage.haskell.org/package/Hipmunk ___ Haskell-Cafe mailing list H

Re: [Haskell-cafe] Re: [Haskell-beginners] Start file with associated prog (windows only?)

2009-08-18 Thread Magnus Therning
Max Desyatov wrote: Bernhard Lehnert writes: Windows has a command "start" which you can use e.g. via System.Process.proc. Thank you, Magnus - this is exactly what I was looking for. (By the way, someone should implement something like this for GNOME and KDE, too ;-) ) You can do that using

Re: [Haskell-cafe] Type family signatures

2009-08-18 Thread Ryan Ingram
On Mon, Aug 17, 2009 at 12:12 AM, Thomas van Noort wrote: > Somehow I didn't receive David's mail, but his explanation makes a lot of > sense. I'm still wondering how this results in a type error involving rigid > type variables. "rigid" type means the type has been specified by the programmer som

Re: [Haskell-cafe] Installing documentation with cabal

2009-08-18 Thread Maciej Piechotka
On Tue, 2009-08-18 at 22:37 +0200, Krzysztof Skrzętnicki wrote: > It is. From command line: > > cabal install package --enable-documentation > > or add line > "documentation: True" > to .cabal/config or equivalent. > > Best regards > > Krzysztof Skrzętnicki > Thanks a lot. Regards signatur

Re: [Haskell-cafe] Installing documentation with cabal

2009-08-18 Thread Krzysztof Skrzętnicki
It is. From command line: cabal install package --enable-documentation or add line "documentation: True" to .cabal/config or equivalent. Best regards Krzysztof Skrzętnicki On Tue, Aug 18, 2009 at 22:29, Maciej Piechotka wrote: > Is it possible to automatically (or non-automatically) install

[Haskell-cafe] Installing documentation with cabal

2009-08-18 Thread Maciej Piechotka
Is it possible to automatically (or non-automatically) install documentation when installing package with cabal-install? Regards signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org h

Re: [Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Marcin Kosiba
On Tuesday 18 August 2009, Maurí­cio CA wrote: > > ...) But for simulation kind-of problems, in which I think OO > > really fits the best, what's the haskell way to structure such problems? > > I once thought maybe I can use the State monad to simulate objects. But > > it's really hard for me to im

Re: [Haskell-cafe] Re: Planning for a website

2009-08-18 Thread Max Desyatov
Simon Michael writes: > I can give a +1 vote for the Hack api and related libs. (Jinjing Wang > is a one-man army.) Below hack you'll run happstack or another > web-serving lib. Above hack you might run some combination of loli, > maid, the hack middleware modules, hsp. > > The advantage is that

[Haskell-cafe] Keeping an indexed collection of values?

2009-08-18 Thread Job Vranish
I've been in a situation a lot lately where I need to keep a collection of values, and keep track of them by a persistent index. IO and ST refs can do this, but for various reasons I can't/don't want to use them. My first hacked up attempt is as follows: data IndexedCollection a = IndexedCollecti

Re: [Haskell-cafe] Planning for a website

2009-08-18 Thread Tim Wawrzynczak
I'd also give a read to this website: http://jekor.com/article/is-haskell-a-good-choice-for-web-applications Interesting read about a guy who actually used Haskell to create his website from the ground up. On Tue, Aug 18, 2009 at 9:56 AM, Colin Paul Adams wrote: > > "Jake" == Jake McArthur

[Haskell-cafe] Re: [Haskell-beginners] Start file with associated prog (windows only?)

2009-08-18 Thread Max Desyatov
Bernhard Lehnert writes: >> Windows has a command "start" which you can use e.g. via System.Process.proc. > > Thank you, Magnus - this is exactly what I was looking for. (By the way, > someone should implement something like this for GNOME and KDE, > too ;-) ) You can do that using MIME, look at

[Haskell-cafe] Re: Planning for a website

2009-08-18 Thread Simon Michael
I can give a +1 vote for the Hack api and related libs. (Jinjing Wang is a one-man army.) Below hack you'll run happstack or another web-serving lib. Above hack you might run some combination of loli, maid, the hack middleware modules, hsp. The advantage is that changing the low-level server in

[Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Maurí­cio CA
...) But for simulation kind-of problems, in which I think OO really fits the best, what's the haskell way to structure such problems? I once thought maybe I can use the State monad to simulate objects. But it's really hard for me to implement, because I think State monad is used to simulate a g

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Luke Palmer
2009/8/18 Dusan Kolar : > Dlists maybe good it all the app is written using them. Probably not good > idea to switch to them in the middle of project... I have a different criterion for DLists. I think they are best to use in small scopes (I think the same of monads), as opposed to interfacing be

Re: Re[2]: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Sean Leather
On Tue, Aug 18, 2009 at 18:23, Bulat Ziganshin wrote: > Hello Sean, > > Tuesday, August 18, 2009, 7:49:21 PM, you wrote: > > > writeFile "/dev/null" $ show $ [1 .. 10001000] > > it may be dominated by show+writeFile. i suggest you to compute, say, > sum of all elements instead > Thank you, Bula

Re[2]: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bulat Ziganshin
Hello Sean, Tuesday, August 18, 2009, 7:49:21 PM, you wrote: >   writeFile "/dev/null" $ show $ [1 .. 10001000] it may be dominated by show+writeFile. i suggest you to compute, say, sum of all elements instead -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Sean Leather
> >>> During a small project I'm trying to develop a small application. It > >>> becomes quite often that I need a function mapapp: > >>> > >>> mapapp _ [] ap = ap > >>> mapapp f (a:as) ap = f a : map f as ap > > >> Of course, > >>> (map f list) ++ append > >>> would do the same as > >>> > >>>

Re: [Haskell-cafe] Planning for a website

2009-08-18 Thread Colin Paul Adams
> "Jake" == Jake McArthur writes: Jake> Colin Paul Adams wrote: >> One problem will be to get GHC ported to DragonFly BSD, but >> that can wait until I have a test version of the site working >> on Linux. Jake> I would love to see this. It's the biggest thing blocking me

Re: [Haskell-cafe] Planning for a website

2009-08-18 Thread Jake McArthur
I forgot to also mention this somewhat recent announcement for a pedantically type safe HTML library: http://www.haskell.org/pipermail/haskell-cafe/2009-August/064907.html - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskel

Re: [Haskell-cafe] Planning for a website

2009-08-18 Thread Jake McArthur
Colin Paul Adams wrote: One problem will be to get GHC ported to DragonFly BSD, but that can wait until I have a test version of the site working on Linux. I would love to see this. It's the biggest thing blocking me from trying Dragonfly more seriously. WASH attracts me, with it's guarante

Re: [Haskell-cafe] Text.Html introduction

2009-08-18 Thread Johan Tibell
On Tue, Aug 18, 2009 at 4:02 PM, Colin Paul Adams wrote: > http://www.haskell.org/ghc/docs/latest/html/libraries/xhtml/Text-XHtml.html > says: > > "Based on the original Text.Html library by Andy Gill. See > http://www.cse.ogi.edu/~andy/html/intro.htm for an introduction to > that library. " > > Bu

[Haskell-cafe] Planning for a website

2009-08-18 Thread Colin Paul Adams
I'm intending to replace my current website - which uses Drupal, with a hand-written-in-Haskell version this autumn, for a number of reasons (a principal one is the lack of an upgrade path in Drupal). So I'm currently looking into the libraries available to see how much I'll have to write myself.

Re: [Haskell-cafe] Looking up functions inQ monad (Template Haskell).

2009-08-18 Thread Bulat Ziganshin
Hello Zefirov, Tuesday, August 18, 2009, 5:55:19 PM, you wrote: > Why isn't possible to lookup and call user-defined functions while > performing Template Haskell actions? if i understood correctly what you mean - it's possible. the function just need to be defined in module imported by current

[Haskell-cafe] Text.Html introduction

2009-08-18 Thread Colin Paul Adams
http://www.haskell.org/ghc/docs/latest/html/libraries/xhtml/Text-XHtml.html says: "Based on the original Text.Html library by Andy Gill. See http://www.cse.ogi.edu/~andy/html/intro.htm for an introduction to that library. " But that link gives a not-found page. Anyone know where it is know? --

[Haskell-cafe] Re: ANN: OpenCLRaw 1.0.1000

2009-08-18 Thread Jeff Heard
There was a missing include in the cabal file. fixed... On Mon, Aug 17, 2009 at 7:49 PM, Jeff Heard wrote: > All, I've released a raw binding to the OpenCL platform on Hackage. > The main differences between it and the C bindings are that constants > have been replaced by newtypes for type safety

Re: [Haskell-cafe] simulation in the haskell way

2009-08-18 Thread Peter Verswyvelen
You need to look into functional reactive programming, but be warned, this is active research :-) Two libraries I know of in which you can currently make working simulations are Yampa and Elerea. But the former doesn't scale really well, and the latter might not really be functional (I think it's n

[Haskell-cafe] Looking up functions inQ monad (Template Haskell).

2009-08-18 Thread Zefirov Sergey
Why isn't possible to lookup and call user-defined functions while performing Template Haskell actions? Just like the way Template Haskell looks up and calls 'f' in $(f ...). 'f' gets looked up and called. And user of Q monad cannot do that. A colleague of mine, a Lisp user, says that almost ev

[Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Ertugrul Soeylemez
Ertugrul Soeylemez wrote: > computation :: State [Object] Result > computation = do > objs0 <- get > (result, objs1) <- doSomethingWith objs0 > put objs1 > return result Misindented, sorry. Again: computation :: State [Object] Result computation = do objs0

[Haskell-cafe] Re: simulation in the haskell way

2009-08-18 Thread Ertugrul Soeylemez
Eric Wong wrote: > I'm relatively new to haskell and due to my strong imperative > background, it's really a pain to learn haskell. But I'm really > indulged in it. :) > > Now I think I understand the basics of Haskell very well, such as the > type system and monad. And for those data-flow kind o

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Eugene Kirpichov
module Main where mymap f xs = m xs where m [] = [] m (x:xs) = f x:m xs mymapp1 f xs ys = m xs where m [] = ys m (x:xs) = f x:m xs mymapp2 f [] ys = ys mymapp2 f (x:xs) ys = f x:mymapp2 f xs ys mapp1 f xs ys = (f`map`xs) ++ ys mapp2 f xs ys = (f`mymap`xs)

Re: [Haskell-cafe] Can't install Haskell Platform on 64-bit Linux

2009-08-18 Thread Colin Paul Adams
> "Magnus" == Magnus Therning writes: Magnus> Ouch, there only seems to be a version of 6.10.3 in Fedora Magnus> 11, if I read this correctly: Magnus> https://admin.fedoraproject.org/pkgdb/packages/name/ghc Magnus> (I'm not a Fedora user so I might be completely confused M

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Artem V. Andreev
Clemens Fruhwirth writes: > 2009/8/18 Dusan Kolar : >> Hello all, >> >>  During a small project I'm trying to develop a small application. It >> becomes quite often that I need a function mapapp: >> >> mapapp _ [] ap = ap >> mapapp f (a:as) ap = f a : map f as ap >> >>  I tried hoogle to find suc

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Artem V. Andreev
Dusan Kolar writes: > Dlists maybe good it all the app is written using them. Probably not good > idea to switch to them > in the middle of project... > > I know it is lazy, but I don't think it is able to eliminate operations, is > it? > > At least intuitively, the map f list takes n*C ticks (

[Haskell-cafe] simulation in the haskell way

2009-08-18 Thread Eric Wong
Hello, Haskellers! I'm relatively new to haskell and due to my strong imperative background, it's really a pain to learn haskell. But I'm really indulged in it. :) Now I think I understand the basics of Haskell very well, such as the type system and monad. And for those data-flow kind of applic

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Clemens Fruhwirth
2009/8/18 Dusan Kolar : > Hello all, > >  During a small project I'm trying to develop a small application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap = ap > mapapp f (a:as) ap = f a : map f as ap > >  I tried hoogle to find such a function with no success. Is there

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Dusan Kolar
Dlists maybe good it all the app is written using them. Probably not good idea to switch to them in the middle of project... I know it is lazy, but I don't think it is able to eliminate operations, is it? At least intuitively, the map f list takes n*C ticks (C is for application of f and lis

RE: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bayley, Alistair
> > mapapp _ [] ap = ap > > mapapp f (a:as) ap = f a : map f as ap > > What does mapapp do? What is its type? Never mind, I've got it now. Alistair * Confidentiality Note: The information contained in this message, and any attachmen

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bulat Ziganshin
Hello Dusan, Tuesday, August 18, 2009, 2:50:38 PM, you wrote: > but with less efficiency. Or am I wrong? probably wrong. haskell is lazy language also there is differential lists (dlist) implementation on hackage -- Best regards, Bulatmailto:bulat.zigans...@gma

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Tony Morris
Dusan Kolar wrote: > Hello all, > > During a small project I'm trying to develop a small application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap = ap > mapapp f (a:as) ap = f a : map f as ap > > I tried hoogle to find such a function with no success. Is there any >

RE: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Bayley, Alistair
> From: haskell-cafe-boun...@haskell.org > [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Dusan Kolar > > During a small project I'm trying to develop a small > application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap = ap > mapapp f (a:as) ap = f a : m

Re: [Haskell-cafe] Library function for map+append

2009-08-18 Thread Eugene Kirpichov
Hi. Have you done any measurements that prove that such a function would indeed increase performance noticeably? 2009/8/18 Dusan Kolar : > Hello all, > >  During a small project I'm trying to develop a small application. It > becomes quite often that I need a function mapapp: > > mapapp _ [] ap =

[Haskell-cafe] Library function for map+append

2009-08-18 Thread Dusan Kolar
Hello all, During a small project I'm trying to develop a small application. It becomes quite often that I need a function mapapp: mapapp _ [] ap = ap mapapp f (a:as) ap = f a : map f as ap I tried hoogle to find such a function with no success. Is there any function/functions built-in "st

RE: [Haskell-cafe] Grouping and SIMD in parallel Haskell (using Nested Data Parallel Haskell ideas in legacy code)

2009-08-18 Thread Zefirov Sergey
> -Original Message- > From: Eugene Kirpichov [mailto:ekirpic...@gmail.com] > Sent: Tuesday, August 18, 2009 11:28 AM > To: Zefirov Sergey > Cc: haskell-cafe@haskell.org > Subject: Re: [Haskell-cafe] Grouping and SIMD in parallel Haskell > (using Nested Data Parallel Haskell ideas in legacy

Re: [Haskell-cafe] Can't install Haskell Platform on 64-bit Linux

2009-08-18 Thread Colin Paul Adams
> "Magnus" == Magnus Therning writes: Magnus> On Tue, Aug 18, 2009 at 10:25 AM, Colin Paul Magnus> Adams wrote: >> I installed GHC 6.10.4 (as ./configure said it was required) >> from a .bz2 file on the GHC downloads page. I then tried >> ./configure for the platform again

Re: [Haskell-cafe] Can't install Haskell Platform on 64-bit Linux

2009-08-18 Thread Magnus Therning
On Tue, Aug 18, 2009 at 10:25 AM, Colin Paul Adams wrote: > I installed GHC 6.10.4 (as ./configure said it was required) from a > .bz2 file on the GHC downloads page. I then tried ./configure for the > platform again, and got: What distribution of Linux do you use? I'd strongly suggest getting it

[Haskell-cafe] Can't install Haskell Platform on 64-bit Linux

2009-08-18 Thread Colin Paul Adams
I installed GHC 6.10.4 (as ./configure said it was required) from a .bz2 file on the GHC downloads page. I then tried ./configure for the platform again, and got: checking ghc actually works... no configure: error: Your installation of ghc does not appear to work. It cannot compile a simple prog

[Haskell-cafe] REMINDER: Next BostonHaskell meeting TOMORROW (August 18th) at MIT

2009-08-18 Thread Ravi Nanavati
The full details of the event are here: http://groups.google.com/group/bostonhaskell/browse_thread/thread/71243e7d2ec57300 I'm just sending out this reminder to make sure more people hear about the event (especially as, with Brent on vacation, there wasn't a Haskell Weekly News this week). If you

Re: [Haskell-cafe] Grouping and SIMD in parallel Haskell (using Nested Data Parallel Haskell ideas in legacy code)

2009-08-18 Thread Eugene Kirpichov
Now I finally understood the idea that you were talking about :) I didn't quite get it during the MskHUG meeting. The idea is brilliant to my mind; I am surprised that none of the gurus are answering. So, if I understood it correctly, you are suggesting to: - make a separate spark queue (implemen