mikemcgowan·11 anni fa·discussdistance :: { x :: Number, y :: Number } -> Numberdistance point = sqrt(point.x^2 + point.y^2)The function application of sqrt shouldn't have parens.And the type of distance should bedistance :: forall r. { x :: Number, y :: Number | r} -> NumberOtherwise, it's not row-polymorphic and you wouldn't be able to apply distance to a record of type Point3D.
distance point = sqrt(point.x^2 + point.y^2)
The function application of sqrt shouldn't have parens.
And the type of distance should be
distance :: forall r. { x :: Number, y :: Number | r} -> Number
Otherwise, it's not row-polymorphic and you wouldn't be able to apply distance to a record of type Point3D.