Copyright | [2018..2020] The Accelerate Team |
---|---|
License | BSD3 |
Maintainer | Trevor L. McDonell <trevor.mcdonell@gmail.com> |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
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
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.
(<$>) :: (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
.