From efaaa5723a36b2a7f58cca560e10dc9e39e59ccb Mon Sep 17 00:00:00 2001 From: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com> Date: Sat, 11 Sep 2021 13:40:05 +0300 Subject: [PATCH] Add Show instances to structs and enums (#90) --- generator/DearImGui/Generator.hs | 4 ++-- src/DearImGui/Structs.hs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/generator/DearImGui/Generator.hs b/generator/DearImGui/Generator.hs index 0e788cd..b9657dd 100644 --- a/generator/DearImGui/Generator.hs +++ b/generator/DearImGui/Generator.hs @@ -125,9 +125,9 @@ declareEnumeration finiteEnumName countName ( Enumeration {..} ) = do classes :: [ TH.Q TH.Type ] classes | isFlagEnum - = map TH.conT [ ''Eq, ''Ord, ''Storable, ''Bits ] + = map TH.conT [ ''Eq, ''Ord, ''Show, ''Storable, ''Bits ] | otherwise - = map TH.conT [ ''Eq, ''Ord, ''Storable ] + = map TH.conT [ ''Eq, ''Ord, ''Show, ''Storable ] derivClause :: TH.Q TH.DerivClause derivClause = TH.derivClause ( Just TH.NewtypeStrategy ) classes diff --git a/src/DearImGui/Structs.hs b/src/DearImGui/Structs.hs index d5f5c3b..cdd5c3c 100644 --- a/src/DearImGui/Structs.hs +++ b/src/DearImGui/Structs.hs @@ -9,6 +9,7 @@ import Foreign -------------------------------------------------------------------------------- data ImVec2 = ImVec2 { x, y :: {-# unpack #-} !Float } + deriving (Show) instance Storable ImVec2 where @@ -27,6 +28,7 @@ instance Storable ImVec2 where data ImVec3 = ImVec3 { x, y, z :: {-# unpack #-} !Float } + deriving (Show) instance Storable ImVec3 where @@ -47,6 +49,7 @@ instance Storable ImVec3 where data ImVec4 = ImVec4 { x, y, z, w :: {-# unpack #-} !Float } + deriving (Show) instance Storable ImVec4 where