Inorder means that you (1) first process the left subtree, (2) then process the node itself, and (3) finally process the right subtree.
Leaves without values
Based on your function, the definition of BinaryTree a, is probably:
data BinaryTree a = Leaf | Node (BinaryTree a) a (BinaryTree a)
So that means that there are two cases: in case of a leaf, there is no data, so we simply return the given value:
inorder' _ a Leaf = a -- with an uppercase, otherwise it does match all
And for the Node case, we above already stated how that works:
inorder' f a (Node left val right) = inorder' f c right
where b = inorder' f a left
c = f b val
Or in full:
inorder' :: (b -> a -> b) -> b -> BinaryTree a -> b
inorder' _ a Leaf = a
inorder' f a (Node left val right) = inorder' f c right
where b = inorder' f a left
c = f b val
Leaves with values
In that case the BinaryTree is defined like:
data BinaryTree a = Leaf a | Node (BinaryTree a) a (BinaryTree a)
In case the leaves have a value, we simply need to fix the first clause:
inorder' :: (b -> a -> b) -> b -> BinaryTree a -> b
inorder' f b (Leaf a) = f b a
inorder' f a (Node left val right) = inorder' f c right
where b = inorder' f a left
c = f b val
BinaryTree a.