From 4aff1a56d6078dc9c6b4d78f552f6cb611df13b1 Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Sun, 29 Jun 2025 13:13:54 +0200 Subject: [PATCH] doc[compressed]: commentation --- src/Language/Brainfuck/Instruction/Compressed.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Language/Brainfuck/Instruction/Compressed.hs b/src/Language/Brainfuck/Instruction/Compressed.hs index bf28a1d..24a000a 100644 --- a/src/Language/Brainfuck/Instruction/Compressed.hs +++ b/src/Language/Brainfuck/Instruction/Compressed.hs @@ -20,8 +20,10 @@ import Language.Brainfuck.Instruction qualified as Instruction data CompressedInstruction = Add Word8 | Subtract Word8 + -- add and sub wrap when doing more than 255 because Brainfuck operates on u8-cells | MoveRight Natural | MoveLeft Natural + -- disallows moving a negative amount of steps in a direction | ReadByte | PutByte | Loop (Vector CompressedInstruction) @@ -86,3 +88,7 @@ uncompress = Vector.concatMap uncompressSingle ReadByte -> Vector.singleton Instruction.ReadByte Loop body -> Vector.singleton $ Instruction.Loop (uncompress body) +-- >>> let source = Vector.replicate 300 Instruction.Increment in source == (uncompress . compress) source +-- False + +