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
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
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
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
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 <-
>
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 <