网站affiliate怎么做?,qq小程序开放平台,百度网站快速收录,怎么做货物收发的网站以下显示了如何在Haskell中完成它.基于类型siginure divide :: Int – Int – 无论[Char] Int,您都可以看到函数除法将返回Left字符串或Right Int.要么是代数数据结构,还有更多,你可以自己编写.divide :: Int - Int - Either [Char] Intdivide dividend divis…以下显示了如何在Haskell中完成它.基于类型siginure divide :: Int – Int – 无论[Char] Int,您都可以看到函数除法将返回Left字符串或Right Int.要么是代数数据结构,还有更多,你可以自己编写.divide :: Int - Int - Either [Char] Intdivide dividend divisor| (divisor 0) Left Sorry, 0 is not allowed :o| (dividend (minBound :: Int)) (divisor -1) Left somethig went wrong| otherwise Right (dividend div divisor)main doprint (divide 4 2) -- Right 2print (divide 4 0) -- Left Sorry, 0 is not allowed :oprint (divide (minBound :: Int) (-1)) -- Left somethig went wrong在Haskell中,您可以将错误抛出错误“和您的错误消息”,但这会让您崩溃程序……这不是我们想要的.