Last active
August 11, 2017 10:54
-
-
Save rahult/dc4be01d98a1026f4c5e94e8f2c84cc4 to your computer and use it in GitHub Desktop.
Complex Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Prelude | |
newtype Complex = Complex { | |
real :: Number, | |
imaginary :: Number | |
} | |
instance showComplex :: Show Complex where | |
show (Complex { real: r, imaginary: i }) = show r <> " + " <> show i <> "i" | |
instance eqComplex :: Eq Complex where | |
(==) (Complex { real: a1, imaginary: b1 }) (Complex { real: a2, imaginary: b2 }) = a1 == a2 && b1 == b2 |
Fixed by changing (==)
to eq
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Keep getting this error when I try to compile this file