definition :: Parser ()
definition = do
    cst <- identifier -- $foo
    reservedOp "="
    dat <- ipList <|> domainList <|> resultList
    void semi
    define cst dat
    return ()
  where
    define cst dat = do
        st <- getState
        let ent = lookup cst (consttbl st)
        when (isJust ent) $ unexpected $ ": Multiple declarations of '" ++ cst ++ "'"
        setState st {
            consttbl = (cst, dat) : consttbl st
          , unused = cst : unused st
          }
definition :: Parser ()
definition = do
    cst <- identifier -- $foo
    reservedOp "="
    dat <- ipList <|> domainList <|> resultList
    void semi
    define cst dat
    return ()
  where
    define cst dat = do
        st <- getState
        let ent = lookup cst (consttbl st)
        when (isJust ent) $ unexpected $ ": Multiple declarations of '" ++ cst ++ "'"
        setState st {
            consttbl = (cst, dat) : consttbl st
          , unused = cst : unused st
          }
definition = do
    cst <- identifier -- $foo
    reservedOp "="
    dat <- ipList <|> domainList <|> resultList
    void semi
    define cst dat
    return ()
  where
    define cst dat = do
        st <- getState
        let ent = lookup cst (consttbl st)
        when (isJust ent) $ unexpected $ ": Multiple declarations of '" ++ cst ++ "'"
        setState st {
            consttbl = (cst, dat) : consttbl st
          , unused = cst : unused st
          }