Re: [Haskell-cafe] Beginner Question

2007-02-09 Thread Yitzchak Gale
Hi Vishy, You wrote: I have just started on my journey in learning Haskell. Welcome aboard! We all wish you an enjoyable and (type)safe trip. I have started off reading wikibook, then will read yet another tutorial on haskell. Please guide me if I am on right track Those are both great

Re: [Haskell-cafe] IO is not a monad

2007-02-09 Thread Yitzchak Gale
Lennart Augustsson wrote: I think seq is funny because it is not lambda definable. I wrote: Does the set of computable functions on the natural numbers defined by the lambda calculus augmented with seq have higher Turing degree than the set of classical computable functions? I guess I was

[Haskell-cafe] FFI basics

2007-02-09 Thread Yitzchak Gale
Hi, I would like to use FFI for the first time. Can someone give me a really, really simple complete example? I want to be able to take a simple C program and access a function from it in Haskell. A simple example of the other way around would be nice, too, but I don't happen to need that just

Re: [Haskell-cafe] FFI basics

2007-02-09 Thread Alistair Bayley
I would like to use FFI for the first time. Can someone give me a really, really simple complete example? Everything I found on the wiki seems way beyond that - maybe I missed it. I am using GHC. I am not using Windows. From the old wiki: http://www.haskell.org/hawiki/FfiCookbook

Re: [Haskell-cafe] FFI basics

2007-02-09 Thread Bulat Ziganshin
Hello Yitzchak, Friday, February 9, 2007, 3:23:53 PM, you wrote: I would like to use FFI for the first time. Can someone give me a really, really simple complete example? nothing can be easier main = print (c_mysin 1.0) foreign import ccall mysin.h mysin c_mysin :: Double - Double

[Haskell-cafe] factorising to prime numbers

2007-02-09 Thread Dougal Stanton
Hi folks, I recently read in my copy of Concrete Mathematics the relationship between prime factors powers and lcm/gcd functions. So I decided to reimplement gcd and lcm the long way, for no other reason than because I could. If you look at the definition of 'powers' you'll note it's infinite.

Re: [Haskell-cafe] factorising to prime numbers

2007-02-09 Thread kahl
If you look at the definition of 'powers' you'll note it's infinite. So there's no easy way to take the product of this list, if I don't know how many items to take from it. So you need finite lists. -- how many of the prime p are in the unique factorisation -- of the integer n?

Re: [Haskell-cafe] factorising to prime numbers

2007-02-09 Thread Robert Dockins
On Feb 9, 2007, at 9:20 AM, Dougal Stanton wrote: Hi folks, I recently read in my copy of Concrete Mathematics the relationship between prime factors powers and lcm/gcd functions. So I decided to reimplement gcd and lcm the long way, for no other reason than because I could. If you look at

Re: [Haskell-cafe] factorising to prime numbers

2007-02-09 Thread Mikael Johansson
On Fri, 9 Feb 2007, Dougal Stanton wrote: Hi folks, I recently read in my copy of Concrete Mathematics the relationship between prime factors powers and lcm/gcd functions. So I decided to reimplement gcd and lcm the long way, for no other reason than because I could. If you look at the

[Haskell-cafe] GHC throws IOError on Win32 when there is no console

2007-02-09 Thread John Ky
Hi, I noticed on Windows that when I use IO functions that write to stdout when the process is lacking a console, those functions throw an IOError. I'm not sure if this also occurs for stderr because I haven't tried it. Some classes of processes are created without a console because they never

[Haskell-cafe] Re: GHC throws IOError on Win32 when there is no console

2007-02-09 Thread John Ky
Sorry, I should clarify. I am writing about applications compiled with GHC. -John On 2/10/07, John Ky [EMAIL PROTECTED] wrote: Hi, I noticed on Windows that when I use IO functions that write to stdout when the process is lacking a console, those functions throw an IOError. I'm not sure if

Re: [Haskell-cafe] GHC throws IOError on Win32 when there is no console

2007-02-09 Thread Paul Moore
On 09/02/07, John Ky [EMAIL PROTECTED] wrote: I noticed on Windows that when I use IO functions that write to stdout when the process is lacking a console, those functions throw an IOError. I'm not sure if this also occurs for stderr because I haven't tried it. This is Windows standard

[Haskell-cafe] Random numbers without IO

2007-02-09 Thread Dougal Stanton
Well, nobody likes tainting their beautiful pure code with IO, so I rewrote the Random module to take advantage of the latest research [1]: module Random where getRandom = 4 Cheers, D. [1] http://xkcd.com/c221.html -- Dougal Stanton ___

[Haskell-cafe] What's wrong with cgi-undecidable?

2007-02-09 Thread keepbal
http://darcs.haskell.org/packages/cgi-undecidable/ There only 3 or 4 lines of source code, but it can't be installed. The ghc version is 6.6 . Undecidable.hs:23:0: Duplicate instance declarations: instance [overlap ok] (MonadTrans t, MonadCGI m, Monad (t m)) =

Re: [Haskell-cafe] Random numbers without IO

2007-02-09 Thread Andrew Wagner
That's definitely the lazy approach! On 2/9/07, Dougal Stanton [EMAIL PROTECTED] wrote: Well, nobody likes tainting their beautiful pure code with IO, so I rewrote the Random module to take advantage of the latest research [1]: module Random where getRandom = 4 Cheers, D. [1]

Re: [Haskell-cafe] What's wrong with cgi-undecidable?

2007-02-09 Thread Matthew Brecknell
http://darcs.haskell.org/packages/cgi-undecidable/ There only 3 or 4 lines of source code, but it can't be installed. The ghc version is 6.6 . Undecidable.hs:23:0: Duplicate instance declarations: instance [overlap ok] (MonadTrans t, MonadCGI m, Monad (t m)) =

[Haskell-cafe] Tricks for making low level haskell hacking easier

2007-02-09 Thread Donald Bruce Stewart
For those of you who like your Haskell code fast, then, if you're like me, reading Core output all day can give you headaches. Here's a couple of tricks I use to make optimising low level stuff easier. 1) Use Hscolour to pretty-ifiy the Core so its more parsable: ghc -O Foo.hs -ddump-simpl

[Haskell-cafe] Query

2007-02-09 Thread vishy anand
hi i am going through yaht tutorial and exercise 4.6 and 4.7..i understood 4.6,but not 4.7 in which fromTuple (One a ) = Left (Left a ) and fromTuple (Two a b ) = Left (Right (a,b) ) function r written..why use Either type..cant i just say fromTuple (Two a b )=(a,b)