Function Overloading in Haskell
问题 I have a structure which represents the equation of a line in the form m x + b and a structure of a point Line { m :: Double, b :: Double } deriving( Show, Eq ) Point { x :: Double, y :: Double } deriving( Show, Eq ) I want the function perpendicular that does the following: perpendicular (Line m b) (Point x y) = Line m2 b2 where m2 = (-1/m) b2 = y - m2*x if given a line and a point, or a partially applied Line perpendicular (Line m b) = Line m2 where m2 = (-1/m) if only given a Line. The