fix[compressed]: FIRST BUG, the Num instance for Natural is broken

This commit is contained in:
vegowotenks 2025-06-29 14:35:11 +02:00
parent 7839627592
commit a264e3dc57

View file

@ -1,6 +1,5 @@
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE StrictData #-}
-- | Extended instructions are the representation I wish to use for the optimization techniques in these modules. -- | Extended instructions are the representation I wish to use for the optimization techniques in these modules.
-- They should be easy to extend, hence I factored the 'Operation' type out of 'Language.Brainfuck.CompressedInstruction.CompressedInstruction'. -- They should be easy to extend, hence I factored the 'Operation' type out of 'Language.Brainfuck.CompressedInstruction.CompressedInstruction'.
@ -109,7 +108,7 @@ prependTranslation instruction rest = let
CompressedInstruction.Add i -> addSingle $ Modify Operation.Add i CompressedInstruction.Add i -> addSingle $ Modify Operation.Add i
CompressedInstruction.Subtract i -> addSingle $ Modify Operation.Subtract i CompressedInstruction.Subtract i -> addSingle $ Modify Operation.Subtract i
CompressedInstruction.MoveRight n -> addSingle $ Move $ toInteger n CompressedInstruction.MoveRight n -> addSingle $ Move $ toInteger n
CompressedInstruction.MoveLeft n -> addSingle $ Move $ toInteger (-n) CompressedInstruction.MoveLeft n -> addSingle $ Move $ negate . toInteger $ n
CompressedInstruction.ReadByte -> addSingle $ Interact Interaction.Read CompressedInstruction.ReadByte -> addSingle $ Interact Interaction.Read
CompressedInstruction.PutByte -> addSingle $ Interact Interaction.Write CompressedInstruction.PutByte -> addSingle $ Interact Interaction.Write
CompressedInstruction.Loop body -> let CompressedInstruction.Loop body -> let