Skip to content

Commit 4275aaf

Browse files
thmathma
authored andcommitted
wip
1 parent 960fdbc commit 4275aaf

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/AllInOne.hs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,16 @@ spine' g@(Node l r) mm stack = spine' (getNode l mm) mm (g:stack)
166166
Nothing -> error $ "deref " ++ show p ++ " in " ++ show mm
167167
Just g -> g
168168

169-
spine :: IORef Graf -> [IORef Graph]-> (IORef Graph, [IORef Graph])
170-
spine ioRefGraph stack = case ioRefGraph of
171-
IORef (Com c) -> (ioRefGraph, stack)
172-
IORef (Numb i) -> (ioRefGraph, stack)
173-
IORef (Node l r) -> spine l (ioRefGraph:stack)
169+
spine :: IORef Graf -> [IORef Graf]-> IO (IORef Graf, [IORef Graf])
170+
spine ioRefGraph stack = do
171+
derefGraph <- readIORef ioRefGraph
172+
case derefGraph of
173+
Com c -> return (ioRefGraph, stack)
174+
Numb i -> return (ioRefGraph, stack)
175+
Nod l r -> do
176+
derefL <- l
177+
spine derefL (ioRefGraph:stack)
178+
174179

175180
-- spine c@(Comb _) mm stack = (c, stack)
176181
-- spine n@(Num _) mm stack = (n, stack)

0 commit comments

Comments
 (0)