addTrans :: Monad m => Trans m value -> MkPNMonad m value TransNo
    addTrans trans
        | length (transExprs trans) /= length (transOutPlaces trans) = error $
            "addTrans: must be one expr per out place `" ++ show (transExprs trans) ++ "', for "
            ++ show (length (transOutPlaces trans)) ++ " out places"
        | otherwise = state op
        where op mkpn = (transNo, mkpn')
                where
                  transNo = mkpnTransCount mkpn + 1
                  mkpn' = mkpn { mkpnTransCount = transNo, mkpnTrans = DM.insert transNo trans (mkpnTrans mkpn) }
addTrans :: Monad m => Trans m value -> MkPNMonad m value TransNo
addTrans trans
        | length (transExprs trans) /= length (transOutPlaces trans) = error $
            "addTrans: must be one expr per out place `" ++ show (transExprs trans) ++ "', for "
            ++ show (length (transOutPlaces trans)) ++ " out places"
        | otherwise = state op
        where op mkpn = (transNo, mkpn')
                where
                  transNo = mkpnTransCount mkpn + 1
                  mkpn' = mkpn { mkpnTransCount = transNo, mkpnTrans = DM.insert transNo trans (mkpnTrans mkpn) }
addTrans trans
        | length (transExprs trans) /= length (transOutPlaces trans) = error $
            "addTrans: must be one expr per out place `" ++ show (transExprs trans) ++ "', for "
            ++ show (length (transOutPlaces trans)) ++ " out places"
        | otherwise = state op
        where op mkpn = (transNo, mkpn')
                where
                  transNo = mkpnTransCount mkpn + 1
                  mkpn' = mkpn { mkpnTransCount = transNo, mkpnTrans = DM.insert transNo trans (mkpnTrans mkpn) }