summaryrefslogtreecommitdiff
path: root/Brainfuck/Tape.hs
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-04-10 05:25:03 +1000
committerJed Barber <jjbarber@y7mail.com>2014-04-10 05:25:03 +1000
commit281425310c5db21f87981eeb9601a71d1974d98d (patch)
treebef4643d906c93622c311fef2cf758fe94f1f651 /Brainfuck/Tape.hs
parente8695600977769008f285f9958eb043cca1b9b29 (diff)
Rearranging files
Diffstat (limited to 'Brainfuck/Tape.hs')
-rw-r--r--Brainfuck/Tape.hs46
1 files changed, 0 insertions, 46 deletions
diff --git a/Brainfuck/Tape.hs b/Brainfuck/Tape.hs
deleted file mode 100644
index 8da4352..0000000
--- a/Brainfuck/Tape.hs
+++ /dev/null
@@ -1,46 +0,0 @@
-module Brainfuck.Tape (
- Tape,
-
- shiftLeft,
- shiftRight,
- currentCell,
- applyToCurrentCell
- ) where
-
-
-import Control.Monad
-import Data.Maybe
-
-
-
-type Tape a = ([a], Maybe a, [a])
-
-
-
-
-shiftLeft :: Eq a => Tape a -> Tape a
-shiftLeft (x,y,z) =
- let x' = if (x /= []) then tail x else x
- y' = if (x /= []) then Just (head x) else Nothing
- z' = if (isJust y) then (fromJust y):z else z
- in (x', y', z')
-
-
-
-shiftRight :: Eq a => Tape a -> Tape a
-shiftRight (x,y,z) =
- let x' = if (isJust y) then (fromJust y):x else x
- y' = if (z /= []) then Just (head z) else Nothing
- z' = if (z /= []) then tail z else z
- in (x', y', z')
-
-
-
-currentCell :: Tape a -> Maybe a
-currentCell (_,c,_) = c
-
-
-
-applyToCurrentCell :: (a -> a) -> Tape a -> Tape a
-applyToCurrentCell f (x,y,z) = (x, (liftM f) y, z)
-