-- | Creates a new node on the selected target
newNode :: Monad m => Target -> TypeId -> a -> InstanceBuilder a b m Int
newNode Rule t p = do (Morphism ns es) <- getCurrentRule
                      let ks = (map nodeID $ catMaybes $ map fst ns)
                          newNode = (Just $ Node (newId ks) t p)
                          newRule = (newNode, newNode)
                      setCurrentRule $ Morphism (newRule:ns) es
                      return $ newId ks
newNode :: Monad m => Target -> TypeId -> a -> InstanceBuilder a b m Int
newNode Rule t p = do (Morphism ns es) <- getCurrentRule
                      let ks = (map nodeID $ catMaybes $ map fst ns)
                          newNode = (Just $ Node (newId ks) t p)
                          newRule = (newNode, newNode)
                      setCurrentRule $ Morphism (newRule:ns) es
                      return $ newId ks
newNode Rule t p = do (Morphism ns es) <- getCurrentRule
                      let ks = (map nodeID $ catMaybes $ map fst ns)
                          newNode = (Just $ Node (newId ks) t p)
                          newRule = (newNode, newNode)
                      setCurrentRule $ Morphism (newRule:ns) es
                      return $ newId ks