accelerate-1.3.0.0: An embedded language for accelerated array processing
Copyright[2018..2020] The Accelerate Team
LicenseBSD3
MaintainerTrevor L. McDonell <trevor.mcdonell@gmail.com>
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Data.Array.Accelerate.Data.Functor

Description

A functor performs a uniform action over a parameterised type

This is essentially the same as the standard Haskell Functor class, lifted to Accelerate Exp terms.

Since: 1.2.0.0

Synopsis

Documentation

class Functor f where Source #

The Functor class is used for scalar types which can be mapped over. Instances of Functor should satisfy the following laws:

fmap id      == id
fmap (f . g) == fmap f . fmap g

Minimal complete definition

fmap

Methods

fmap :: (Elt a, Elt b, Elt (f a), Elt (f b)) => (Exp a -> Exp b) -> Exp (f a) -> Exp (f b) Source #

(<$) :: (Elt a, Elt b, Elt (f a), Elt (f b)) => Exp a -> Exp (f b) -> Exp (f a) infixl 4 Source #

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

Instances

Instances details
Functor Maybe Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Maybe

Methods

fmap :: (Elt a, Elt b, Elt (Maybe a), Elt (Maybe b)) => (Exp a -> Exp b) -> Exp (Maybe a) -> Exp (Maybe b) Source #

(<$) :: (Elt a, Elt b, Elt (Maybe a), Elt (Maybe b)) => Exp a -> Exp (Maybe b) -> Exp (Maybe a) Source #

Functor Complex Source #

Since: 1.2.0.0

Instance details

Defined in Data.Array.Accelerate.Data.Complex

Methods

fmap :: (Elt a, Elt b, Elt (Complex a), Elt (Complex b)) => (Exp a -> Exp b) -> Exp (Complex a) -> Exp (Complex b) Source #

(<$) :: (Elt a, Elt b, Elt (Complex a), Elt (Complex b)) => Exp a -> Exp (Complex b) -> Exp (Complex a) Source #

Functor Min Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Functor

Methods

fmap :: (Elt a, Elt b, Elt (Min a), Elt (Min b)) => (Exp a -> Exp b) -> Exp (Min a) -> Exp (Min b) Source #

(<$) :: (Elt a, Elt b, Elt (Min a), Elt (Min b)) => Exp a -> Exp (Min b) -> Exp (Min a) Source #

Functor Max Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Functor

Methods

fmap :: (Elt a, Elt b, Elt (Max a), Elt (Max b)) => (Exp a -> Exp b) -> Exp (Max a) -> Exp (Max b) Source #

(<$) :: (Elt a, Elt b, Elt (Max a), Elt (Max b)) => Exp a -> Exp (Max b) -> Exp (Max a) Source #

Functor Sum Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Functor

Methods

fmap :: (Elt a, Elt b, Elt (Sum a), Elt (Sum b)) => (Exp a -> Exp b) -> Exp (Sum a) -> Exp (Sum b) Source #

(<$) :: (Elt a, Elt b, Elt (Sum a), Elt (Sum b)) => Exp a -> Exp (Sum b) -> Exp (Sum a) Source #

Functor Product Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Functor

Methods

fmap :: (Elt a, Elt b, Elt (Product a), Elt (Product b)) => (Exp a -> Exp b) -> Exp (Product a) -> Exp (Product b) Source #

(<$) :: (Elt a, Elt b, Elt (Product a), Elt (Product b)) => Exp a -> Exp (Product b) -> Exp (Product a) Source #

Elt a => Functor (Either a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Either

Methods

fmap :: (Elt a0, Elt b, Elt (Either a a0), Elt (Either a b)) => (Exp a0 -> Exp b) -> Exp (Either a a0) -> Exp (Either a b) Source #

(<$) :: (Elt a0, Elt b, Elt (Either a a0), Elt (Either a b)) => Exp a0 -> Exp (Either a b) -> Exp (Either a a0) Source #

(<$>) :: (Functor f, Elt a, Elt b, Elt (f a), Elt (f b)) => (Exp a -> Exp b) -> Exp (f a) -> Exp (f b) infixl 4 Source #

An infix synonym for fmap

The name of this operator is an allusion to $. Note the similarities between their types:

 ($)  ::              (Exp a -> Exp b) -> Exp a     -> Exp b
(<$>) :: Functor f => (Exp a -> Exp b) -> Exp (f a) -> Exp (f b)

Whereas $ is function application, <$> is function application lifted over a Functor.

($>) :: (Functor f, Elt a, Elt b, Elt (f a), Elt (f b)) => Exp (f a) -> Exp b -> Exp (f b) infixl 4 Source #

A flipped version of (<$).

void :: (Functor f, Elt a, Elt (f a), Elt (f ())) => Exp (f a) -> Exp (f ()) Source #

void value discards or ignores the result of evaluation.