浮动问题

抱歉,如果这个问题确实是直截了当的,但是我一直对自己编写的一段随机代码感到有些困惑,我很好奇为什么以下代码无法编译:

test::Floating a => Int -> [a]
test x = map(\y -> (y * abs(cos(y)))) [0..x]

I'm trying to understand most typeclasses and I thought of using Floating since we're using cosine. The goal of the function is to make a list of 0 to x with the following function: \y -> (y * abs(cos(y)))

但是,编译器抱怨x的类型(“无法将类型'a'与'Int'匹配”),说它期望类型[a]但接收到[Int]。 为什么是这样?毕竟,我将这些整数提供给匿名函数以获取Floats列表。