From adff19b765829c09432d905c6d4fcb5d8205b70d Mon Sep 17 00:00:00 2001 From: Rowan Torbitzky-Lane Date: Fri, 7 Mar 2025 01:14:00 -0600 Subject: [PATCH] fix warnings --- src/HushGP/Instructions/VectorFloatInstructions.hs | 6 +++--- src/HushGP/Instructions/VectorIntInstructions.hs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/HushGP/Instructions/VectorFloatInstructions.hs b/src/HushGP/Instructions/VectorFloatInstructions.hs index 02d9550..56c9a00 100644 --- a/src/HushGP/Instructions/VectorFloatInstructions.hs +++ b/src/HushGP/Instructions/VectorFloatInstructions.hs @@ -335,7 +335,7 @@ instructionVectorFloatInsertVectorFloat = instructionVectorInsertVector vectorFl -- |Takes the mean of the top float vector and pushes the rounded float value -- to the float stack. instructionVectorFloatMean :: State -> State -instructionVectorFloatMean state@(State {_vectorFloat = [] : vs}) = instructionVectorFuncVectorToPrim float vectorFloat retZero state +instructionVectorFloatMean state@(State {_vectorFloat = [] : _}) = instructionVectorFuncVectorToPrim float vectorFloat retZero state instructionVectorFloatMean state = instructionVectorFuncVectorToPrim float vectorFloat (\xs -> sum xs / fromIntegral @Int @Double (length xs)) state -- |Takes the maximum of the top float vector and pushes the float value @@ -413,11 +413,11 @@ instructionVectorFloatAbs = instructionVectorFuncVectorToVector vectorFloat (map -- |Applies the square function to all indices in an float vector, rounds the result as it moves along. instructionVectorFloatSquare :: State -> State -instructionVectorFloatSquare = instructionVectorFuncVectorToVector vectorFloat (map (^ 2)) +instructionVectorFloatSquare = instructionVectorFuncVectorToVector vectorFloat (map (^ (2 :: Int))) -- |Applies the cube function to all indices in an float vector, rounds the result as it moves along. instructionVectorFloatCube :: State -> State -instructionVectorFloatCube = instructionVectorFuncVectorToVector vectorFloat (map (^ 3)) +instructionVectorFloatCube = instructionVectorFuncVectorToVector vectorFloat (map (^ (3 :: Int))) -- |Applies the sqrt function to all indices in an float vector, rounds the result as it moves along. instructionVectorFloatSqrt :: State -> State diff --git a/src/HushGP/Instructions/VectorIntInstructions.hs b/src/HushGP/Instructions/VectorIntInstructions.hs index 4086b2f..c02cb78 100644 --- a/src/HushGP/Instructions/VectorIntInstructions.hs +++ b/src/HushGP/Instructions/VectorIntInstructions.hs @@ -335,7 +335,7 @@ instructionVectorIntInsertVectorInt = instructionVectorInsertVector vectorInt -- |Takes the mean of the top int vector and pushes the rounded int value -- to the int stack. instructionVectorIntMean :: State -> State -instructionVectorIntMean state@(State {_vectorInt = [] : vs}) = instructionVectorFuncVectorToPrim int vectorInt retZero state +instructionVectorIntMean state@(State {_vectorInt = [] : _}) = instructionVectorFuncVectorToPrim int vectorInt retZero state instructionVectorIntMean state = instructionVectorFuncVectorToPrim int vectorInt (\xs -> round $ sum (map (fromIntegral @Integer @Double) xs) / fromIntegral @Int @Double (length xs)) state -- |Takes the maximum of the top int vector and pushes the int value @@ -413,11 +413,11 @@ instructionVectorIntAbs = instructionVectorFuncVectorToVector vectorInt (map (ro -- |Applies the square function to all indices in an int vector, rounds the result as it moves along. instructionVectorIntSquare :: State -> State -instructionVectorIntSquare = instructionVectorFuncVectorToVector vectorInt (map (round . (^ 2) . fromIntegral @Integer @Double)) +instructionVectorIntSquare = instructionVectorFuncVectorToVector vectorInt (map (round . (^ (2 :: Int)) . fromIntegral @Integer @Double)) -- |Applies the cube function to all indices in an int vector, rounds the result as it moves along. instructionVectorIntCube :: State -> State -instructionVectorIntCube = instructionVectorFuncVectorToVector vectorInt (map (round . (^ 3) . fromIntegral @Integer @Double)) +instructionVectorIntCube = instructionVectorFuncVectorToVector vectorInt (map (round . (^ (3 :: Int)) . fromIntegral @Integer @Double)) -- |Applies the sqrt function to all indices in an int vector, rounds the result as it moves along. instructionVectorIntSqrt :: State -> State