Merge pull request #234 from iphydf/unpack

perf: Mark event data types as strict; unpack some fields.
This commit is contained in:
Jonathan Daugherty 2022-03-09 14:47:46 -08:00 committed by GitHub
commit 345f66bba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
-- | This module exports the input classification type to avoid import -- | This module exports the input classification type to avoid import
-- cycles between other modules that need this. -- cycles between other modules that need this.
{-# StrictData #-}
module Graphics.Vty.Input.Classify.Types module Graphics.Vty.Input.Classify.Types
( KClass(..) ( KClass(..)
) )

View File

@ -1,4 +1,5 @@
{-# Language DeriveGeneric #-} {-# Language DeriveGeneric #-}
{-# Language StrictData #-}
module Graphics.Vty.Input.Events where module Graphics.Vty.Input.Events where
import Control.DeepSeq import Control.DeepSeq
@ -15,10 +16,10 @@ import GHC.Generics
-- --
-- * Actually, support for most of these but KEsc, KChar, KBS, and -- * Actually, support for most of these but KEsc, KChar, KBS, and
-- KEnter vary by terminal and keyboard. -- KEnter vary by terminal and keyboard.
data Key = KEsc | KChar Char | KBS | KEnter data Key = KEsc | KChar {-# UNPACK #-} Char | KBS | KEnter
| KLeft | KRight | KUp | KDown | KLeft | KRight | KUp | KDown
| KUpLeft | KUpRight | KDownLeft | KDownRight | KCenter | KUpLeft | KUpRight | KDownLeft | KDownRight | KCenter
| KFun Int | KBackTab | KPrtScr | KPause | KIns | KFun {-# UNPACK #-} Int | KBackTab | KPrtScr | KPause | KIns
| 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)