如何避免Haskell中的重复函数调用

Myk*_*yke 2 haskell

如何避免此Haskell命令中的重复x

ccheck :: Balance -> Integer
ccheck b     | x >= 1200    = x - 7
             | otherwise    = x
               where x = account b
Run Code Online (Sandbox Code Playgroud)

lef*_*out 6

好吧,你几乎可以做任何无点的事情.

import Control.Arrow
ccheck = uncurry (+) . (min 0 . (*7) . signum . (1199-) &&& id) . account
Run Code Online (Sandbox Code Playgroud)

但是WTH.你的版本很好,它正在发生的事情要清楚得多,正如三十二上校所说,它根本不是重复的.