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 |
Semigroup instances for Accelerate
Since: 1.2.0.0
Documentation
The class of semigroups (types with an associative binary operation).
Instances should satisfy the following:
Since: base-4.9.0.0
(<>) :: a -> a -> a infixr 6 #
An associative operation.
>>>
[1,2,3] <> [4,5,6]
[1,2,3,4,5,6]
Reduce a non-empty list with <>
The default definition should be sufficient, but this can be overridden for efficiency.
>>>
import Data.List.NonEmpty
>>>
sconcat $ "Hello" :| [" ", "Haskell", "!"]
"Hello Haskell!"
stimes :: Integral b => b -> a -> a #
Repeat a value n
times.
Given that this works on a Semigroup
it is allowed to fail if
you request 0 or fewer repetitions, and the default definition
will do so.
By making this a member of the class, idempotent semigroups
and monoids can upgrade this to execute in \(\mathcal{O}(1)\) by
picking stimes =
or stimesIdempotent
stimes =
respectively.stimesIdempotentMonoid
>>>
stimes 4 [1]
[1,1,1,1]
Instances
Instances
Monad Min | Since: base-4.9.0.0 |
Functor Min | Since: base-4.9.0.0 |
MonadFix Min | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
Applicative Min | Since: base-4.9.0.0 |
Foldable Min | Since: base-4.9.0.0 |
Defined in Data.Semigroup fold :: Monoid m => Min m -> m # foldMap :: Monoid m => (a -> m) -> Min a -> m # foldMap' :: Monoid m => (a -> m) -> Min a -> m # foldr :: (a -> b -> b) -> b -> Min a -> b # foldr' :: (a -> b -> b) -> b -> Min a -> b # foldl :: (b -> a -> b) -> b -> Min a -> b # foldl' :: (b -> a -> b) -> b -> Min a -> b # foldr1 :: (a -> a -> a) -> Min a -> a # foldl1 :: (a -> a -> a) -> Min a -> a # elem :: Eq a => a -> Min a -> Bool # maximum :: Ord a => Min a -> a # | |
Traversable Min | Since: base-4.9.0.0 |
NFData1 Min | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Traversable1 Min | |
Functor Min Source # | |
Unbox a => Vector Vector (Min a) | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (Min a) -> m (Vector (Min a)) # basicUnsafeThaw :: PrimMonad m => Vector (Min a) -> m (Mutable Vector (PrimState m) (Min a)) # basicLength :: Vector (Min a) -> Int # basicUnsafeSlice :: Int -> Int -> Vector (Min a) -> Vector (Min a) # basicUnsafeIndexM :: Monad m => Vector (Min a) -> Int -> m (Min a) # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (Min a) -> Vector (Min a) -> m () # | |
Unbox a => MVector MVector (Min a) | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s (Min a) -> Int # basicUnsafeSlice :: Int -> Int -> MVector s (Min a) -> MVector s (Min a) # basicOverlaps :: MVector s (Min a) -> MVector s (Min a) -> Bool # basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (Min a)) # basicInitialize :: PrimMonad m => MVector (PrimState m) (Min a) -> m () # basicUnsafeReplicate :: PrimMonad m => Int -> Min a -> m (MVector (PrimState m) (Min a)) # basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (Min a) -> Int -> m (Min a) # basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (Min a) -> Int -> Min a -> m () # basicClear :: PrimMonad m => MVector (PrimState m) (Min a) -> m () # basicSet :: PrimMonad m => MVector (PrimState m) (Min a) -> Min a -> m () # basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (Min a) -> MVector (PrimState m) (Min a) -> m () # basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (Min a) -> MVector (PrimState m) (Min a) -> m () # basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (Min a) -> Int -> m (MVector (PrimState m) (Min a)) # | |
Elt a => Unlift Exp (Min (Exp a)) Source # | |
(Lift Exp a, Elt (Plain a)) => Lift Exp (Min a) Source # | |
Bounded a => Bounded (Min a) | Since: base-4.9.0.0 |
Bounded a => Bounded (Exp (Min a)) Source # | |
Enum a => Enum (Min a) | Since: base-4.9.0.0 |
Eq a => Eq (Min a) | Since: base-4.9.0.0 |
Data a => Data (Min a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Min a -> c (Min a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Min a) # dataTypeOf :: Min a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Min a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Min a)) # gmapT :: (forall b. Data b => b -> b) -> Min a -> Min a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Min a -> r # gmapQ :: (forall d. Data d => d -> u) -> Min a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Min a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Min a -> m (Min a) # | |
Num a => Num (Min a) | Since: base-4.9.0.0 |
Num a => Num (Exp (Min a)) Source # | |
Defined in Data.Array.Accelerate.Data.Semigroup (+) :: Exp (Min a) -> Exp (Min a) -> Exp (Min a) # (-) :: Exp (Min a) -> Exp (Min a) -> Exp (Min a) # (*) :: Exp (Min a) -> Exp (Min a) -> Exp (Min a) # negate :: Exp (Min a) -> Exp (Min a) # abs :: Exp (Min a) -> Exp (Min a) # signum :: Exp (Min a) -> Exp (Min a) # fromInteger :: Integer -> Exp (Min a) # | |
Ord a => Ord (Min a) | Since: base-4.9.0.0 |
Read a => Read (Min a) | Since: base-4.9.0.0 |
Show a => Show (Min a) | Since: base-4.9.0.0 |
Generic (Min a) | Since: base-4.9.0.0 |
Ord a => Semigroup (Min a) | Since: base-4.9.0.0 |
Ord a => Semigroup (Exp (Min a)) Source # | |
(Ord a, Bounded a) => Monoid (Min a) | Since: base-4.9.0.0 |
(Ord a, Bounded a) => Monoid (Exp (Min a)) Source # | |
NFData a => NFData (Min a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
Hashable a => Hashable (Min a) | |
Defined in Data.Hashable.Class | |
Prim a => Prim (Min a) | Since: primitive-0.6.5.0 |
Defined in Data.Primitive.Types alignment# :: Min a -> Int# # indexByteArray# :: ByteArray# -> Int# -> Min a # readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Min a #) # writeByteArray# :: MutableByteArray# s -> Int# -> Min a -> State# s -> State# s # setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Min a -> State# s -> State# s # indexOffAddr# :: Addr# -> Int# -> Min a # readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Min a #) # writeOffAddr# :: Addr# -> Int# -> Min a -> State# s -> State# s # setOffAddr# :: Addr# -> Int# -> Int# -> Min a -> State# s -> State# s # | |
Unbox a => Unbox (Min a) | |
Defined in Data.Vector.Unboxed.Base | |
Wrapped (Min a) | |
Elt a => Elt (Min a) Source # | |
Eq a => Eq (Min a) Source # | |
Ord a => Ord (Min a) Source # | |
Defined in Data.Array.Accelerate.Data.Semigroup (<) :: Exp (Min a) -> Exp (Min a) -> Exp Bool Source # (>) :: Exp (Min a) -> Exp (Min a) -> Exp Bool Source # (<=) :: Exp (Min a) -> Exp (Min a) -> Exp Bool Source # (>=) :: Exp (Min a) -> Exp (Min a) -> Exp Bool Source # min :: Exp (Min a) -> Exp (Min a) -> Exp (Min a) Source # max :: Exp (Min a) -> Exp (Min a) -> Exp (Min a) Source # compare :: Exp (Min a) -> Exp (Min a) -> Exp Ordering Source # | |
Generic1 Min | Since: base-4.9.0.0 |
t ~ Min b => Rewrapped (Min a) t | |
Defined in Control.Lens.Wrapped | |
newtype MVector s (Min a) | |
Defined in Data.Vector.Unboxed.Base | |
type Rep (Min a) | |
Defined in Data.Semigroup | |
newtype Vector (Min a) | |
Defined in Data.Vector.Unboxed.Base | |
type Unwrapped (Min a) | |
Defined in Control.Lens.Wrapped | |
type Plain (Min a) Source # | |
Defined in Data.Array.Accelerate.Data.Semigroup | |
type Rep1 Min | |
Defined in Data.Semigroup |
Instances
Monad Max | Since: base-4.9.0.0 |
Functor Max | Since: base-4.9.0.0 |
MonadFix Max | Since: base-4.9.0.0 |
Defined in Data.Semigroup | |
Applicative Max | Since: base-4.9.0.0 |
Foldable Max | Since: base-4.9.0.0 |
Defined in Data.Semigroup fold :: Monoid m => Max m -> m # foldMap :: Monoid m => (a -> m) -> Max a -> m # foldMap' :: Monoid m => (a -> m) -> Max a -> m # foldr :: (a -> b -> b) -> b -> Max a -> b # foldr' :: (a -> b -> b) -> b -> Max a -> b # foldl :: (b -> a -> b) -> b -> Max a -> b # foldl' :: (b -> a -> b) -> b -> Max a -> b # foldr1 :: (a -> a -> a) -> Max a -> a # foldl1 :: (a -> a -> a) -> Max a -> a # elem :: Eq a => a -> Max a -> Bool # maximum :: Ord a => Max a -> a # | |
Traversable Max | Since: base-4.9.0.0 |
NFData1 Max | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
Traversable1 Max | |
Functor Max Source # | |
Unbox a => Vector Vector (Max a) | |
Defined in Data.Vector.Unboxed.Base basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (Max a) -> m (Vector (Max a)) # basicUnsafeThaw :: PrimMonad m => Vector (Max a) -> m (Mutable Vector (PrimState m) (Max a)) # basicLength :: Vector (Max a) -> Int # basicUnsafeSlice :: Int -> Int -> Vector (Max a) -> Vector (Max a) # basicUnsafeIndexM :: Monad m => Vector (Max a) -> Int -> m (Max a) # basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (Max a) -> Vector (Max a) -> m () # | |
Unbox a => MVector MVector (Max a) | |
Defined in Data.Vector.Unboxed.Base basicLength :: MVector s (Max a) -> Int # basicUnsafeSlice :: Int -> Int -> MVector s (Max a) -> MVector s (Max a) # basicOverlaps :: MVector s (Max a) -> MVector s (Max a) -> Bool # basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (Max a)) # basicInitialize :: PrimMonad m => MVector (PrimState m) (Max a) -> m () # basicUnsafeReplicate :: PrimMonad m => Int -> Max a -> m (MVector (PrimState m) (Max a)) # basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (Max a) -> Int -> m (Max a) # basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (Max a) -> Int -> Max a -> m () # basicClear :: PrimMonad m => MVector (PrimState m) (Max a) -> m () # basicSet :: PrimMonad m => MVector (PrimState m) (Max a) -> Max a -> m () # basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (Max a) -> MVector (PrimState m) (Max a) -> m () # basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (Max a) -> MVector (PrimState m) (Max a) -> m () # basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (Max a) -> Int -> m (MVector (PrimState m) (Max a)) # | |
Elt a => Unlift Exp (Max (Exp a)) Source # | |
(Lift Exp a, Elt (Plain a)) => Lift Exp (Max a) Source # | |
Bounded a => Bounded (Max a) | Since: base-4.9.0.0 |
Bounded a => Bounded (Exp (Max a)) Source # | |
Enum a => Enum (Max a) | Since: base-4.9.0.0 |
Eq a => Eq (Max a) | Since: base-4.9.0.0 |
Data a => Data (Max a) | Since: base-4.9.0.0 |
Defined in Data.Semigroup gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Max a -> c (Max a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Max a) # dataTypeOf :: Max a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Max a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Max a)) # gmapT :: (forall b. Data b => b -> b) -> Max a -> Max a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Max a -> r # gmapQ :: (forall d. Data d => d -> u) -> Max a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Max a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Max a -> m (Max a) # | |
Num a => Num (Max a) | Since: base-4.9.0.0 |
Num a => Num (Exp (Max a)) Source # | |
Defined in Data.Array.Accelerate.Data.Semigroup (+) :: Exp (Max a) -> Exp (Max a) -> Exp (Max a) # (-) :: Exp (Max a) -> Exp (Max a) -> Exp (Max a) # (*) :: Exp (Max a) -> Exp (Max a) -> Exp (Max a) # negate :: Exp (Max a) -> Exp (Max a) # abs :: Exp (Max a) -> Exp (Max a) # signum :: Exp (Max a) -> Exp (Max a) # fromInteger :: Integer -> Exp (Max a) # | |
Ord a => Ord (Max a) | Since: base-4.9.0.0 |
Read a => Read (Max a) | Since: base-4.9.0.0 |
Show a => Show (Max a) | Since: base-4.9.0.0 |
Generic (Max a) | Since: base-4.9.0.0 |
Ord a => Semigroup (Max a) | Since: base-4.9.0.0 |
Ord a => Semigroup (Exp (Max a)) Source # | |
(Ord a, Bounded a) => Monoid (Max a) | Since: base-4.9.0.0 |
(Ord a, Bounded a) => Monoid (Exp (Max a)) Source # | |
NFData a => NFData (Max a) | Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
Hashable a => Hashable (Max a) | |
Defined in Data.Hashable.Class | |
Prim a => Prim (Max a) | Since: primitive-0.6.5.0 |
Defined in Data.Primitive.Types alignment# :: Max a -> Int# # indexByteArray# :: ByteArray# -> Int# -> Max a # readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, Max a #) # writeByteArray# :: MutableByteArray# s -> Int# -> Max a -> State# s -> State# s # setByteArray# :: MutableByteArray# s -> Int# -> Int# -> Max a -> State# s -> State# s # indexOffAddr# :: Addr# -> Int# -> Max a # readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, Max a #) # writeOffAddr# :: Addr# -> Int# -> Max a -> State# s -> State# s # setOffAddr# :: Addr# -> Int# -> Int# -> Max a -> State# s -> State# s # | |
Unbox a => Unbox (Max a) | |
Defined in Data.Vector.Unboxed.Base | |
Wrapped (Max a) | |
Elt a => Elt (Max a) Source # | |
Eq a => Eq (Max a) Source # | |
Ord a => Ord (Max a) Source # | |
Defined in Data.Array.Accelerate.Data.Semigroup (<) :: Exp (Max a) -> Exp (Max a) -> Exp Bool Source # (>) :: Exp (Max a) -> Exp (Max a) -> Exp Bool Source # (<=) :: Exp (Max a) -> Exp (Max a) -> Exp Bool Source # (>=) :: Exp (Max a) -> Exp (Max a) -> Exp Bool Source # min :: Exp (Max a) -> Exp (Max a) -> Exp (Max a) Source # max :: Exp (Max a) -> Exp (Max a) -> Exp (Max a) Source # compare :: Exp (Max a) -> Exp (Max a) -> Exp Ordering Source # | |
Generic1 Max | Since: base-4.9.0.0 |
t ~ Max b => Rewrapped (Max a) t | |
Defined in Control.Lens.Wrapped | |
newtype MVector s (Max a) | |
Defined in Data.Vector.Unboxed.Base | |
type Rep (Max a) | |
Defined in Data.Semigroup | |
newtype Vector (Max a) | |
Defined in Data.Vector.Unboxed.Base | |
type Unwrapped (Max a) | |
Defined in Control.Lens.Wrapped | |
type Plain (Max a) Source # | |
Defined in Data.Array.Accelerate.Data.Semigroup | |
type Rep1 Max | |
Defined in Data.Semigroup |