rectangleRaster :: Coord -> Coord -> Raster
rectangleRaster a b = (Rectangle [(a, 1)] [(b, 1)])
Прямоугольник определяется двумя точками:
data Shape
= Point Point
| Rectangle Point
Point
| Circle Point
Point
| Line Point
Point
| Polygon [Point]
deriving (Show)
и точка определяется как
type Point = (Double, Double)
где:
type Shade = Double
type Coord = (Int, Int)
и
type Pixel = (Coord, Shade)
type Raster = [Pixel]
ошибка:
src\View.hs:70:24: error:
* Couldn't match type `Shape' with `[Pixel]'
Expected type: Raster
Actual type: Shape
* In the expression: (Rectangle [(a, 1)] [(b, 1)])
In an equation for `rectangleRaster':
rectangleRaster a b = (Rectangle [(a, 1)] [(b, 1)])
|
70 | rectangleRaster a b = (Rectangle [(a, 1)] [(b, 1)])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
src\View.hs:70:34: error:
* Couldn't match type `[(Coord, Integer)]' with `(Double, Double)'
Expected type: Point
Actual type: [(Coord, Integer)]
* In the first argument of `Rectangle', namely `[(a, 1)]'
In the expression: (Rectangle [(a, 1)] [(b, 1)])
In an equation for `rectangleRaster':
rectangleRaster a b = (Rectangle [(a, 1)] [(b, 1)])
|
70 | rectangleRaster a b = (Rectangle [(a, 1)] [(b, 1)])
| ^^^^^^^^
src\View.hs:70:43: error:
* Couldn't match type `[(Coord, Integer)]' with `(Double, Double)'
Expected type: Point
Actual type: [(Coord, Integer)]
* In the second argument of `Rectangle', namely `[(b, 1)]'
In the expression: (Rectangle [(a, 1)] [(b, 1)])
In an equation for `rectangleRaster':
rectangleRaster a b = (Rectangle [(a, 1)] [(b, 1)])
|
70 | rectangleRaster a b = (Rectangle [(a, 1)] [(b, 1)])
|
Не уверен, что я делаю не так? Это может быть связано с тем, что Raster является списком [Pixel], если так, может кто-нибудь помочь мне решить эту проблему? Спасибо!