Re: [Haskell-cafe] a code that cannot compile with or without NoMonomorphismRestriction

2012-03-29 Thread Haisheng Wu
I think the error message tell you how to fix: use -XNoMonomorphismRestriction One approach is add following line into top of your hs file and it works for me. {-# LANGUAGE NoMonomorphismRestriction #-} Regarding the deeper reason, I think you would be able to find via GHC user guide and

Re: [Haskell-cafe] Mapping string to a function

2012-03-15 Thread Haisheng Wu
Test set not found! On Thu, Mar 15, 2012 at 12:59 PM, Haisheng Wu fre...@gmail.com wrote: Hi there,  Do you have any comments / suggestions for the following scenario?  I have two list and a function over list  testdata :: [Int]  testdata2 :: [Int]  f testdata = map g testdata  What I

[Haskell-cafe] Mapping string to a function

2012-03-14 Thread Haisheng Wu
Hi there, Do you have any comments / suggestions for the following scenario? I have two list and a function over list testdata :: [Int] testdata2 :: [Int] f testdata = map g testdata What I like to do is choosing what test data via command line arguments. i.e. test.hs testdata2 will

[Haskell-cafe] Problem resolving: Hangman

2012-02-06 Thread Haisheng Wu
Though the problem I'd ask is not quiet related to haskell, I hope talent people here could provide some suggestions. The problem is not just solve the Hangman problem but solve it in sort of AI way. General idea is : 1. Randomly pick words, e.g. 20 from a predefined word list file. (

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-06 Thread Haisheng Wu
original imperative algorithm with the right variable names? You're using a 'd' array that's not been defined. 2012/2/5 Haisheng Wu fre...@gmail.com a = [1,1,1,1] b = [0,1,2,3] d = [0,0,0,0] for i in b: for j in c: if (i+j)3: d[i+j] += a[i] My just work implementation

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-06 Thread Haisheng Wu
*d = [sum $ map (a !!) [i | i - b, j - c, i + j 3, i + j == dIndex] | dIndex - [0..3]] * This is cool. -Simon On Sun, Feb 5, 2012 at 5:07 PM, L Corbijn aspergesoe...@gmail.com wrote: On Sun, Feb 5, 2012 at 7:28 AM, Haisheng Wu fre...@gmail.com wrote: a = [1,1,1,1] b = [0,1,2,3] d

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-05 Thread Haisheng Wu
Sorry there is a mistake in the problem description. Here it is in Python: a = [1,1,1,1] b = [0,1,2,3] c = [0,2] d = [0,0,0,0] for i in b: for j in c: if (i+j)3: d[i+j] += a[i] -Haisheng On Sun, Feb 5, 2012 at 2:28 PM, Haisheng Wu fre...@gmail.com wrote

[Haskell-cafe] Rewrite this imperative in FP way

2012-02-04 Thread Haisheng Wu
a = [1,1,1,1] b = [0,1,2,3] d = [0,0,0,0] for i in b: for j in c: if (i+j)3: d[i+j] += a[i] My just work implementation in Haskell http://hpaste.org/57452 Another people implementation in Haskell with Monad and it turns out complex and very imperatively. http://hpaste.org/57358 Do

Re: [Haskell-cafe] How hard is it to start a web startup using Haskell?

2011-12-26 Thread Haisheng Wu
Turns out that those guys doing start-up with Haskell are already expert at Haskell. Hence choosing Haskell is more straightforward. I'm thinking of using Haskell since it looks cool and beautiful. However I have little experience and will move slowly at certain begging period. This sounds not

Re: [Haskell-cafe] [Haskell-beginners] Int V.S. Word32

2011-11-19 Thread Haisheng Wu
, 2011 at 10:49 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Saturday 19 November 2011, 09:09:50, Haisheng Wu wrote: Hello, I got great performance difference for the following code if I used type `Int` rather than `Data.Word.Word32`. Anyone can help to explain why

Re: [Haskell-cafe] Real CMS Application in Haskell

2011-09-04 Thread Haisheng Wu
, Sep 4, 2011 at 2:02 PM, Michael Snoyman mich...@snoyman.com wrote: On Sun, Sep 4, 2011 at 8:46 AM, Haisheng Wu fre...@gmail.com wrote: Hello guys, I googled for a real open source CMS application in Haskell but have no luck. So I'm wondering if Haskell is used very little in Web

[Haskell-cafe] Real CMS Application in Haskell

2011-09-03 Thread Haisheng Wu
Hello guys, I googled for a real open source CMS application in Haskell but have no luck. So I'm wondering if Haskell is used very little in Web development area. Thanks. -Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Any good topics for Master Thesis

2011-09-03 Thread Haisheng Wu
Dear Haskellers, I'm a master student major of computer science and trying to find any topics for my master thesis. My mentor suggest me to find any topic I'm interested in. Therefore I'm thinking whether there are some topics related to FP and Haskell. Especially use such technology to

[Haskell-cafe] How to use Yesod OAuth

2011-07-18 Thread Haisheng Wu
Hello, I'm trying to use Yesod oAuth plugin to a SNS site which is very similar to Twitter. I add oAuth into the authPlugin and I'm able to see the auth URL at login page. I click the URL and it forwards me to a page ask me input that SNS site account. I fill in my account then the