{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.Array.Accelerate.Classes.Fractional (
Fractional,
(P./), P.recip, P.fromRational,
) where
import Data.Array.Accelerate.Smart
import Data.Array.Accelerate.Type
import Data.Array.Accelerate.Classes.Num
import Prelude ( (.) )
import qualified Prelude as P
type Fractional a = (Num a, P.Fractional (Exp a))
instance P.Fractional (Exp Half) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . P.fromRational
instance P.Fractional (Exp Float) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . P.fromRational
instance P.Fractional (Exp Double) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . P.fromRational
instance P.Fractional (Exp CFloat) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . P.fromRational
instance P.Fractional (Exp CDouble) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . P.fromRational