hanoi :: Method
hanoi [a,b,tmp,n] this wb k =
  Assign res (Val (I 0)) $
  If (IGT (I n) (I 0))
    (\ k' -> Assign n1 (Val (Param (n-1))) $
             Assign res (Sync hanoi [a,tmp,b,n1]) $
             Assign n1 (Val (Param (n-1))) $
             Assign res (Sync hanoi [tmp,b,a,n1]) k')
     Skip $
  Return res wb k
hanoi :: Method
hanoi [a,b,tmp,n] this wb k =
  Assign res (Val (I 0)) $
  If (IGT (I n) (I 0))
    (\ k' -> Assign n1 (Val (Param (n-1))) $
             Assign res (Sync hanoi [a,tmp,b,n1]) $
             Assign n1 (Val (Param (n-1))) $
             Assign res (Sync hanoi [tmp,b,a,n1]) k')
     Skip $
  Return res wb k
hanoi [a,b,tmp,n] this wb k =
  Assign res (Val (I 0)) $
  If (IGT (I n) (I 0))
    (\ k' -> Assign n1 (Val (Param (n-1))) $
             Assign res (Sync hanoi [a,tmp,b,n1]) $
             Assign n1 (Val (Param (n-1))) $
             Assign res (Sync hanoi [tmp,b,a,n1]) k')
     Skip $
  Return res wb k