I wrote a simple function which should perform the function of a halfadder.
fun halfadder :: "bool * bool ⇒ bool * bool"
where
"halfadder (a,b) = (
let s = xor a b in
let cout = and a b in
(cout,s))"
However, I get the following error:
Type unification failed: No type arity bool :: semiring_bit_operations
Type error in application: incompatible operand type
Operator: xor :: ??'a ⇒ ??'a ⇒ ??'a
Operand: a :: bool
Why is it not able to perform a XOR operation on a bool? What is going wrong here?
I have tried using the XOR operator with different data types and it still faces the same error