diff --git a/src/Language/Brainfuck/Instruction/Extended.hs b/src/Language/Brainfuck/Instruction/Extended.hs index 7ab2a59..176bc71 100644 --- a/src/Language/Brainfuck/Instruction/Extended.hs +++ b/src/Language/Brainfuck/Instruction/Extended.hs @@ -1,6 +1,5 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE PatternSynonyms #-} -{-# LANGUAGE StrictData #-} -- | 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'. @@ -109,7 +108,7 @@ prependTranslation instruction rest = let CompressedInstruction.Add i -> addSingle $ Modify Operation.Add i CompressedInstruction.Subtract i -> addSingle $ Modify Operation.Subtract i 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.PutByte -> addSingle $ Interact Interaction.Write CompressedInstruction.Loop body -> let