I have 3 functions, the first one is a
toList :: Tree -> [Integer]
the second is
sumTree :: Tree -> Maybe Integer
which sums a the elements in a tree, filtering for some edge cases. My main function is
treeSum :: Tree -> Maybe Integer
which I want to call the toList on the input to Tree then call sumTree on the output of the previous call. I don't know how to structure it together elegantly. What I did was
treeSum = sumTree (toList x)
but I am getting x not in scope.
xis not defined. You probably wanttreeSumto takexas an argument, which in Haskell is writtentreeSum x = .... Exercise: what will the type ofxbe?