Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Ketil Malde
Blake Rain blake.r...@gmail.com writes: Here is the one in C: void multiplyM4 (float m1[4][4], float m2[4][4], float m3[4][4]) { m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0] + m2[0][3] * m3[3][0]; m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2]

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Miguel Mitrofanov
Sorry, but last time I've checked, C did have loops, is that correct? And even if you don't want loops, there is a preprocessor. 17.01.2011 10:45, Blake Rain пишет: Dear Haskellers, I thought I'd take some time to share something of my weekend with you all. Not because of anything new,

Re: [Haskell-cafe] H98, OOHaskell - getting started with objects in Haskell

2011-01-17 Thread Wolfgang Jeltsch
Am Sonntag, den 16.01.2011, 14:48 -0800 schrieb gutti: Looking at life u probably could save time, if u only would evaluate code on cells, where the neighbors have changed status. So rather than triggering them all centrally and each checks its neighbours, we could use the concept: - let

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Blake Rain
Oh yeah, it does. You're right. I haven't used it in so long that I forgot about them! No need to be sorry. Well, +2 for C, eh? :) And I'd just make a mess if I used the preprocessor. On Mon, 2011-01-17 at 11:23 +0300, Miguel Mitrofanov wrote: Sorry, but last time I've checked, C did have

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Pedro Vasconcelos
On Mon, 17 Jan 2011 07:45:04 + Blake Rain blake.r...@gmail.com wrote: So, after drinking some coffee and having a smoke, I started the Haskell version: [foldl (+) 0 $ zipWith (*) x y | x - m1, y - transpose m2] I don't think this is correct; it's type is (Num a) = [[a]] -

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Blake Rain
On Mon, 2011-01-17 at 10:13 +, Pedro Vasconcelos wrote: On Mon, 17 Jan 2011 07:45:04 + Blake Rain blake.r...@gmail.com wrote: So, after drinking some coffee and having a smoke, I started the Haskell version: [foldl (+) 0 $ zipWith (*) x y | x - m1, y - transpose m2] I

[Haskell-cafe] Announcement: SiteBridge version 1.0

2011-01-17 Thread Sukit Tretriluxana
Dear all, I am proudly announcing SiteBridge version 1.0. Briefly about it, SiteBridge is a site bridging system that allows developers to connect his/her locally developed app to an externally accessible site. It's aimed to get rid of the pain of the fact that you are still internally

[Haskell-cafe] Happstack events and web page refreshing

2011-01-17 Thread Corentin Dupont
Hello again, I have another question for happstack users/experts: I have a program with happstack-state and a web server with happstack-server. What I'd like is, whenever the MACID state is changed, that the web page is refreshed for every clients connected on the web server. So I think the

Re: [Haskell-cafe] H98, OOHaskell - getting started with objects in Haskell

2011-01-17 Thread Luke Palmer
On Mon, Jan 17, 2011 at 1:44 AM, Wolfgang Jeltsch g9ks1...@acme.softbase.org wrote: Am Sonntag, den 16.01.2011, 14:48 -0800 schrieb gutti: Looking at life u probably could save time, if u only would evaluate code on cells, where the neighbors have changed status. So rather than triggering them

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread John Lato
Rather than commenting on the code provided, here are the two biggest wins I've had recently with Haskell. Both of these are part of a physical modeling project. 1) uu-parsinglib - simple to use and automatic error correction. I really, really enjoy working with this library, and how often can

[Haskell-cafe] class-instance

2011-01-17 Thread Patrick Browne
-- My intension is that the PERSON class should *specify* -- that a person has a constant id called p1 -- and that a person has a name that can be found from the id. class PERSON a b where p1 :: a name :: a - b -- My intension is that the instance should implement the PERSON class instance

Re: [Haskell-cafe] class-instance

