Re:Sisal: a functional parallel programming language
by gizmo686 on Wednesday June 29, 2016 @12:06AM
(#11999425)
I suspect that you could do this already using typeclasses. We want (-2) to be a function of the type `Num a => a -> a`, so we could, in theory, make functions of this type an instance of Num.
I do not immediately see this causing problems for correct programs, but it would probably lead to horribly confusing problems in incorrect code, including converting some type errors into runtime errors.
A simpler approach is to say that you can not have a space after the unary "-", so (-2) parses to a numeric literal, and (- 2) parses to a function.
I do not immediately see this causing problems for correct programs, but it would probably lead to horribly confusing problems in incorrect code, including converting some type errors into runtime errors.
A simpler approach is to say that you can not have a space after the unary "-", so (-2) parses to a numeric literal, and (- 2) parses to a function.