Execute Brain****/Haskell: Difference between revisions

m
Fixed syntax highlighting.
m (Fixed syntax highlighting.)
 
Line 8:
A more efficient implementation could for example only admit well-bracketed brainfuck programs, and parse bracket blocks first, to replace the ''matchLeft'' and ''matchRight'' which need linear time.
 
<langsyntaxhighlight lang="haskell">module BF where
 
moveLeft (x:l,r) = (l,x:r)
Line 46:
dialog :: String -> IO ()
dialog s = mapM_ print . run s . map read . lines =<< getContents
</langsyntaxhighlight>(This version compiles with GHC and will run if loaded into ghci using ':load BF')
 
Example session:
9,476

edits