你能帮我吗?我必须做一个甜甜圈图,我不知道如何制作紫罗兰色的Screenshot
Prelude> ::l tree.hs
[1 of 1] Compiling Main ( tree.hs, interpreted )
tree.hs:3:32: error:
• Couldn't match expected type ‘Tree a -> t0 a’
with actual type ‘[b0]’
• The function ‘map’ is applied to three arguments,
but its type ‘(Tree b0 -> b0) -> [Tree b0] -> [b0]’ has only two
In the first argument of ‘sum’, namely ‘(map (sumTree) branch (x))’
In the second argument of ‘(+)’, namely
‘(sum (map (sumTree) branch (x)))’
• Relevant bindings include
x :: Tree a (bound at tree.hs:3:9)
sumTree :: Tree a -> a (bound at tree.hs:3:1)
|
3 | sumTree x = element(x) + (sum (map (sumTree) branch(x)))
| ^^^^^^^^^^^^^^^^^^^^^^^
tree.hs:3:46: error:
• Couldn't match expected type ‘[Tree b0]’
with actual type ‘Tree a0 -> [Tree a0]’
• Probable cause: ‘branch’ is applied to too few arguments
In the second argument of ‘map’, namely ‘branch’
In the first argument of ‘sum’, namely ‘(map (sumTree) branch (x))’
In the second argument of ‘(+)’, namely
‘(sum (map (sumTree) branch (x)))’
|
3 | sumTree x = element(x) + (sum (map (sumTree) branch(x)))
| ^^^^^^