    {-# LANGUAGE CPP #-}
    {-# LANGUAGE DeriveGeneric #-}

    -----------------------------------------------------------------------------
    -- |
    -- Module      :  GHC.ByteOrder
    -- Copyright   :  (c) The University of Glasgow, 1994-2000
    -- License     :  see libraries/base/LICENSE
    --
    -- Maintainer  :  cvs-ghc@haskell.org
    -- Stability   :  internal
    -- Portability :  non-portable (GHC extensions)
    --
    -- Target byte ordering.
    --
    -- @since 4.11.0.0
    -----------------------------------------------------------------------------

    module GHC.ByteOrder where

    -- Required for WORDS_BIGENDIAN
    #include <ghcautoconf.h>

    import GHC.Generics (Generic)

    -- | Byte ordering.
    data ByteOrder
        = BigEndian    -- ^ most-significant-byte occurs in lowest address.
        | LittleEndian -- ^ least-significant-byte occurs in lowest address.
        deriving ( ByteOrder -> ByteOrder -> Bool
    (ByteOrder -> ByteOrder -> Bool)
    -> (ByteOrder -> ByteOrder -> Bool) -> Eq ByteOrder
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ByteOrder -> ByteOrder -> Bool
    == :: ByteOrder -> ByteOrder -> Bool
    $c/= :: ByteOrder -> ByteOrder -> Bool
    /= :: ByteOrder -> ByteOrder -> Bool
    Eq      -- ^ @since 4.11.0.0
                 , Eq ByteOrder
    Eq ByteOrder =>
    (ByteOrder -> ByteOrder -> Ordering)
    -> (ByteOrder -> ByteOrder -> Bool)
    -> (ByteOrder -> ByteOrder -> Bool)
    -> (ByteOrder -> ByteOrder -> Bool)
    -> (ByteOrder -> ByteOrder -> Bool)
    -> (ByteOrder -> ByteOrder -> ByteOrder)
    -> (ByteOrder -> ByteOrder -> ByteOrder)
    -> Ord ByteOrder
    ByteOrder -> ByteOrder -> Bool
    ByteOrder -> ByteOrder -> Ordering
    ByteOrder -> ByteOrder -> ByteOrder
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ByteOrder -> ByteOrder -> Ordering
    compare :: ByteOrder -> ByteOrder -> Ordering
    $c< :: ByteOrder -> ByteOrder -> Bool
    < :: ByteOrder -> ByteOrder -> Bool
    $c<= :: ByteOrder -> ByteOrder -> Bool
    <= :: ByteOrder -> ByteOrder -> Bool
    $c> :: ByteOrder -> ByteOrder -> Bool
    > :: ByteOrder -> ByteOrder -> Bool
    $c>= :: ByteOrder -> ByteOrder -> Bool
    >= :: ByteOrder -> ByteOrder -> Bool
    $cmax :: ByteOrder -> ByteOrder -> ByteOrder
    max :: ByteOrder -> ByteOrder -> ByteOrder
    $cmin :: ByteOrder -> ByteOrder -> ByteOrder
    min :: ByteOrder -> ByteOrder -> ByteOrder
    Ord     -- ^ @since 4.11.0.0
                 , ByteOrder
    ByteOrder -> ByteOrder -> Bounded ByteOrder
    forall a. a -> a -> Bounded a
    $cminBound :: ByteOrder
    minBound :: ByteOrder
    $cmaxBound :: ByteOrder
    maxBound :: ByteOrder
    Bounded -- ^ @since 4.11.0.0
                 , Int -> ByteOrder
    ByteOrder -> Int
    ByteOrder -> [ByteOrder]
    ByteOrder -> ByteOrder
    ByteOrder -> ByteOrder -> [ByteOrder]
    ByteOrder -> ByteOrder -> ByteOrder -> [ByteOrder]
    (ByteOrder -> ByteOrder)
    -> (ByteOrder -> ByteOrder)
    -> (Int -> ByteOrder)
    -> (ByteOrder -> Int)
    -> (ByteOrder -> [ByteOrder])
    -> (ByteOrder -> ByteOrder -> [ByteOrder])
    -> (ByteOrder -> ByteOrder -> [ByteOrder])
    -> (ByteOrder -> ByteOrder -> ByteOrder -> [ByteOrder])
    -> Enum ByteOrder
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: ByteOrder -> ByteOrder
    succ :: ByteOrder -> ByteOrder
    $cpred :: ByteOrder -> ByteOrder
    pred :: ByteOrder -> ByteOrder
    $ctoEnum :: Int -> ByteOrder
    toEnum :: Int -> ByteOrder
    $cfromEnum :: ByteOrder -> Int
    fromEnum :: ByteOrder -> Int
    $cenumFrom :: ByteOrder -> [ByteOrder]
    enumFrom :: ByteOrder -> [ByteOrder]
    $cenumFromThen :: ByteOrder -> ByteOrder -> [ByteOrder]
    enumFromThen :: ByteOrder -> ByteOrder -> [ByteOrder]
    $cenumFromTo :: ByteOrder -> ByteOrder -> [ByteOrder]
    enumFromTo :: ByteOrder -> ByteOrder -> [ByteOrder]
    $cenumFromThenTo :: ByteOrder -> ByteOrder -> ByteOrder -> [ByteOrder]
    enumFromThenTo :: ByteOrder -> ByteOrder -> ByteOrder -> [ByteOrder]
    Enum    -- ^ @since 4.11.0.0
                 , ReadPrec [ByteOrder]
    ReadPrec ByteOrder
    Int -> ReadS ByteOrder
    ReadS [ByteOrder]
    (Int -> ReadS ByteOrder)
    -> ReadS [ByteOrder]
    -> ReadPrec ByteOrder
    -> ReadPrec [ByteOrder]
    -> Read ByteOrder
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS ByteOrder
    readsPrec :: Int -> ReadS ByteOrder
    $creadList :: ReadS [ByteOrder]
    readList :: ReadS [ByteOrder]
    $creadPrec :: ReadPrec ByteOrder
    readPrec :: ReadPrec ByteOrder
    $creadListPrec :: ReadPrec [ByteOrder]
    readListPrec :: ReadPrec [ByteOrder]
    Read    -- ^ @since 4.11.0.0
                 , Int -> ByteOrder -> ShowS
    [ByteOrder] -> ShowS
    ByteOrder -> String
    (Int -> ByteOrder -> ShowS)
    -> (ByteOrder -> String)
    -> ([ByteOrder] -> ShowS)
    -> Show ByteOrder
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ByteOrder -> ShowS
    showsPrec :: Int -> ByteOrder -> ShowS
    $cshow :: ByteOrder -> String
    show :: ByteOrder -> String
    $cshowList :: [ByteOrder] -> ShowS
    showList :: [ByteOrder] -> ShowS
    Show    -- ^ @since 4.11.0.0
                 , (forall x. ByteOrder -> Rep ByteOrder x)
    -> (forall x. Rep ByteOrder x -> ByteOrder) -> Generic ByteOrder
    forall x. Rep ByteOrder x -> ByteOrder
    forall x. ByteOrder -> Rep ByteOrder x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. ByteOrder -> Rep ByteOrder x
    from :: forall x. ByteOrder -> Rep ByteOrder x
    $cto :: forall x. Rep ByteOrder x -> ByteOrder
    to :: forall x. Rep ByteOrder x -> ByteOrder
    Generic -- ^ @since 4.15.0.0
                 )

    -- | The byte ordering of the target machine.
    targetByteOrder :: ByteOrder
    #if defined(WORDS_BIGENDIAN)
    targetByteOrder = BigEndian
    #else
    targetByteOrder :: ByteOrder
    targetByteOrder = ByteOrder
    LittleEndian
    #endif