I have a custom type called Weight.
It is defined like this:
data Weight = Weight ((Float, Float, Float, Float), Float) deriving Show
I have this function:
evaluate_individual :: StdGen → Weight → Weight
evaluate_individual gen ((w, x, y, z), f) =
let (fitness, _) = random gen :: (Float, StdGen)
in Weight ((w, x, y, z), fitness)
I get this error:
trader.hs:33:25: error: [GHC-83865]
• Couldn’t match expected type ‘Weight’
with actual type ‘((Float, Float, Float, Float), b0)’
• In the pattern: ((w, x, y, z), f)
In an equation for ‘evaluate_individual’:
evaluate_individual gen ((w, x, y, z), f)
= let (fitness, gen1) = … in Weight ((w, x, y, z), fitness)
|
33 | evaluate_individual gen ((w, x, y, z), f) =
| ^^^^^^^^^^^^^^^^^
This occurs even when I don’t call the function in main.
I have also verified that it occurs when calling it in main with an StdGen and a Weight. I know the StdGen and Weight are the types of the parameters I am passing this function because I commented out the function, loaded this into ghci, and used :step and :t var_name for each variable to verify I’m not crazy.
What could possibly be going in here?
What is the ‘b0’ the compiler is talking about?
I have no custom type called b0 in the entire program.
I am new to haskell, and this is the first major program I am writing in it, so I apologize if this is something silly.
I have read everything up to and through the IO section in Learn You a Haskell for Great Good, that is all I know.
Thank you for your time.