-- |
-- Module      : Data.Massiv.Core
-- Copyright   : (c) Alexey Kuleshevich 2018-2022
-- License     : BSD3
-- Maintainer  : Alexey Kuleshevich <lehins@yandex.ru>
-- Stability   : experimental
-- Portability : non-portable
module Data.Massiv.Core (
  Array (LArray),
  List (..),
  Vector,
  MVector,
  Matrix,
  MMatrix,
  Load (iterArrayLinearST_, iterArrayLinearWithSetST_),
  Stream (..),
  Source,
  PrefIndex (..),
  Size,
  Shape (..),
  LengthHint (..),
  StrideLoad (..),
  Manifest,
  Mutable,
  Ragged,
  L (..),
  ListItem,
  Scheduler,
  SchedulerWS,
  Strategy,
  Comp (Seq, Par, Par', ParOn, ParN),
  getComp,
  setComp,
  appComp,
  WorkerStates,
  initWorkerStates,
  scheduleWork,
  scheduleWork_,
  module Data.Massiv.Core.Index,

  -- * Numeric
  FoldNumeric,
  Numeric,
  NumericFloat,

  -- * Exceptions
  MonadThrow (..),
  IndexException (..),
  SizeException (..),
  ShapeException (..),
  module Data.Massiv.Core.Exception,

  -- * Stateful Monads
  MonadUnliftIO,
  MonadIO (liftIO),
  PrimMonad (PrimState),
) where

import Control.Scheduler (SchedulerWS, initWorkerStates)
import Data.Massiv.Core.Common
import Data.Massiv.Core.Exception
import Data.Massiv.Core.Index
import Data.Massiv.Core.List
import Data.Massiv.Core.Operations (FoldNumeric, Numeric, NumericFloat)

-- | Append computation strategy using `Comp`'s `Monoid` instance.
--
-- @since 0.6.0
appComp :: Strategy r => Comp -> Array r ix e -> Array r ix e
appComp :: forall r ix e. Strategy r => Comp -> Array r ix e -> Array r ix e
appComp Comp
comp Array r ix e
arr = forall r ix e. Strategy r => Comp -> Array r ix e -> Array r ix e
setComp (Comp
comp forall a. Semigroup a => a -> a -> a
<> forall r ix e. Strategy r => Array r ix e -> Comp
getComp Array r ix e
arr) Array r ix e
arr
{-# INLINEABLE appComp #-}