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 function definition
without the signature and query GHCi for the correct type:
Prelude> :m + List
Prelude List> :m + Ratio
Prelude List Ratio> let rationals n = (putStr . unlines . map show) \
(take n (nub [x % y | y <- [1..], x <- [1..y], x < y]))
Prelude List Ratio> :t rationals
rationals :: Int -> IO ()
Cheers,
Stefan
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe