    {-# LANGUAGE PatternGuards #-}
    {-# LANGUAGE RankNTypes    #-}
    {-# OPTIONS_HADDOCK hide #-}

    -- | Callback for exiting the program.
    module Graphics.Gloss.Internals.Interface.Common.Exit
            (callback_exit)
    where
    import Graphics.Gloss.Internals.Interface.Backend.Types

    callback_exit :: a -> Callback
    callback_exit :: forall a. a -> Callback
    callback_exit a
    stateRef
     =      KeyboardMouseCallback -> Callback
    KeyMouse (a -> KeyboardMouseCallback
    forall a. a -> KeyboardMouseCallback
    keyMouse_exit a
    stateRef)

    keyMouse_exit :: a -> KeyboardMouseCallback
    keyMouse_exit :: forall a. a -> KeyboardMouseCallback
    keyMouse_exit
            a
    _
            IORef a
    backend
            Key
    key KeyState
    keyState Modifiers
    _
            (Int, Int)
    _
            | Key
    key           Key -> Key -> Bool
    forall a. Eq a => a -> a -> Bool
    == SpecialKey -> Key
    SpecialKey SpecialKey
    KeyEsc
            , KeyState
    keyState      KeyState -> KeyState -> Bool
    forall a. Eq a => a -> a -> Bool
    == KeyState
    Down
            = IORef a -> IO ()
    forall a. Backend a => IORef a -> IO ()
    exitBackend IORef a
    backend

            | Bool
    otherwise
            = () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()