From 047d5f1c5659c9283f489c89ba5b91beeac08921 Mon Sep 17 00:00:00 2001 From: Valentin Robert Date: Wed, 14 Jun 2023 12:15:06 -0700 Subject: [PATCH] add ppInstructionAsShowS --- src/Flexdis86/InstructionSet.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Flexdis86/InstructionSet.hs b/src/Flexdis86/InstructionSet.hs index c1152ef..b7300b7 100644 --- a/src/Flexdis86/InstructionSet.hs +++ b/src/Flexdis86/InstructionSet.hs @@ -11,6 +11,7 @@ module Flexdis86.InstructionSet InstructionInstance , InstructionInstanceF(..) , ppInstruction + , ppInstructionAsShowS , ppInstructionWith , Value(..) , ppValue @@ -294,6 +295,11 @@ ppInstruction i = ([], _) -> sLockPrefix <+> text op (_,_) -> sLockPrefix <+> text op <+> ppPunctuate comma (ppValue <$> args) +-- | Allows libraries using `ppInstruction` to not have to depend on deprecated +-- ansi-wl-pprint to turn instructions into `String`s. +ppInstructionAsShowS :: InstructionInstance -> ShowS +ppInstructionAsShowS = displayS . renderCompact . ppInstruction + ppInstructionWith :: (a -> Doc) -> InstructionInstanceF a -> Doc