Code inspired by Gabriel Gonzalez's fantastic article on free monads
Requirements
- Docker or Stack
Stack
make
Docker
make docker
Run stack ghci
to play with the example programs and interpreter:
interpreter0 = putStrLn (showProgram program6)
where
subroutine2 :: Subroutine
subroutine2 = output 'A'
program6 :: Program
program6 = do
subroutine2
bell
done
λ > interpreter0
output 'A'
bell
done
interpreter1 = putStrLn (showProgram program7)
where
program7 :: Program
program7 = do
output 'A'
output 'B'
output 'C'
bell
λ > interpreter1
output 'A'
output 'B'
output 'C'
bell
done