From a6c346b410df61871f3544064540e425646e93f6 Mon Sep 17 00:00:00 2001 From: Mario Lang Date: Fri, 16 Jul 2021 13:59:16 +0200 Subject: [PATCH] NFData instance for Event --- src/Graphics/Vty/Input/Events.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Graphics/Vty/Input/Events.hs b/src/Graphics/Vty/Input/Events.hs index 6ae1cb0..4c960fd 100644 --- a/src/Graphics/Vty/Input/Events.hs +++ b/src/Graphics/Vty/Input/Events.hs @@ -1,6 +1,7 @@ {-# Language DeriveGeneric #-} module Graphics.Vty.Input.Events where +import Control.DeepSeq import Data.ByteString import GHC.Generics @@ -21,16 +22,22 @@ data Key = KEsc | KChar Char | KBS | KEnter | KHome | KPageUp | KDel | KEnd | KPageDown | KBegin | KMenu deriving (Eq,Show,Read,Ord,Generic) +instance NFData Key + -- | Modifier keys. Key codes are interpreted such that users are more -- likely to have Meta than Alt; for instance on the PC Linux console, -- 'MMeta' will generally correspond to the physical Alt key. data Modifier = MShift | MCtrl | MMeta | MAlt deriving (Eq,Show,Read,Ord,Generic) +instance NFData Modifier + -- | Mouse buttons. data Button = BLeft | BMiddle | BRight | BScrollUp | BScrollDown deriving (Eq,Show,Read,Ord,Generic) +instance NFData Button + -- | Events. data Event = EvKey Key [Modifier] @@ -62,4 +69,6 @@ data Event -- ^ The terminal running the application gained input focus. deriving (Eq,Show,Read,Ord,Generic) +instance NFData Event + type ClassifyMap = [(String,Event)]