From 73dff42330f376381318d1cd3137a7dceeeb15ca Mon Sep 17 00:00:00 2001 From: Daniel Casanueva Date: Sat, 23 Apr 2022 15:50:18 +0200 Subject: [PATCH 1/2] Add PrintDot instances for Word32 and Word64. --- Data/GraphViz/Printing.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Data/GraphViz/Printing.hs b/Data/GraphViz/Printing.hs index 37fcf46..6ac8583 100644 --- a/Data/GraphViz/Printing.hs +++ b/Data/GraphViz/Printing.hs @@ -92,7 +92,7 @@ import Data.Char (toLower) import qualified Data.Set as Set import Data.String (IsString(..)) import Data.Version (Version(..)) -import Data.Word (Word16, Word8) +import Data.Word (Word64, Word32, Word16, Word8) #if !(MIN_VERSION_base (4,11,0)) @@ -191,6 +191,12 @@ instance PrintDot Word8 where instance PrintDot Word16 where unqtDot = int . fromIntegral +instance PrintDot Word32 where + unqtDot = int . fromIntegral + +instance PrintDot Word64 where + unqtDot = int . fromIntegral + instance PrintDot Double where -- If it's an "integral" double, then print as an integer. This -- seems to match how Graphviz apps use Dot. From 852f036fe5bc08b857493ae8c307d6d7b36697cf Mon Sep 17 00:00:00 2001 From: Daniel Casanueva Date: Sat, 23 Apr 2022 16:49:59 +0200 Subject: [PATCH 2/2] Go through Integer --- Data/GraphViz/Printing.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/GraphViz/Printing.hs b/Data/GraphViz/Printing.hs index 6ac8583..08128fc 100644 --- a/Data/GraphViz/Printing.hs +++ b/Data/GraphViz/Printing.hs @@ -192,10 +192,10 @@ instance PrintDot Word16 where unqtDot = int . fromIntegral instance PrintDot Word32 where - unqtDot = int . fromIntegral + unqtDot = unqtDot . toInteger instance PrintDot Word64 where - unqtDot = int . fromIntegral + unqtDot = unqtDot . toInteger instance PrintDot Double where -- If it's an "integral" double, then print as an integer. This