From 0c49b3f13dc00eb5811002f230e1a6e4cc52d705 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 20 Nov 2014 22:11:03 +1100 Subject: Factored out graph node/edge and instruction pointer types --- src/Grasp/IP.hs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/Grasp/IP.hs (limited to 'src/Grasp/IP.hs') diff --git a/src/Grasp/IP.hs b/src/Grasp/IP.hs new file mode 100644 index 0000000..7b70e21 --- /dev/null +++ b/src/Grasp/IP.hs @@ -0,0 +1,36 @@ +module Grasp.IP ( + IP, + + singleton, + peek, + push, + pop, + isEmpty + ) where + + + +import Grasp.Node( GNode ) +import qualified Grasp.Node as GN + + + +type IP = [GNode] + + + +singleton :: GNode -> IP +singleton = (:[]) + +peek :: IP -> GNode +peek = head + +push :: GNode -> IP -> IP +push = (:) + +pop :: IP -> IP +pop = tail + +isEmpty :: IP -> Bool +isEmpty = (==[]) + -- cgit