Re: [Haskell-cafe] Function Returning Type?

2009-05-21 Thread Mark Wassell
To the original poster: next time, just leave the function definition without the signature and query GHCi for the correct type: Remember that the type checker is your friend; let it work for you :) Mark ___ Haskell-Cafe mailing list Haskell-Cafe@h

Re: [Haskell-cafe] Function Returning Type?

2009-05-21 Thread Thomas Davie
Op 21 May 2009, om 21:52 heeft Stefan Holdermans het volgende geschreven: Jochem, rationals n = (putStr . unlines . map show) (take n (nub [x % y | y <- [1..], x <- [1..y], x < y])) rationals n :: Integer -> [Ratio] I meant "Integer -> String" obviously. Er... what about ration

Re: [Haskell-cafe] Function Returning Type?

2009-05-21 Thread Stefan Holdermans
Jochem, rationals n = (putStr . unlines . map show) (take n (nub [x % y | y <- [1..], x <- [1..y], x < y])) rationals n :: Integer -> [Ratio] I meant "Integer -> String" obviously. Er... what about rationals :: Int -> IO () ? ;-) To the original poster: next time, just leave the f

Re: [Haskell-cafe] Function Returning Type?

2009-05-21 Thread Jochem Berndsen
Jochem Berndsen wrote: > This makes sense, since "rationals" has type Integer I meant "Integer -> String" obviously. Regards, -- Jochem Berndsen | joc...@functor.nl GPG: 0xE6FABFAB ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.hask

Re: [Haskell-cafe] Function Returning Type?

2009-05-21 Thread Jochem Berndsen
jrw4 wrote: > I wrote this function as I am just learning Haskell. What it does is it > generates a list of all rational numbers between 0 and 1, but I only have it > show the first 20. > > rationals n :: Integer -> String > rationals n = (putStr . unlines . map show) (take n (nub [x % y | y <- >

[Haskell-cafe] Function Returning Type?

2009-05-21 Thread jrw4
I wrote this function as I am just learning Haskell. What it does is it generates a list of all rational numbers between 0 and 1, but I only have it show the first 20. rationals n :: Integer -> String rationals n = (putStr . unlines . map show) (take n (nub [x % y | y <- [1..], x <- [1..y], x <