packages feed

tilia-0.2.0.0: corpora/vendored/cpp/configuration/pragma-question-implied-by-a-chain-out.hs

{-# LANGUAGE CPP #-}
#if defined(BITS_AS_NATURAL) || defined(BITS_AS_WORD)
{-# LANGUAGE MagicHash #-}
#endif

module Data.Bits.Packed
  ( Bits,
    emptyBits,
    isEmpty,
  )
where

#if defined(BITS_AS_NATURAL)
import GHC.Num.Natural (Natural (..))
#elif defined(BITS_AS_WORD)
import GHC.Exts (Word (W#))
#endif

#if defined(BITS_AS_NATURAL)
type Bits = Natural

emptyBits :: Bits
emptyBits = NS 0##
#elif defined(BITS_AS_INTEGER)
type Bits = Integer

emptyBits :: Bits
emptyBits = 0
#elif defined(BITS_AS_WORD)
type Bits = Word

emptyBits :: Bits
emptyBits = W# 0##
#endif

isEmpty :: Bits -> Bool
isEmpty = (== emptyBits)