I want to redefine several arithmetic operators in Haskell in order to make them more extensible and generic.
E.g.
class Mul a b c | a b -> c where
(*) :: a -> b -> c
This seems to work in combination with
import Prelude hiding ((*))
hiding the standard *
operator. But of course all usual multiplications have to work as well, so I'd have to define something like
instance (Num t) => Mul t t t where
(*) = ??
How can I access the original *
operator (Prelude.(*)
doesn't work) here and how do I have to define the instance type such that 1 * 1
doesn't conflict with the Monomorpism Restriction?
Edit -
import qualified
is a good tip, thanks.
But unfortunately this forced me to bring all standard methods into scope explicitly. I just want to have the possibility of redefining certain bindings leaving the rest unchanged.
So is there a combination of both? Something like
import Prelude qualified ((*))