{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# 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 ( (.), fromRational )
import qualified Prelude as P
type Fractional a = (Num a, P.Fractional (Exp a))
instance P.Fractional (Exp Float) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . fromRational
instance P.Fractional (Exp Double) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . fromRational
instance P.Fractional (Exp CFloat) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . fromRational
instance P.Fractional (Exp CDouble) where
(/) = mkFDiv
recip = mkRecip
fromRational = constant . fromRational