module Data.Array.Parallel.Prelude.Bool (
Bool(..),
otherwise, (&&), (||), not, andP, orP,
and_l, or_l, not_l
) where
import Data.Array.Parallel.VectDepend ()
import Data.Array.Parallel.PArr ()
import Data.Array.Parallel.Lifted.Closure
import Data.Array.Parallel.PArray.PReprInstances
import Data.Array.Parallel.Lifted.Scalar
import qualified Data.Array.Parallel.Unlifted as U
import qualified Prelude as P
import Prelude (Bool(..), otherwise)
import Data.Bits
infixr 3 &&
infixr 2 ||
(&&) :: Bool -> Bool -> Bool
(&&) = (P.&&)
and_l :: PArray Bool -> PArray Bool -> PArray Bool
and_l (PArray n# bs) (PArray _ cs)
= PArray n# P.$
case bs of { PBool sel1 ->
case cs of { PBool sel2 ->
PBool P.$ U.tagsToSel2 (U.zipWith (.&.) (U.tagsSel2 sel1) (U.tagsSel2 sel2)) }}
(||) :: Bool -> Bool -> Bool
(||) = (P.||)
or_l :: PArray Bool -> PArray Bool -> PArray Bool
or_l (PArray n# bs) (PArray _ cs)
= PArray n# P.$
case bs of { PBool sel1 ->
case cs of { PBool sel2 ->
PBool P.$ U.tagsToSel2 (U.zipWith (.|.) (U.tagsSel2 sel1) (U.tagsSel2 sel2)) }}
not :: Bool -> Bool
not = P.not
not_l :: PArray Bool -> PArray Bool
not_l (PArray n# bs)
= PArray n# P.$
case bs of { PBool sel ->
PBool P.$ U.tagsToSel2 (U.map complement (U.tagsSel2 sel)) }
andP:: [:Bool:] -> Bool
andP _ = True
orP:: [:Bool:] -> Bool
orP _ = True