on master help sign in
Merge pull request #234 from iphydf/unpack

perf: Mark event data types as strict; unpack some fields.

commit345f66bba58e05c16fa7ef938e344308ae1a2846 authorJonathan Daugherty <cygnus@foobox.com> dateWed 9 Mar 2022, 14:47 (5 years ago) parentd6a06949b9635b
2 files changed+4−2
src/Graphics/Vty/Input/Classify/Types.hs+1 src/Graphics/Vty/Input/Events.hs+3−2
src/Graphics/Vty/Input/Classify/Types.hs+1
@@ -1,5 +1,6 @@
11-- | This module exports the input classification type to avoid import
22-- cycles between other modules that need this.
3+{-# StrictData #-}
34module Graphics.Vty.Input.Classify.Types
45 ( KClass(..)
56 )
src/Graphics/Vty/Input/Events.hs+3−2
@@ -1,4 +1,5 @@
11{-# Language DeriveGeneric #-}
2+{-# Language StrictData #-}
23module Graphics.Vty.Input.Events where
34
45import Control.DeepSeq
@@ -15,10 +16,10 @@ import GHC.Generics
1516--
1617-- * Actually, support for most of these but KEsc, KChar, KBS, and
1718-- KEnter vary by terminal and keyboard.
18−data Key = KEsc | KChar Char | KBS | KEnter
19+data Key = KEsc | KChar {-# UNPACK #-} Char | KBS | KEnter
1920 | KLeft | KRight | KUp | KDown
2021 | KUpLeft | KUpRight | KDownLeft | KDownRight | KCenter
21− | KFun Int | KBackTab | KPrtScr | KPause | KIns
22+ | KFun {-# UNPACK #-} Int | KBackTab | KPrtScr | KPause | KIns
2223 | KHome | KPageUp | KDel | KEnd | KPageDown | KBegin | KMenu
2324 deriving (Eq,Show,Read,Ord,Generic)
2425