I'm very much a beginner in Haskell, I'm trying to create a tuple of 2 elements, the first being an integer, and the second being a float. Example:
f1 n = [(x, x) | x <- [1 .. n]]
f2 n = [(x, 1 / x) | x <- [1 .. n]]
> f1 5
[(1,1),(2,2),(3,3),(4,4),(5,5)]
> f2 5
[(1.0,1.0),(2.0,0.5),(3.0,0.3333333333333333),(4.0,0.25),(5.0,0.2)]
f1 behaves as expected, returning a list of tuples of two integers.
f2 returns a list of tuples of two floats, but I was expecting it to return a list of tuples of one integer and one float.
How would I preserve the first tuple element type as integer, such that the output of f2 5 would look like: [(1,1.0),(2,0.5),(3,0.3333333333333333),(4,0.25),(5,0.2)]