2011-01-17 Thread Henning Thielemann
On Mon, 17 Jan 2011, Patrick Browne wrote: -- My intension is that the PERSON class should *specify* -- that a person has a constant id called p1 -- and that a person has a name that can be found from the id. class PERSON a b where p1 :: a name :: a - b -- My intension is that the instance

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Henning Thielemann
Blake Rain wrote: Oh yeah, it does. You're right. I haven't used it in so long that I forgot about them! No need to be sorry. Well, +2 for C, eh? :) And I'd just make a mess if I used the preprocessor. C optimizer should also unroll loops. ___

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Henning Thielemann
Blake Rain wrote: Determinant is a bit fiddly, but quite trivial. However it is woefully slow at O(n!). I need to make use of LU decomposition (in which the determinant is the sum of the diagonal values in U). product of diagonal values Adjoint is even more of a fiddle, but

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Henning Thielemann
Ketil Malde wrote: Blake Rain blake.r...@gmail.com writes: Here is the one in C: void multiplyM4 (float m1[4][4], float m2[4][4], float m3[4][4]) { m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0] + m2[0][3] * m3[3][0]; m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] *

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Francesco Guerrieri
On Mon, Jan 17, 2011 at 12:50 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: Blake Rain wrote: Adjoint is even more of a fiddle, but actually a one-liner after reusing bits of the determinant function (including the determinant function). Isn't Adjoint just

Re: [Haskell-cafe] class-instance

2011-01-17 Thread Patrick Browne
Henning, The code is not intended to fit into a larger application. I am trying to understand instance-implements-class relation. My experiment consists of writing simple English sentences and then seeing how they could be specified and implemented in Haskell. I am sure that this simple

Re: [Haskell-cafe] class-instance

2011-01-17 Thread Ketil Malde
Henning Thielemann lemm...@henning-thielemann.de writes: class PERSON a b where p1 :: a name :: a - b A multi-parameter typeclass is a relation over types... instance PERSON Int String where p1 = 1 name p1 = john ^--note that this is just an unused paramter, it is

Re: [Haskell-cafe] class-instance

2011-01-17 Thread Patrick Browne
On 17/01/2011 13:04, Ketil Malde wrote: So other PERSONs would have different types, say: I think the problem is there is just one constant p1 in the class and there needs to be multiple constants in the implementation (one for each person). It seems difficult to specify this using type classes

Re: [Haskell-cafe] class-instance

2011-01-17 Thread Ketil Malde
Patrick Browne patrick.bro...@dit.ie writes: I think the problem is there is just one constant p1 in the class and there needs to be multiple constants in the implementation (one for each person). It seems difficult to specify this using type classes So, some data declaration as you suggest

Re: [Haskell-cafe] Haskell, C and Matrix Multiplication

2011-01-17 Thread Pedro Vasconcelos
On Mon, 17 Jan 2011 10:38:30 + Blake Rain blake.r...@gmail.com wrote: So sorry, I meant: mult :: (Num a) = [[a]] - [[a]] - [a] mult m1 m2 = [foldl (+) 0 $ zipWith (*) x y | x - m1, y - transpose m2] Shouldn't the result of multiplying an (n,k)-matrix by an (k,m)-matrix be an

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-17 Thread Leon Smith
On Sat, Jan 8, 2011 at 11:55 AM, Michael Snoyman mich...@snoyman.com wrote: In general I think it would be a good thing to have solid, low-level bindings to PostgreSQL. Well, there is PostgreSQL and libpq on hackage: http://hackage.haskell.org/package/libpq

[Haskell-cafe] ANNOUNCE: Haskell binding to the ANTLR parser generator C runtime library

2011-01-17 Thread Mark Wright
Hi, I'm pleased to announce the release of a Haskell binding to the ANTLR LL(*) parser generator C runtime library. The book on ANTLR is The Definitive ANTLR Reference: Building Domain-Specific Languages by Terence Parr: http://www.pragprog.com/titles/tpantlr/the-definitive-antlr-reference

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-17 Thread Michael Snoyman
On Mon, Jan 17, 2011 at 4:49 PM, Leon Smith leon.p.sm...@gmail.com wrote: On Sat, Jan 8, 2011 at 11:55 AM, Michael Snoyman mich...@snoyman.com wrote: In general I think it would be a good thing to have solid, low-level bindings to PostgreSQL. Well, there is PostgreSQL and libpq on hackage:

Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-17 Thread Jeremy Shaw
Hello, The problem is that clients are not 'connected' to the web server. The way it works (more or less) is: 1. client connects to server and sends a Request 2. server sends a Response 3. connection is terminated. So, once the page has been loaded there is no connection between the

Re: [Haskell-cafe] class-instance

2011-01-17 Thread Patrick Browne
A functional dependency seems to allow me to express my rather strange requirement. class Person i n | i - n where pid :: i name :: i - n instance Person Int String where pid = 1 name(1) = john -- name(pid::Int) will produce john Thanks for your help Pat On 17/01/2011

Re: [Haskell-cafe] Browser Game Engine

2011-01-17 Thread Jeremy Shaw
On Jan 16, 2011, at 9:26 PM, Tom Hawkins wrote: I want to create a simple browser game using Haskell. It would be nothing complicated: basic 2D graphics, limited sound, and minimal network traffic. What is the recommended medium? Flash or JavaScript+SVG? I think your options are: flash or

Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-17 Thread Corentin Dupont
Thanks a lot for your response Jeremy. I can see a lot of site that does update infos without the user to have to click refresh (I think Facebook does?). Do they do polling? I think this approach would be fine for me, my app if not very fast paced. Then I don't need to add a event handler to

Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-17 Thread Chris Smith
On Mon, 2011-01-17 at 18:25 +0100, Corentin Dupont wrote: Thanks a lot for your response Jeremy. I can see a lot of site that does update infos without the user to have to click refresh (I think Facebook does?). Do they do polling? While I'm not familiar with Facebook, I'd guess that today,

[Haskell-cafe] Denotational semantics for the lay man.

2011-01-17 Thread David Sankel
Hello All, I've recently had the opportunity to explain in prose what denotational semantics are to a person unfamiliar with it. I was trying to get across the concept of distilling the essence out of some problem domain. I wasn't able to get the idea across so I'm looking for some simple ways to

Re: [Haskell-cafe] is datetime actively maintained?

2011-01-17 Thread Henk-Jan van Tuyl
On Mon, 17 Jan 2011 08:50:52 +0100, Max Bolingbroke batterseapo...@hotmail.com wrote: Hi, I also wanted to build gitit on Windows and encountered the datetime issue. I sent the maintainer (Eric Sessoms) a request to bump his version bounds on the 22nd December, but haven't received a reply.

Re: [Haskell-cafe] Denotational semantics for the lay man.

2011-01-17 Thread caseyh
You probably want to bring up other forms of semantics. Axiomatic semantics: Makes no distinction between a phrase's meaning and the logical formulas that describe it; its meaning is exactly what can be proven about it in some logic. Operational semantics: The execution of the language is

Re: [Haskell-cafe] Zipper with two focii for concurrent fun

2011-01-17 Thread Yaakov M. Nemoy
Ah, many thanks. this looks about right. I'll go through it later today and see if i have any questions about it. -Yaakov On Mon, Jan 17, 2011 at 06:22:34PM +1030, John Lask wrote: see http://okmij.org/ftp/continuations/Continuations.html, Zipper-based file server/OS, aka ZFS where Oleg

Re: [Haskell-cafe] Denotational semantics for the lay man.

2011-01-17 Thread Albert Y. C. Lai
On 11-01-17 01:55 PM, David Sankel wrote: I've recently had the opportunity to explain in prose what denotational semantics are to a person unfamiliar with it. I was trying to get across the concept of distilling the essence out of some problem domain. I wasn't able to get the idea across so I'm

Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-17 Thread Corentin Dupont
Indeed, I tried with META HTTP-EQUIV=*Refresh* CONTENT=*n* ? and it's unusable. It make blink the page, ungrey the stop button for a second and make the fields loose the focus so it's impossible to type in. I'll try with XMLHTTPRequest. On Mon, Jan 17, 2011 at 6:30 PM, Chris Smith

Re: [Haskell-cafe] A question about monad laws

2011-01-17 Thread Tobias Schoofs
Perhaps this might help: I wrote a kind of logger monad that inserted messages with a context. Behind was an algebraic data type, let's say LoggerState. The API provided methods to add a message like this: addError :: String - Logger () addError Fatal error occurred addWarning Some warning

Re: [Haskell-cafe] Happstack events and web page refreshing

