私は簡単なコードを持っています
delta a b c = b*b - (4*a*c)
mz1 :: Double -> Double -> Double -> Double
mz1 a b c = (-b - sqrt(delta a b c)) / (2*a)
mz2 :: Double -> Double -> Double -> Double
mz2 a b c = (-b + sqrt(delta a b c)) / (2*a)
mz0 :: Double -> Double -> Double -> Double
mz0 a b c = (-b) / (2*a)
kwad :: (Enum a) => a -> a -> a -> Either Double Bool
kwad a b c
| delta a b c == 0 = Left mz0 a b c
| delta a b c < 0 = Right False
| otherwise = Left mz1 a b c
私はHaskellを学び始めたばかりで、BoolまたはDoubleを返す方法がわかりません。誰か助けてもらえますか?
エラーは次のとおりです。
Couldn't match expected type `a -> a -> a -> Either Double Bool' with actual type `Either (Double -> Double -> Double -> Double) >b0' The function `Left' is applied to four arguments, but its type `(Double -> Double -> Double -> Double) -> Either (Double -> Double -> Double -> Double) b0' has only one