Merge pull request #228 from mlang/NFData

NFData instance for Event
This commit is contained in:
Jonathan Daugherty 2021-07-16 08:59:00 -07:00 committed by GitHub
commit 67b25158f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
{-# Language DeriveGeneric #-} {-# Language DeriveGeneric #-}
module Graphics.Vty.Input.Events where module Graphics.Vty.Input.Events where
import Control.DeepSeq
import Data.ByteString import Data.ByteString
import GHC.Generics import GHC.Generics
@ -21,16 +22,22 @@ data Key = KEsc | KChar Char | KBS | KEnter
| KHome | KPageUp | KDel | KEnd | KPageDown | KBegin | KMenu | KHome | KPageUp | KDel | KEnd | KPageDown | KBegin | KMenu
deriving (Eq,Show,Read,Ord,Generic) deriving (Eq,Show,Read,Ord,Generic)
instance NFData Key
-- | Modifier keys. Key codes are interpreted such that users are more -- | Modifier keys. Key codes are interpreted such that users are more
-- likely to have Meta than Alt; for instance on the PC Linux console, -- likely to have Meta than Alt; for instance on the PC Linux console,
-- 'MMeta' will generally correspond to the physical Alt key. -- 'MMeta' will generally correspond to the physical Alt key.
data Modifier = MShift | MCtrl | MMeta | MAlt data Modifier = MShift | MCtrl | MMeta | MAlt
deriving (Eq,Show,Read,Ord,Generic) deriving (Eq,Show,Read,Ord,Generic)
instance NFData Modifier
-- | Mouse buttons. -- | Mouse buttons.
data Button = BLeft | BMiddle | BRight | BScrollUp | BScrollDown data Button = BLeft | BMiddle | BRight | BScrollUp | BScrollDown
deriving (Eq,Show,Read,Ord,Generic) deriving (Eq,Show,Read,Ord,Generic)
instance NFData Button
-- | Events. -- | Events.
data Event data Event
= EvKey Key [Modifier] = EvKey Key [Modifier]
@ -62,4 +69,6 @@ data Event
-- ^ The terminal running the application gained input focus. -- ^ The terminal running the application gained input focus.
deriving (Eq,Show,Read,Ord,Generic) deriving (Eq,Show,Read,Ord,Generic)
instance NFData Event
type ClassifyMap = [(String,Event)] type ClassifyMap = [(String,Event)]