summaryrefslogtreecommitdiff
path: root/src/Grasp/IP.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Grasp/IP.hs')
-rw-r--r--src/Grasp/IP.hs19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/Grasp/IP.hs b/src/Grasp/IP.hs
index 7b70e21..efb904d 100644
--- a/src/Grasp/IP.hs
+++ b/src/Grasp/IP.hs
@@ -10,27 +10,30 @@ module Grasp.IP (
-import Grasp.Node( GNode )
-import qualified Grasp.Node as GN
+import Grasp.Types( GNode )
-type IP = [GNode]
+
+
+newtype IP = IP [GNode]
+ deriving (Eq, Show)
+
singleton :: GNode -> IP
-singleton = (:[])
+singleton n = IP [n]
peek :: IP -> GNode
-peek = head
+peek (IP p) = head p
push :: GNode -> IP -> IP
-push = (:)
+push n (IP p) = IP (n:p)
pop :: IP -> IP
-pop = tail
+pop (IP p) = IP (tail p)
isEmpty :: IP -> Bool
-isEmpty = (==[])
+isEmpty (IP p) = (length p == 0)