updAttr :: Attr a => AttrTable a -> NodeInfo -> a -> AttrTable a
updAttr at node av =
    case nameOfNode node of
        Nothing  -> onlyPosErr "updAttr" at (posOfNode node)
        Just aid ->
          case at of
            (SoftTable   fm  desc) -> SoftTable (NameMap.insert (nameId aid) av fm) desc
            (FrozenTable _arr _)    -> interr $ "Attributes.updAttr: Tried to\
                                               \ update frozen attribute in\n"
                                               ++ errLoc at (posOfNode node)

-- | copy the value of an attribute to another one
--
-- * undefined attributes are not copied, to avoid filling the table
--
updAttr :: Attr a => AttrTable a -> NodeInfo -> a -> AttrTable a
updAttr at node av =
    case nameOfNode node of
        Nothing  -> onlyPosErr "updAttr" at (posOfNode node)
        Just aid ->
          case at of
            (SoftTable   fm  desc) -> SoftTable (NameMap.insert (nameId aid) av fm) desc
            (FrozenTable _arr _)    -> interr $ "Attributes.updAttr: Tried to\
                                               \ update frozen attribute in\n"
                                               ++ errLoc at (posOfNode node)

-- | copy the value of an attribute to another one
--
-- * undefined attributes are not copied, to avoid filling the table
--
updAttr at node av =
    case nameOfNode node of
        Nothing  -> onlyPosErr "updAttr" at (posOfNode node)
        Just aid ->
          case at of
            (SoftTable   fm  desc) -> SoftTable (NameMap.insert (nameId aid) av fm) desc
            (FrozenTable _arr _)    -> interr $ "Attributes.updAttr: Tried to\
                                               \ update frozen attribute in\n"
                                               ++ errLoc at (posOfNode node)

-- | copy the value of an attribute to another one
--
-- * undefined attributes are not copied, to avoid filling the table
--