{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wno-orphans #-}

-- | This module provides a linear 'Num' class with instances.
-- Import this module to use linear versions of @(+)@, @(-)@, etc, on numeric
-- types like 'Int' and 'Double'.
--
-- == The Typeclass Hierarchy
--
-- The 'Num' class is broken up into several instances. Here is the basic
-- hierarchy:
--
-- * Additive ⊆ AddIdentity ⊆ AdditiveGroup
-- * MultIdentity ⊆ MultIdentity
-- * (AddIdentity ∩ MultIdentity) ⊆ Semiring
-- * (AdditiveGroup ∩ Semiring) ⊆ Ring
-- * (FromInteger ∩ Ring) ⊆ Num
module Data.Num.Linear
  ( -- * Num and sub-classes
    Num (..),
    Additive (..),
    AddIdentity (..),
    AdditiveGroup (..),
    Multiplicative (..),
    MultIdentity (..),
    Semiring,
    Ring,
    FromInteger (..),

    -- * Mechanisms for deriving instances
    Adding (..),
    getAdded,
    Multiplying (..),
    getMultiplied,
  )
where

-- TODO: flesh out laws

import Data.Monoid.Linear
import Data.Unrestricted.Linear
import qualified Unsafe.Linear as Unsafe
import qualified Prelude

-- | A type that can be added linearly.  The operation @(+)@ is associative and
-- commutative, i.e., for all @a@, @b@, @c@
--
-- > (a + b) + c = a + (b + c)
-- > a + b = b + c
class Additive a where
  (+) :: a %1 -> a %1 -> a
  infixl 6 + -- same fixity as base.+

-- | An 'Additive' type with an identity on @(+)@.
class (Additive a) => AddIdentity a where
  zero :: a

-- | An 'AddIdentity' with inverses that satisfies
-- the laws of an [abelian group](https://en.wikipedia.org/wiki/Abelian_group)
class (AddIdentity a) => AdditiveGroup a where
  {-# MINIMAL negate | (-) #-}
  negate :: a %1 -> a
  negate a
x = forall a. AddIdentity a => a
zero forall a. AdditiveGroup a => a %1 -> a %1 -> a
- a
x
  (-) :: a %1 -> a %1 -> a
  infixl 6 - -- same fixity as base.-
  a
x - a
y = a
x forall a. Additive a => a %1 -> a %1 -> a
+ forall a. AdditiveGroup a => a %1 -> a
negate a
y

-- | A numeric type with an associative @(*)@ operation
class Multiplicative a where
  (*) :: a %1 -> a %1 -> a
  infixl 7 * -- same fixity as base.*

-- | A 'Multiplicative' type with an identity for @(*)@
class (Multiplicative a) => MultIdentity a where
  one :: a

-- | A [semiring](https://en.wikipedia.org/wiki/Semiring) class. This is
-- basically a numeric type with mutliplication, addition and with identities
-- for each. The laws:
--
-- > zero * x = zero
-- > a * (b + c) = (a * b) + (a * c)
class (AddIdentity a, MultIdentity a) => Semiring a

-- Note:
-- Having a linear (*) means we can't short-circuit multiplication by zero

-- | A 'Ring' instance is a numeric type with @(+)@, @(-)@, @(*)@ and all
-- the following properties: a group with @(+)@ and a 'MultIdentity' with @(*)@
-- along with distributive laws.
class (AdditiveGroup a, Semiring a) => Ring a

-- | A numeric type that 'Integer's can be embedded into while satisfying
-- all the typeclass laws @Integer@s obey. That is, if there's some property
-- like commutivity of integers @x + y == y + x@, then we must have:
--
-- > fromInteger x + fromInteger y == fromInteger y + fromInteger x
--
-- For mathy folk: @fromInteger@ should be a homomorphism over @(+)@ and @(*)@.
class FromInteger a where
  fromInteger :: Prelude.Integer %1 -> a

-- XXX: subclass of Prelude.Num? subclass of Eq?
class (Ring a, FromInteger a) => Num a where
  {-# MINIMAL abs, signum #-}

  -- XXX: is it fine to insist abs,signum are linear? I think it is
  abs :: a %1 -> a
  signum :: a %1 -> a

newtype MovableNum a = MovableNum a
  deriving (MovableNum a %1 -> ()
forall a. Consumable a => MovableNum a %1 -> ()
forall a. (a %1 -> ()) -> Consumable a
consume :: MovableNum a %1 -> ()
$cconsume :: forall a. Consumable a => MovableNum a %1 -> ()
Consumable, MovableNum a %1 -> (MovableNum a, MovableNum a)
MovableNum a %1 -> Replicator (MovableNum a)
forall a.
Consumable a
-> (a %1 -> Replicator a) -> (a %1 -> (a, a)) -> Dupable a
forall {a}. Dupable a => Consumable (MovableNum a)
forall a.
Dupable a =>
MovableNum a %1 -> (MovableNum a, MovableNum a)
forall a. Dupable a => MovableNum a %1 -> Replicator (MovableNum a)
dup2 :: MovableNum a %1 -> (MovableNum a, MovableNum a)
$cdup2 :: forall a.
Dupable a =>
MovableNum a %1 -> (MovableNum a, MovableNum a)
dupR :: MovableNum a %1 -> Replicator (MovableNum a)
$cdupR :: forall a. Dupable a => MovableNum a %1 -> Replicator (MovableNum a)
Dupable, MovableNum a %1 -> Ur (MovableNum a)
forall a. Dupable a -> (a %1 -> Ur a) -> Movable a
forall {a}. Movable a => Dupable (MovableNum a)
forall a. Movable a => MovableNum a %1 -> Ur (MovableNum a)
move :: MovableNum a %1 -> Ur (MovableNum a)
$cmove :: forall a. Movable a => MovableNum a %1 -> Ur (MovableNum a)
Movable, Integer -> MovableNum a
MovableNum a -> MovableNum a
MovableNum a -> MovableNum a -> MovableNum a
forall a. Num a => Integer -> MovableNum a
forall a. Num a => MovableNum a -> MovableNum a
forall a. Num a => MovableNum a -> MovableNum a -> MovableNum a
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> MovableNum a
$cfromInteger :: forall a. Num a => Integer -> MovableNum a
signum :: MovableNum a -> MovableNum a
$csignum :: forall a. Num a => MovableNum a -> MovableNum a
abs :: MovableNum a -> MovableNum a
$cabs :: forall a. Num a => MovableNum a -> MovableNum a
negate :: MovableNum a -> MovableNum a
$cnegate :: forall a. Num a => MovableNum a -> MovableNum a
* :: MovableNum a -> MovableNum a -> MovableNum a
$c* :: forall a. Num a => MovableNum a -> MovableNum a -> MovableNum a
- :: MovableNum a -> MovableNum a -> MovableNum a
$c- :: forall a. Num a => MovableNum a -> MovableNum a -> MovableNum a
+ :: MovableNum a -> MovableNum a -> MovableNum a
$c+ :: forall a. Num a => MovableNum a -> MovableNum a -> MovableNum a
Prelude.Num)

instance (Movable a, Prelude.Num a) => Additive (MovableNum a) where
  + :: MovableNum a %1 -> MovableNum a %1 -> MovableNum a
(+) = forall a b c.
(Movable a, Movable b) =>
(a -> b -> c) %1 -> a %1 -> b %1 -> c
liftU2 forall a. Num a => a -> a -> a
(Prelude.+)

instance (Movable a, Prelude.Num a) => AddIdentity (MovableNum a) where
  zero :: MovableNum a
zero = forall a. a -> MovableNum a
MovableNum a
0

instance (Movable a, Prelude.Num a) => AdditiveGroup (MovableNum a) where
  (-) = forall a b c.
(Movable a, Movable b) =>
(a -> b -> c) %1 -> a %1 -> b %1 -> c
liftU2 forall a. Num a => a -> a -> a
(Prelude.-)

instance (Movable a, Prelude.Num a) => Multiplicative (MovableNum a) where
  * :: MovableNum a %1 -> MovableNum a %1 -> MovableNum a
(*) = forall a b c.
(Movable a, Movable b) =>
(a -> b -> c) %1 -> a %1 -> b %1 -> c
liftU2 forall a. Num a => a -> a -> a
(Prelude.*)

instance (Movable a, Prelude.Num a) => MultIdentity (MovableNum a) where
  one :: MovableNum a
one = forall a. a -> MovableNum a
MovableNum a
1

instance (Movable a, Prelude.Num a) => Semiring (MovableNum a)

instance (Movable a, Prelude.Num a) => Ring (MovableNum a)

instance (Movable a, Prelude.Num a) => FromInteger (MovableNum a) where
  fromInteger :: Integer %1 -> MovableNum a
fromInteger = forall a b (p :: Multiplicity) (x :: Multiplicity).
(a %p -> b) %1 -> a %x -> b
Unsafe.toLinear forall a. Num a => Integer -> a
Prelude.fromInteger

instance (Movable a, Prelude.Num a) => Num (MovableNum a) where
  abs :: MovableNum a %1 -> MovableNum a
abs = forall a b. Movable a => (a -> b) %1 -> a %1 -> b
liftU forall a. Num a => a -> a
Prelude.abs
  signum :: MovableNum a %1 -> MovableNum a
signum = forall a b. Movable a => (a -> b) %1 -> a %1 -> b
liftU forall a. Num a => a -> a
Prelude.signum

liftU :: (Movable a) => (a -> b) %1 -> (a %1 -> b)
liftU :: forall a b. Movable a => (a -> b) %1 -> a %1 -> b
liftU a -> b
f a
x = forall a b. (a -> b) %1 -> Ur a %1 -> b
lifted a -> b
f (forall a. Movable a => a %1 -> Ur a
move a
x)
  where
    lifted :: (a -> b) %1 -> (Ur a %1 -> b)
    lifted :: forall a b. (a -> b) %1 -> Ur a %1 -> b
lifted a -> b
g (Ur a
a) = a -> b
g a
a

liftU2 :: (Movable a, Movable b) => (a -> b -> c) %1 -> (a %1 -> b %1 -> c)
liftU2 :: forall a b c.
(Movable a, Movable b) =>
(a -> b -> c) %1 -> a %1 -> b %1 -> c
liftU2 a -> b -> c
f a
x b
y = forall a b c. (a -> b -> c) %1 -> Ur a %1 -> Ur b %1 -> c
lifted a -> b -> c
f (forall a. Movable a => a %1 -> Ur a
move a
x) (forall a. Movable a => a %1 -> Ur a
move b
y)
  where
    lifted :: (a -> b -> c) %1 -> (Ur a %1 -> Ur b %1 -> c)
    lifted :: forall a b c. (a -> b -> c) %1 -> Ur a %1 -> Ur b %1 -> c
lifted a -> b -> c
g (Ur a
a) (Ur b
b) = a -> b -> c
g a
a b
b

-- | A newtype wrapper to give the underlying monoid for an additive structure.
--
-- Deprecated because 'Data.Semigroup.Sum' (reexported as
-- 'Data.Monoid.Linear.Sum') now has a linear 'Semigroup' and
-- 'Data.Monoid.Linear.Monoid' instance.
newtype Adding a = Adding a
  deriving (Adding a -> Adding a -> Bool
forall a. Eq a => Adding a -> Adding a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Adding a -> Adding a -> Bool
$c/= :: forall a. Eq a => Adding a -> Adding a -> Bool
== :: Adding a -> Adding a -> Bool
$c== :: forall a. Eq a => Adding a -> Adding a -> Bool
Prelude.Eq, Adding a -> Adding a -> Bool
Adding a -> Adding a -> Ordering
Adding a -> Adding a -> Adding a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Adding a)
forall a. Ord a => Adding a -> Adding a -> Bool
forall a. Ord a => Adding a -> Adding a -> Ordering
forall a. Ord a => Adding a -> Adding a -> Adding a
min :: Adding a -> Adding a -> Adding a
$cmin :: forall a. Ord a => Adding a -> Adding a -> Adding a
max :: Adding a -> Adding a -> Adding a
$cmax :: forall a. Ord a => Adding a -> Adding a -> Adding a
>= :: Adding a -> Adding a -> Bool
$c>= :: forall a. Ord a => Adding a -> Adding a -> Bool
> :: Adding a -> Adding a -> Bool
$c> :: forall a. Ord a => Adding a -> Adding a -> Bool
<= :: Adding a -> Adding a -> Bool
$c<= :: forall a. Ord a => Adding a -> Adding a -> Bool
< :: Adding a -> Adding a -> Bool
$c< :: forall a. Ord a => Adding a -> Adding a -> Bool
compare :: Adding a -> Adding a -> Ordering
$ccompare :: forall a. Ord a => Adding a -> Adding a -> Ordering
Prelude.Ord, Int -> Adding a -> ShowS
forall a. Show a => Int -> Adding a -> ShowS
forall a. Show a => [Adding a] -> ShowS
forall a. Show a => Adding a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Adding a] -> ShowS
$cshowList :: forall a. Show a => [Adding a] -> ShowS
show :: Adding a -> String
$cshow :: forall a. Show a => Adding a -> String
showsPrec :: Int -> Adding a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Adding a -> ShowS
Prelude.Show)
  deriving (NonEmpty (Adding a) -> Adding a
Adding a -> Adding a -> Adding a
forall b. Integral b => b -> Adding a -> Adding a
forall a. Additive a => NonEmpty (Adding a) -> Adding a
forall a. Additive a => Adding a -> Adding a -> Adding a
forall a b. (Additive a, Integral b) => b -> Adding a -> Adding a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: forall b. Integral b => b -> Adding a -> Adding a
$cstimes :: forall a b. (Additive a, Integral b) => b -> Adding a -> Adding a
sconcat :: NonEmpty (Adding a) -> Adding a
$csconcat :: forall a. Additive a => NonEmpty (Adding a) -> Adding a
<> :: Adding a -> Adding a -> Adding a
$c<> :: forall a. Additive a => Adding a -> Adding a -> Adding a
Prelude.Semigroup) via NonLinear (Adding a)
  deriving (Adding a
[Adding a] -> Adding a
Adding a -> Adding a -> Adding a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall {a}. AddIdentity a => Semigroup (Adding a)
forall a. AddIdentity a => Adding a
forall a. AddIdentity a => [Adding a] -> Adding a
forall a. AddIdentity a => Adding a -> Adding a -> Adding a
mconcat :: [Adding a] -> Adding a
$cmconcat :: forall a. AddIdentity a => [Adding a] -> Adding a
mappend :: Adding a -> Adding a -> Adding a
$cmappend :: forall a. AddIdentity a => Adding a -> Adding a -> Adding a
mempty :: Adding a
$cmempty :: forall a. AddIdentity a => Adding a
Prelude.Monoid) via NonLinear (Adding a)
{-# DEPRECATED Adding "Use 'Data.Semigroup.Sum' (reexported as 'Data.Monoid.Linear.Sum') instead" #-}

getAdded :: Adding a %1 -> a
getAdded :: forall a. Adding a %1 -> a
getAdded (Adding a
x) = a
x
{-# DEPRECATED getAdded "Use 'Data.Semigroup.Sum' (reexported as 'Data.Monoid.Linear.Sum') and pattern-match to extract the inner value linearly" #-}

instance (Additive a) => Semigroup (Adding a) where
  Adding a
a <> :: Adding a %1 -> Adding a %1 -> Adding a
<> Adding a
b = forall a. a -> Adding a
Adding (a
a forall a. Additive a => a %1 -> a %1 -> a
+ a
b)

instance (AddIdentity a) => Monoid (Adding a) where
  mempty :: Adding a
mempty = forall a. a -> Adding a
Adding forall a. AddIdentity a => a
zero

-- | A newtype wrapper to give the underlying monoid for a multiplicative structure.
--
-- Deprecated because 'Data.Semigroup.Product' (reexported as
-- 'Data.Monoid.Linear.Product') now has a linear 'Semigroup' and
-- 'Data.Monoid.Linear.Monoid' instance.
newtype Multiplying a = Multiplying a
  deriving (Multiplying a -> Multiplying a -> Bool
forall a. Eq a => Multiplying a -> Multiplying a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Multiplying a -> Multiplying a -> Bool
$c/= :: forall a. Eq a => Multiplying a -> Multiplying a -> Bool
== :: Multiplying a -> Multiplying a -> Bool
$c== :: forall a. Eq a => Multiplying a -> Multiplying a -> Bool
Prelude.Eq, Multiplying a -> Multiplying a -> Bool
Multiplying a -> Multiplying a -> Ordering
Multiplying a -> Multiplying a -> Multiplying a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall {a}. Ord a => Eq (Multiplying a)
forall a. Ord a => Multiplying a -> Multiplying a -> Bool
forall a. Ord a => Multiplying a -> Multiplying a -> Ordering
forall a. Ord a => Multiplying a -> Multiplying a -> Multiplying a
min :: Multiplying a -> Multiplying a -> Multiplying a
$cmin :: forall a. Ord a => Multiplying a -> Multiplying a -> Multiplying a
max :: Multiplying a -> Multiplying a -> Multiplying a
$cmax :: forall a. Ord a => Multiplying a -> Multiplying a -> Multiplying a
>= :: Multiplying a -> Multiplying a -> Bool
$c>= :: forall a. Ord a => Multiplying a -> Multiplying a -> Bool
> :: Multiplying a -> Multiplying a -> Bool
$c> :: forall a. Ord a => Multiplying a -> Multiplying a -> Bool
<= :: Multiplying a -> Multiplying a -> Bool
$c<= :: forall a. Ord a => Multiplying a -> Multiplying a -> Bool
< :: Multiplying a -> Multiplying a -> Bool
$c< :: forall a. Ord a => Multiplying a -> Multiplying a -> Bool
compare :: Multiplying a -> Multiplying a -> Ordering
$ccompare :: forall a. Ord a => Multiplying a -> Multiplying a -> Ordering
Prelude.Ord, Int -> Multiplying a -> ShowS
forall a. Show a => Int -> Multiplying a -> ShowS
forall a. Show a => [Multiplying a] -> ShowS
forall a. Show a => Multiplying a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Multiplying a] -> ShowS
$cshowList :: forall a. Show a => [Multiplying a] -> ShowS
show :: Multiplying a -> String
$cshow :: forall a. Show a => Multiplying a -> String
showsPrec :: Int -> Multiplying a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Multiplying a -> ShowS
Prelude.Show)
  deriving (NonEmpty (Multiplying a) -> Multiplying a
Multiplying a -> Multiplying a -> Multiplying a
forall b. Integral b => b -> Multiplying a -> Multiplying a
forall a.
Multiplicative a =>
NonEmpty (Multiplying a) -> Multiplying a
forall a.
Multiplicative a =>
Multiplying a -> Multiplying a -> Multiplying a
forall a b.
(Multiplicative a, Integral b) =>
b -> Multiplying a -> Multiplying a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: forall b. Integral b => b -> Multiplying a -> Multiplying a
$cstimes :: forall a b.
(Multiplicative a, Integral b) =>
b -> Multiplying a -> Multiplying a
sconcat :: NonEmpty (Multiplying a) -> Multiplying a
$csconcat :: forall a.
Multiplicative a =>
NonEmpty (Multiplying a) -> Multiplying a
<> :: Multiplying a -> Multiplying a -> Multiplying a
$c<> :: forall a.
Multiplicative a =>
Multiplying a -> Multiplying a -> Multiplying a
Prelude.Semigroup) via NonLinear (Multiplying a)
  deriving (Multiplying a
[Multiplying a] -> Multiplying a
Multiplying a -> Multiplying a -> Multiplying a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall {a}. MultIdentity a => Semigroup (Multiplying a)
forall a. MultIdentity a => Multiplying a
forall a. MultIdentity a => [Multiplying a] -> Multiplying a
forall a.
MultIdentity a =>
Multiplying a -> Multiplying a -> Multiplying a
mconcat :: [Multiplying a] -> Multiplying a
$cmconcat :: forall a. MultIdentity a => [Multiplying a] -> Multiplying a
mappend :: Multiplying a -> Multiplying a -> Multiplying a
$cmappend :: forall a.
MultIdentity a =>
Multiplying a -> Multiplying a -> Multiplying a
mempty :: Multiplying a
$cmempty :: forall a. MultIdentity a => Multiplying a
Prelude.Monoid) via NonLinear (Multiplying a)
{-# DEPRECATED Multiplying "Use 'Data.Semigroup.Product' (reexported as 'Data.Monoid.Linear.Product') instead" #-}

getMultiplied :: Multiplying a %1 -> a
getMultiplied :: forall a. Multiplying a %1 -> a
getMultiplied (Multiplying a
x) = a
x
{-# DEPRECATED getMultiplied "Use 'Data.Semigroup.Product' (reexported as 'Data.Monoid.Linear.Product') and pattern-match to extract the inner value linearly" #-}

instance (Multiplicative a) => Semigroup (Multiplying a) where
  Multiplying a
a <> :: Multiplying a %1 -> Multiplying a %1 -> Multiplying a
<> Multiplying a
b = forall a. a -> Multiplying a
Multiplying (a
a forall a. Multiplicative a => a %1 -> a %1 -> a
* a
b)

instance (MultIdentity a) => Monoid (Multiplying a) where
  mempty :: Multiplying a
mempty = forall a. a -> Multiplying a
Multiplying forall a. MultIdentity a => a
one

instance (Multiplicative a) => Semigroup (Product a) where
  (Product a
x) <> :: Product a %1 -> Product a %1 -> Product a
<> (Product a
y) = forall a. a -> Product a
Product (a
x forall a. Multiplicative a => a %1 -> a %1 -> a
* a
y)

instance (Additive a) => Semigroup (Sum a) where
  (Sum a
x) <> :: Sum a %1 -> Sum a %1 -> Sum a
<> (Sum a
y) = forall a. a -> Sum a
Sum (a
x forall a. Additive a => a %1 -> a %1 -> a
+ a
y)

instance (MultIdentity a) => Monoid (Product a) where
  mempty :: Product a
mempty = forall a. a -> Product a
Product forall a. MultIdentity a => a
one

instance (AddIdentity a) => Monoid (Sum a) where
  mempty :: Sum a
mempty = forall a. a -> Sum a
Sum forall a. AddIdentity a => a
zero

deriving via MovableNum Prelude.Int instance Additive Prelude.Int

deriving via MovableNum Prelude.Double instance Additive Prelude.Double

deriving via MovableNum Prelude.Int instance AddIdentity Prelude.Int

deriving via MovableNum Prelude.Double instance AddIdentity Prelude.Double

deriving via MovableNum Prelude.Int instance AdditiveGroup Prelude.Int

deriving via MovableNum Prelude.Double instance AdditiveGroup Prelude.Double

deriving via MovableNum Prelude.Int instance Multiplicative Prelude.Int

deriving via MovableNum Prelude.Double instance Multiplicative Prelude.Double

deriving via MovableNum Prelude.Int instance MultIdentity Prelude.Int

deriving via MovableNum Prelude.Double instance MultIdentity Prelude.Double

deriving via MovableNum Prelude.Int instance Semiring Prelude.Int

deriving via MovableNum Prelude.Double instance Semiring Prelude.Double

deriving via MovableNum Prelude.Int instance Ring Prelude.Int

deriving via MovableNum Prelude.Double instance Ring Prelude.Double

deriving via MovableNum Prelude.Int instance FromInteger Prelude.Int

deriving via MovableNum Prelude.Double instance FromInteger Prelude.Double

deriving via MovableNum Prelude.Int instance Num Prelude.Int

deriving via MovableNum Prelude.Double instance Num Prelude.Double