I have to write a function that checks if binary tree is binary search tree. This is what I got, but it gives me types errors and I don't know how to fix them
isBinarySearchTree :: BTree Int -> Bool
isBinarySearchTree (Node v Empty Empty) = True
isBinarySearchTree (Node v lt rt) = isBinarySearchTree lt
&& isBinarySearchTree rt
&& (lt == Empty || max lt < v)
&& (rt == Empty || min rt > v)
This is the error
* Couldn't match expected type `BTree Int -> BTree Int'
with actual type `Int'
* In the second argument of `(<)', namely `v'
In the second argument of `(||)', namely `max lt < v'
In the first argument of `(&&)', namely
`(lt == Empty || max lt < v)'
&& (lt == Empty || max lt < v)
^
* Couldn't match expected type `BTree Int -> BTree Int'
with actual type `Int'
* In the second argument of `(>)', namely `v'
In the second argument of `(||)', namely `min rt > v'
In the second argument of `(&&)', namely
`(rt == Empty || min rt > v)'
&& (rt == Empty || min rt > v)
^
maxandminfor trees?