{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
#if __GLASGOW_HASKELL__ >= 800
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
#endif
module Data.Massiv.Core
( Array(List, unList)
, Elt
, EltRepr
, Construct
, Source
, Load(..)
, Size
, Slice
, OuterSlice(outerLength)
, InnerSlice
, Manifest
, Mutable
, Ragged(..)
, Nested(..)
, NestedStruct
, L(..)
, LN
, ListItem
#if __GLASGOW_HASKELL__ >= 800
, Comp(Seq, Par, ParOn)
, pattern Par
#else
, Comp(..)
, pattern Par
#endif
, module Data.Massiv.Core.Index
, elemsCount
, isEmpty
) where
import Data.Massiv.Core.Common hiding (indexWith, unsafeGenerateM)
import Data.Massiv.Core.List
import Data.Massiv.Core.Index
elemsCount :: Size r ix e => Array r ix e -> Int
elemsCount = totalElem . size
{-# INLINE elemsCount #-}
isEmpty :: Size r ix e => Array r ix e -> Bool
isEmpty !arr = 0 == elemsCount arr
{-# INLINE isEmpty #-}