hi_copy.hs
waxOn = x
where
z = 7
y = z + 18
k = y ^ 2
x = k * 5
triple = a
where
a = a * 3
then load.
ghci> :load hi_copy.hs
[1 of 1] Compiling Main ( hi_copy.hs, interpreted )
Ok, one module loaded.
then run
triple waxOn
<interactive>:122:1: error:
• Couldn't match expected type ‘Integer -> t’
with actual type ‘Integer’
• The function ‘triple’ is applied to one value argument,
but its type ‘Integer’ has none
In the expression: triple waxOn
In an equation for ‘it’: it = triple waxOn
• Relevant bindings include it :: t (bound at <interactive>:122:1)
run 3 * waxOn will work.
but now I don't how to make triple waxOn working.
meta: till now still not learning type in haskell. There maybe other good answers already exists. But I don't understand other people's great answer.
tripledoes not take a parameter. You made an endless recursive function whereais(((((...) * 3) * 3) * 3).triple x = x * 3.