2011-01-17 Thread Jeremy Shaw
On Jan 17, 2011, at 2:19 PM, Corentin Dupont wrote: Indeed, I tried with META HTTP-EQUIV=Refresh CONTENT=n ? and it's unusable. It make blink the page, ungrey the stop button for a second and make the fields loose the focus so it's impossible to type in. I'll try with XMLHTTPRequest.

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-17 Thread John Goerzen
On 01/17/2011 10:07 AM, Michael Snoyman wrote: On Mon, Jan 17, 2011 at 4:49 PM, Leon Smithleon.p.sm...@gmail.com wrote: On Sat, Jan 8, 2011 at 11:55 AM, Michael Snoymanmich...@snoyman.com wrote: In general I think it would be a good thing to have solid, low-level bindings to PostgreSQL.

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-17 Thread Michael Snoyman
On Mon, Jan 17, 2011 at 10:52 PM, John Goerzen jgoer...@complete.org wrote: On 01/17/2011 10:07 AM, Michael Snoyman wrote: On Mon, Jan 17, 2011 at 4:49 PM, Leon Smithleon.p.sm...@gmail.com  wrote: On Sat, Jan 8, 2011 at 11:55 AM, Michael Snoymanmich...@snoyman.com  wrote: In general I

Re: [Haskell-cafe] Denotational semantics for the lay man.

2011-01-17 Thread Gregg Reynolds
On Mon, Jan 17, 2011 at 12:55 PM, David Sankel cam...@gmail.com wrote: Hello All, I've recently had the opportunity to explain in prose what denotational semantics are to a person unfamiliar with it. I was trying to get across the concept of distilling the essence out of some problem domain.

Re: [Haskell-cafe] is datetime actively maintained?

2011-01-17 Thread John MacFarlane
I've already modified the dev versions of filestore and gitit so they don't depend on datetime. This should solve the problem. I expect to be releasing new versions of both before long. John +++ Max Bolingbroke [Jan 17 11 07:50 ]: Hi, I also wanted to build gitit on Windows and encountered

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-17 Thread John Goerzen
On 01/17/2011 03:16 PM, Michael Snoyman wrote: I've brought up before my problem with the convertible package: it encourages usage of partial functions. I would prefer two typeclasses, one for guaranteed conversions and one for conversions which may fail. In fact, that is precisely why

Re: [Haskell-cafe] Mailing lists on projects.haskell.org?

2011-01-17 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote: Hi all, I tried sending mail to the haskell-llvm mailing list ( AT projects.haskell.org) several days ago and today I received a bounce message. Looking into the issue a little further, I find that DNS has no MX record for projects.haskell.org and

Re: [Haskell-cafe] Browser Game Engine

2011-01-17 Thread Luke Palmer
On Sun, Jan 16, 2011 at 8:26 PM, Tom Hawkins tomahawk...@gmail.com wrote: I want to create a simple browser game using Haskell.  It would be nothing complicated: basic 2D graphics, limited sound, and minimal network traffic. What is the recommended medium?  Flash or JavaScript+SVG? Unity3D

Re: [Haskell-cafe] Denotational semantics for the lay man.

2011-01-17 Thread Claus Reinke
I've recently had the opportunity to explain in prose what denotational semantics are to a person unfamiliar with it. I was trying to get across the concept of distilling the essence out of some problem domain. I wasn't able to get the idea across so I'm looking for some simple ways to explain

Re: [Haskell-cafe] A question about monad laws

2011-01-17 Thread C K Kashyap
Thanks Tobias, Without the associativity law, it would be very hard to determine the current state of the monad. Since the compiler, on desugaring do-blocks, will insert brackets, there is no guarantee that the results are the same as for the brace-less and sugar-free version of the code.

Re: [Haskell-cafe] HDBC, postgresql, bytestrings and embedded NULLs

2011-01-17 Thread Michael Snoyman
On Mon, Jan 17, 2011 at 11:38 PM, John Goerzen jgoer...@complete.org wrote: On 01/17/2011 03:16 PM, Michael Snoyman wrote: I've brought up before my problem with the convertible package: it encourages usage of partial functions. I would prefer two typeclasses, one for guaranteed conversions

[Haskell-cafe] A question about monad based on http://en.wikipedia.org/wiki/Monad_(category_theory)

2011-01-17 Thread C K Kashyap
Hi, I was going through http://en.wikipedia.org/wiki/Monad_(category_theory) - under Formal Definition I notice that monad is a Functor T:C - C My question is - when we think of Maybe as a functor T:C - C should we think that C here refers to Hakell types? As in, (Int and Maybe Int are

[Haskell-cafe] sequence and sequence_ for iteratees

2011-01-17 Thread Maciej Wos
Hello Cafe! I have written some iteratee functions that I found to be very very useful and I hope they will soon make it to the iteratee library. However, I'd like to get some feedback first, particularly about the error handling. I'm sending this here rather than to iteratee mailing list at