    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE MultiParamTypeClasses #-}
    {-# LANGUAGE OverloadedStrings #-}
    {-# LANGUAGE PatternSynonyms #-}
    module SDL.Power
      ( -- * Power Status
        getPowerInfo
      , PowerState(..)
      , BatteryState(..)
      , Charge(..)
      ) where

    import Control.Applicative
    import Control.Monad.IO.Class (MonadIO, liftIO)
    import Data.Data (Data)
    import Data.Typeable
    import Foreign.C.Types
    import Foreign.Marshal.Alloc
    import Foreign.Marshal.Utils
    import Foreign.Storable
    import GHC.Generics (Generic)

    import qualified SDL.Raw as Raw

    -- | Current power supply details.
    --
    -- Throws 'SDLException' if the current power state can not be determined.
    --
    -- See @<https://wiki.libsdl.org/SDL2/SDL_GetPowerInfo SDL_GetPowerInfo>@ for C documentation.
    getPowerInfo :: (Functor m, MonadIO m) => m PowerState
    getPowerInfo :: forall (m :: Type -> Type). (Functor m, MonadIO m) => m PowerState
    getPowerInfo =
      IO PowerState -> m PowerState
    forall a. IO a -> m a
    forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
    liftIO (IO PowerState -> m PowerState) -> IO PowerState -> m PowerState
    forall a b. (a -> b) -> a -> b
    $
      (Ptr CInt -> IO PowerState) -> IO PowerState
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO PowerState) -> IO PowerState)
    -> (Ptr CInt -> IO PowerState) -> IO PowerState
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    secsPtr ->
      (Ptr CInt -> IO PowerState) -> IO PowerState
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO PowerState) -> IO PowerState)
    -> (Ptr CInt -> IO PowerState) -> IO PowerState
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    pctPtr -> do
        state <- Ptr CInt -> Ptr CInt -> IO PowerState
    forall (m :: Type -> Type).
    MonadIO m =>
    Ptr CInt -> Ptr CInt -> m PowerState
    Raw.getPowerInfo Ptr CInt
    secsPtr Ptr CInt
    pctPtr
        let peekCharge = (Maybe CInt -> Maybe CInt -> Charge)
    -> IO (Maybe CInt) -> IO (Maybe CInt) -> IO Charge
    forall a b c. (a -> b -> c) -> IO a -> IO b -> IO c
    forall (f :: Type -> Type) a b c.
    Applicative f =>
    (a -> b -> c) -> f a -> f b -> f c
    liftA2 Maybe CInt -> Maybe CInt -> Charge
    Charge ((Ptr CInt -> IO CInt) -> Ptr CInt -> IO (Maybe CInt)
    forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
    maybePeek Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    secsPtr) ((Ptr CInt -> IO CInt) -> Ptr CInt -> IO (Maybe CInt)
    forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
    maybePeek Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    pctPtr)
        case state of
         PowerState
    Raw.SDL_POWERSTATE_ON_BATTERY -> (Charge -> PowerState) -> IO Charge -> IO PowerState
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    fmap (BatteryState -> Charge -> PowerState
    Battery BatteryState
    Draining) IO Charge
    peekCharge
         PowerState
    Raw.SDL_POWERSTATE_CHARGING -> (Charge -> PowerState) -> IO Charge -> IO PowerState
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    fmap (BatteryState -> Charge -> PowerState
    Battery BatteryState
    Charging) IO Charge
    peekCharge
         PowerState
    Raw.SDL_POWERSTATE_CHARGED -> (Charge -> PowerState) -> IO Charge -> IO PowerState
    forall a b. (a -> b) -> IO a -> IO b
    forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
    fmap (BatteryState -> Charge -> PowerState
    Battery BatteryState
    Charged) IO Charge
    peekCharge
         PowerState
    Raw.SDL_POWERSTATE_NO_BATTERY -> PowerState -> IO PowerState
    forall a. a -> IO a
    forall (f :: Type -> Type) a. Applicative f => a -> f a
    pure PowerState
    Mains
         PowerState
    _ -> PowerState -> IO PowerState
    forall a. a -> IO a
    forall (f :: Type -> Type) a. Applicative f => a -> f a
    pure PowerState
    UnknownPowerState

    -- | Information about the power supply for the user's environment
    data PowerState
      = Battery BatteryState Charge
        -- ^ The user is on a battery powered device. See 'BatteryState' for charge information, and 'Charge' for charge information
      | Mains
        -- ^ The user is on a device connected to the mains.
      | UnknownPowerState
        -- ^ SDL could not determine the power for the device.
      deriving (PowerState -> PowerState -> Bool
    (PowerState -> PowerState -> Bool)
    -> (PowerState -> PowerState -> Bool) -> Eq PowerState
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: PowerState -> PowerState -> Bool
    == :: PowerState -> PowerState -> Bool
    $c/= :: PowerState -> PowerState -> Bool
    /= :: PowerState -> PowerState -> Bool
    Eq, (forall x. PowerState -> Rep PowerState x)
    -> (forall x. Rep PowerState x -> PowerState) -> Generic PowerState
    forall x. Rep PowerState x -> PowerState
    forall x. PowerState -> Rep PowerState x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. PowerState -> Rep PowerState x
    from :: forall x. PowerState -> Rep PowerState x
    $cto :: forall x. Rep PowerState x -> PowerState
    to :: forall x. Rep PowerState x -> PowerState
    Generic, Eq PowerState
    Eq PowerState =>
    (PowerState -> PowerState -> Ordering)
    -> (PowerState -> PowerState -> Bool)
    -> (PowerState -> PowerState -> Bool)
    -> (PowerState -> PowerState -> Bool)
    -> (PowerState -> PowerState -> Bool)
    -> (PowerState -> PowerState -> PowerState)
    -> (PowerState -> PowerState -> PowerState)
    -> Ord PowerState
    PowerState -> PowerState -> Bool
    PowerState -> PowerState -> Ordering
    PowerState -> PowerState -> PowerState
    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 :: PowerState -> PowerState -> Ordering
    compare :: PowerState -> PowerState -> Ordering
    $c< :: PowerState -> PowerState -> Bool
    < :: PowerState -> PowerState -> Bool
    $c<= :: PowerState -> PowerState -> Bool
    <= :: PowerState -> PowerState -> Bool
    $c> :: PowerState -> PowerState -> Bool
    > :: PowerState -> PowerState -> Bool
    $c>= :: PowerState -> PowerState -> Bool
    >= :: PowerState -> PowerState -> Bool
    $cmax :: PowerState -> PowerState -> PowerState
    max :: PowerState -> PowerState -> PowerState
    $cmin :: PowerState -> PowerState -> PowerState
    min :: PowerState -> PowerState -> PowerState
    Ord, ReadPrec [PowerState]
    ReadPrec PowerState
    Int -> ReadS PowerState
    ReadS [PowerState]
    (Int -> ReadS PowerState)
    -> ReadS [PowerState]
    -> ReadPrec PowerState
    -> ReadPrec [PowerState]
    -> Read PowerState
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS PowerState
    readsPrec :: Int -> ReadS PowerState
    $creadList :: ReadS [PowerState]
    readList :: ReadS [PowerState]
    $creadPrec :: ReadPrec PowerState
    readPrec :: ReadPrec PowerState
    $creadListPrec :: ReadPrec [PowerState]
    readListPrec :: ReadPrec [PowerState]
    Read, Int -> PowerState -> ShowS
    [PowerState] -> ShowS
    PowerState -> String
    (Int -> PowerState -> ShowS)
    -> (PowerState -> String)
    -> ([PowerState] -> ShowS)
    -> Show PowerState
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> PowerState -> ShowS
    showsPrec :: Int -> PowerState -> ShowS
    $cshow :: PowerState -> String
    show :: PowerState -> String
    $cshowList :: [PowerState] -> ShowS
    showList :: [PowerState] -> ShowS
    Show, Typeable)

    -- | Information on battery consumption for battery powered devices
    data BatteryState
      = Draining
        -- ^ The battery is currently being drained.
      | Charged
        -- ^ The battery is fully charged.
      | Charging
        -- ^ The device is plugged in and the battery is charging.
      deriving (BatteryState
    BatteryState -> BatteryState -> Bounded BatteryState
    forall a. a -> a -> Bounded a
    $cminBound :: BatteryState
    minBound :: BatteryState
    $cmaxBound :: BatteryState
    maxBound :: BatteryState
    Bounded, Typeable BatteryState
    Typeable BatteryState =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> BatteryState -> c BatteryState)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c BatteryState)
    -> (BatteryState -> Constr)
    -> (BatteryState -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c BatteryState))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e))
        -> Maybe (c BatteryState))
    -> ((forall b. Data b => b -> b) -> BatteryState -> BatteryState)
    -> (forall r r'.
        (r -> r' -> r)
        -> r -> (forall d. Data d => d -> r') -> BatteryState -> r)
    -> (forall r r'.
        (r' -> r -> r)
        -> r -> (forall d. Data d => d -> r') -> BatteryState -> r)
    -> (forall u. (forall d. Data d => d -> u) -> BatteryState -> [u])
    -> (forall u.
        Int -> (forall d. Data d => d -> u) -> BatteryState -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState)
    -> Data BatteryState
    BatteryState -> Constr
    BatteryState -> DataType
    (forall b. Data b => b -> b) -> BatteryState -> BatteryState
    forall a.
    Typeable a =>
    (forall (c :: Type -> Type).
     (forall d b. Data d => c (d -> b) -> d -> c b)
     -> (forall g. g -> c g) -> a -> c a)
    -> (forall (c :: Type -> Type).
        (forall b r. Data b => c (b -> r) -> c r)
        -> (forall r. r -> c r) -> Constr -> c a)
    -> (a -> Constr)
    -> (a -> DataType)
    -> (forall (t :: Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d. Data d => c (t d)) -> Maybe (c a))
    -> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
        Typeable t =>
        (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
    -> ((forall b. Data b => b -> b) -> a -> a)
    -> (forall r r'.
        (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall r r'.
        (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
    -> (forall u. (forall d. Data d => d -> u) -> a -> [u])
    -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
    -> (forall (m :: Type -> Type).
        Monad m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> (forall (m :: Type -> Type).
        MonadPlus m =>
        (forall d. Data d => d -> m d) -> a -> m a)
    -> Data a
    forall u. Int -> (forall d. Data d => d -> u) -> BatteryState -> u
    forall u. (forall d. Data d => d -> u) -> BatteryState -> [u]
    forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> BatteryState -> r
    forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> BatteryState -> r
    forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BatteryState
    forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> BatteryState -> c BatteryState
    forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c BatteryState)
    forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c BatteryState)
    $cgfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> BatteryState -> c BatteryState
    gfoldl :: forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> BatteryState -> c BatteryState
    $cgunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BatteryState
    gunfold :: forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c BatteryState
    $ctoConstr :: BatteryState -> Constr
    toConstr :: BatteryState -> Constr
    $cdataTypeOf :: BatteryState -> DataType
    dataTypeOf :: BatteryState -> DataType
    $cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c BatteryState)
    dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c BatteryState)
    $cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c BatteryState)
    dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c BatteryState)
    $cgmapT :: (forall b. Data b => b -> b) -> BatteryState -> BatteryState
    gmapT :: (forall b. Data b => b -> b) -> BatteryState -> BatteryState
    $cgmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> BatteryState -> r
    gmapQl :: forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> BatteryState -> r
    $cgmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> BatteryState -> r
    gmapQr :: forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> BatteryState -> r
    $cgmapQ :: forall u. (forall d. Data d => d -> u) -> BatteryState -> [u]
    gmapQ :: forall u. (forall d. Data d => d -> u) -> BatteryState -> [u]
    $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BatteryState -> u
    gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BatteryState -> u
    $cgmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    gmapM :: forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    $cgmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    gmapMp :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    $cgmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    gmapMo :: forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> BatteryState -> m BatteryState
    Data, Int -> BatteryState
    BatteryState -> Int
    BatteryState -> [BatteryState]
    BatteryState -> BatteryState
    BatteryState -> BatteryState -> [BatteryState]
    BatteryState -> BatteryState -> BatteryState -> [BatteryState]
    (BatteryState -> BatteryState)
    -> (BatteryState -> BatteryState)
    -> (Int -> BatteryState)
    -> (BatteryState -> Int)
    -> (BatteryState -> [BatteryState])
    -> (BatteryState -> BatteryState -> [BatteryState])
    -> (BatteryState -> BatteryState -> [BatteryState])
    -> (BatteryState -> BatteryState -> BatteryState -> [BatteryState])
    -> Enum BatteryState
    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 :: BatteryState -> BatteryState
    succ :: BatteryState -> BatteryState
    $cpred :: BatteryState -> BatteryState
    pred :: BatteryState -> BatteryState
    $ctoEnum :: Int -> BatteryState
    toEnum :: Int -> BatteryState
    $cfromEnum :: BatteryState -> Int
    fromEnum :: BatteryState -> Int
    $cenumFrom :: BatteryState -> [BatteryState]
    enumFrom :: BatteryState -> [BatteryState]
    $cenumFromThen :: BatteryState -> BatteryState -> [BatteryState]
    enumFromThen :: BatteryState -> BatteryState -> [BatteryState]
    $cenumFromTo :: BatteryState -> BatteryState -> [BatteryState]
    enumFromTo :: BatteryState -> BatteryState -> [BatteryState]
    $cenumFromThenTo :: BatteryState -> BatteryState -> BatteryState -> [BatteryState]
    enumFromThenTo :: BatteryState -> BatteryState -> BatteryState -> [BatteryState]
    Enum, BatteryState -> BatteryState -> Bool
    (BatteryState -> BatteryState -> Bool)
    -> (BatteryState -> BatteryState -> Bool) -> Eq BatteryState
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: BatteryState -> BatteryState -> Bool
    == :: BatteryState -> BatteryState -> Bool
    $c/= :: BatteryState -> BatteryState -> Bool
    /= :: BatteryState -> BatteryState -> Bool
    Eq, (forall x. BatteryState -> Rep BatteryState x)
    -> (forall x. Rep BatteryState x -> BatteryState)
    -> Generic BatteryState
    forall x. Rep BatteryState x -> BatteryState
    forall x. BatteryState -> Rep BatteryState x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. BatteryState -> Rep BatteryState x
    from :: forall x. BatteryState -> Rep BatteryState x
    $cto :: forall x. Rep BatteryState x -> BatteryState
    to :: forall x. Rep BatteryState x -> BatteryState
    Generic, Eq BatteryState
    Eq BatteryState =>
    (BatteryState -> BatteryState -> Ordering)
    -> (BatteryState -> BatteryState -> Bool)
    -> (BatteryState -> BatteryState -> Bool)
    -> (BatteryState -> BatteryState -> Bool)
    -> (BatteryState -> BatteryState -> Bool)
    -> (BatteryState -> BatteryState -> BatteryState)
    -> (BatteryState -> BatteryState -> BatteryState)
    -> Ord BatteryState
    BatteryState -> BatteryState -> Bool
    BatteryState -> BatteryState -> Ordering
    BatteryState -> BatteryState -> BatteryState
    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 :: BatteryState -> BatteryState -> Ordering
    compare :: BatteryState -> BatteryState -> Ordering
    $c< :: BatteryState -> BatteryState -> Bool
    < :: BatteryState -> BatteryState -> Bool
    $c<= :: BatteryState -> BatteryState -> Bool
    <= :: BatteryState -> BatteryState -> Bool
    $c> :: BatteryState -> BatteryState -> Bool
    > :: BatteryState -> BatteryState -> Bool
    $c>= :: BatteryState -> BatteryState -> Bool
    >= :: BatteryState -> BatteryState -> Bool
    $cmax :: BatteryState -> BatteryState -> BatteryState
    max :: BatteryState -> BatteryState -> BatteryState
    $cmin :: BatteryState -> BatteryState -> BatteryState
    min :: BatteryState -> BatteryState -> BatteryState
    Ord, ReadPrec [BatteryState]
    ReadPrec BatteryState
    Int -> ReadS BatteryState
    ReadS [BatteryState]
    (Int -> ReadS BatteryState)
    -> ReadS [BatteryState]
    -> ReadPrec BatteryState
    -> ReadPrec [BatteryState]
    -> Read BatteryState
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS BatteryState
    readsPrec :: Int -> ReadS BatteryState
    $creadList :: ReadS [BatteryState]
    readList :: ReadS [BatteryState]
    $creadPrec :: ReadPrec BatteryState
    readPrec :: ReadPrec BatteryState
    $creadListPrec :: ReadPrec [BatteryState]
    readListPrec :: ReadPrec [BatteryState]
    Read, Int -> BatteryState -> ShowS
    [BatteryState] -> ShowS
    BatteryState -> String
    (Int -> BatteryState -> ShowS)
    -> (BatteryState -> String)
    -> ([BatteryState] -> ShowS)
    -> Show BatteryState
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> BatteryState -> ShowS
    showsPrec :: Int -> BatteryState -> ShowS
    $cshow :: BatteryState -> String
    show :: BatteryState -> String
    $cshowList :: [BatteryState] -> ShowS
    showList :: [BatteryState] -> ShowS
    Show, Typeable)

    -- | Information about how much charge a battery has.
    data Charge =
      Charge {Charge -> Maybe CInt
    chargeSecondsLeft :: Maybe CInt -- ^ How many seconds of battery life is left
             ,Charge -> Maybe CInt
    chargePercent :: Maybe CInt -- ^ The percentage of battery charged
             }
      deriving (Charge -> Charge -> Bool
    (Charge -> Charge -> Bool)
    -> (Charge -> Charge -> Bool) -> Eq Charge
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Charge -> Charge -> Bool
    == :: Charge -> Charge -> Bool
    $c/= :: Charge -> Charge -> Bool
    /= :: Charge -> Charge -> Bool
    Eq, (forall x. Charge -> Rep Charge x)
    -> (forall x. Rep Charge x -> Charge) -> Generic Charge
    forall x. Rep Charge x -> Charge
    forall x. Charge -> Rep Charge x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. Charge -> Rep Charge x
    from :: forall x. Charge -> Rep Charge x
    $cto :: forall x. Rep Charge x -> Charge
    to :: forall x. Rep Charge x -> Charge
    Generic, Eq Charge
    Eq Charge =>
    (Charge -> Charge -> Ordering)
    -> (Charge -> Charge -> Bool)
    -> (Charge -> Charge -> Bool)
    -> (Charge -> Charge -> Bool)
    -> (Charge -> Charge -> Bool)
    -> (Charge -> Charge -> Charge)
    -> (Charge -> Charge -> Charge)
    -> Ord Charge
    Charge -> Charge -> Bool
    Charge -> Charge -> Ordering
    Charge -> Charge -> Charge
    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 :: Charge -> Charge -> Ordering
    compare :: Charge -> Charge -> Ordering
    $c< :: Charge -> Charge -> Bool
    < :: Charge -> Charge -> Bool
    $c<= :: Charge -> Charge -> Bool
    <= :: Charge -> Charge -> Bool
    $c> :: Charge -> Charge -> Bool
    > :: Charge -> Charge -> Bool
    $c>= :: Charge -> Charge -> Bool
    >= :: Charge -> Charge -> Bool
    $cmax :: Charge -> Charge -> Charge
    max :: Charge -> Charge -> Charge
    $cmin :: Charge -> Charge -> Charge
    min :: Charge -> Charge -> Charge
    Ord, ReadPrec [Charge]
    ReadPrec Charge
    Int -> ReadS Charge
    ReadS [Charge]
    (Int -> ReadS Charge)
    -> ReadS [Charge]
    -> ReadPrec Charge
    -> ReadPrec [Charge]
    -> Read Charge
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS Charge
    readsPrec :: Int -> ReadS Charge
    $creadList :: ReadS [Charge]
    readList :: ReadS [Charge]
    $creadPrec :: ReadPrec Charge
    readPrec :: ReadPrec Charge
    $creadListPrec :: ReadPrec [Charge]
    readListPrec :: ReadPrec [Charge]
    Read, Int -> Charge -> ShowS
    [Charge] -> ShowS
    Charge -> String
    (Int -> Charge -> ShowS)
    -> (Charge -> String) -> ([Charge] -> ShowS) -> Show Charge
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Charge -> ShowS
    showsPrec :: Int -> Charge -> ShowS
    $cshow :: Charge -> String
    show :: Charge -> String
    $cshowList :: [Charge] -> ShowS
    showList :: [Charge] -> ShowS
    Show, Typeable)