Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# LANGUAGE FlexibleInstances #-}
- {-# LANGUAGE FlexibleContexts #-}
- {-# LANGUAGE UndecidableInstances #-}
- instance (Num a, Applicative f, Show (f a), Eq (f a)) => Num (f a) where
- (+) = liftA2 (+)
- (-) = liftA2 (-)
- (*) = liftA2 (*)
- negate = fmap negate
- signum = fmap signum
- abs = fmap abs
- fromInteger = pure . fromInteger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement