[Haskell-beginners] (Integral b, RealFrac b) to Int
han
e at xtendo.org
Tue Feb 9 02:40:57 EST 2010
I have this code:
line (sx, sy) (tx, ty)
| abs (sx - tx) > abs (sy - ty) =
zip xs [(sy + (sy - ty) * x / xd) | x <- [0 .. xd]]
| otherwise =
zip [(sx + (sx - tx) * y / yd) | y <- [0 .. yd]] ys
where
xs = target sx tx
ys = target sy ty
xd = abs (sx - tx)
yd = abs (sy - ty)
It currently has the inferred type signature of
(Integral b, RealFrac b) => (b, b) -> (b, b) -> [(b, b)]
and I want it to be
(Int, Int) -> (Int, Int) -> [(Int, Int)]
which, when coerced, causes an error.
Any idea?
More information about the Beginners
mailing list