1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | sumOfSquare :: Int -> Int -> Int sumOfSquare a b = a * a + b * b hipotenuse :: Int -> Int -> Int hipotenuse a b = truncate(sqrt(x)) where x = fromIntegral(sumOfSquare a b) squareCheck :: Int -> Bool squareCheck n = truncate(sqrt(x)) * truncate(sqrt(x)) == n where x = fromIntegral n isItSquare :: Int -> Int -> Bool isItSquare a b = squareCheck (sumOfSquare a b) data SidesType = Sides Int Int Int deriving (Show) calc :: Int -> [SidesType] calc a = [(Sides x y (hipotenuse x y)) | x <- [1..a], y <-[1..a], (isItSquare x y)] test :: Int -> SidesType test a = (Sides 1 2 3) |