Skip to content

Commit

Permalink
add ppInstructionAsShowS
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptival committed Jun 14, 2023
1 parent ab1ae28 commit 047d5f1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Flexdis86/InstructionSet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Flexdis86.InstructionSet
InstructionInstance
, InstructionInstanceF(..)
, ppInstruction
, ppInstructionAsShowS
, ppInstructionWith
, Value(..)
, ppValue
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 047d5f1

Please sign in to comment.