[Haskell-cafe] stuck with a sample of programming in haskell

2010-03-16 Thread
Hi, I am a beginner for haskell. I was stuck with a sample of programming in haskell. Following is my code: - import Prelude hiding (return, fail) type Parser a = (String-[(a,String)]) return :: a - Parser a return v =

Re: [Haskell-cafe] stuck with a sample of programming in haskell

2010-03-17 Thread
Prelude so that the one you declared locally is used. Michael On Tue, Mar 16, 2010 at 9:09 PM, 国平张 zhangguop...@gmail.com wrote: Hi, I am a beginner for haskell. I was stuck with a sample of programming in haskell. Following is my code

Re: [Haskell-cafe] stuck with a sample of programming in haskell

2010-03-18 Thread
Sorry to bother again. I just cannot figure out how it could compile. I got compile errors. Can someone point out what is right code to use a do notion to make a Parser works. Thanks in advance. newtype

Re: [Haskell-cafe] stuck with a sample of programming in haskell

2010-03-19 Thread
, modules loaded: none. 2010/3/19 Stephen Tetley stephen.tet...@gmail.com: On 19 March 2010 04:35, 国平张 zhangguop...@gmail.com wrote: Sorry to bother again. I just cannot figure out how it could compile. I got compile errors. Can someone point out what is right code to use a do notion to make a Parser

Re: [Haskell-cafe] stuck with a sample of programming in haskell

2010-03-19 Thread
stephen.tet...@gmail.com 写道: 2010/3/19 国平张 zhangguop...@gmail.com: Sorry. The same error, This is new stuff. Ah indeed - I didn't spot that one as I only read the code rather than ran it. With the change the parser type to use /newtype/ all the primitive parsers have to be encoded inside

Re: [Haskell-cafe] Using Get monad to efficiently parse byte-stuffed data

2010-03-23 Thread
Hi, I wrote a type program to compute fibonacci series, if the max value is big, then it becomes very slow. like take 100 fib How can I make it faster :-) fibo 0 = 0 fibo 1 = 1 fibo (n+2) = (fibo n) + (fibo (n+1)) fib :: [Int] fib = [fibo i | i - [0..]]

Re: [Haskell-cafe] Using Get monad to efficiently parse byte-stuffed data

2010-03-23 Thread
sorry. My mistake :-). I wanted to send to haskell-cafe, so I just pick up a mail thread and send reply. But I forgot to change the title. Sorry again for it. 2010/3/24 Ivan Miljenovic ivan.miljeno...@gmail.com: On 24 March 2010 15:46, 国平张 zhangguop...@gmail.com wrote: I wrote a type program

[Haskell-cafe] how to make it faster ?

2010-03-23 Thread
Hi, I wrote a type program to compute fibonacci series, if the max value is big, then it becomes very slow. like take 100 fib How can I make it faster :-) fibo 0 = 0 fibo 1 = 1 fibo (n+2) = (fibo n) + (fibo (n+1)) fib :: [Int] fib = [fibo i | i - [0..]]