updateDirectory :: FileName -> AnnotatedM ()
updateDirectory p = (==Directory) <$> gets what >>= flip when go
  where
    go = do let line = fn2ps p
            files <- gets current
            case filter ((==line) . snd) files of
              [match@(ident, _)] -> reannotate ident match line
              _ -> return ()
    reannotate ident match line =
      modify $ \x -> x { annotated = annotated x V.// [ (ident, update line $ currentInfo x) ]
                       , current = filter (/= match) $ current x }
    update line inf = (Just inf, BC.concat [ " -- created as: ", line ])
updateDirectory :: FileName -> AnnotatedM ()
updateDirectory p = (==Directory) <$> gets what >>= flip when go
  where
    go = do let line = fn2ps p
            files <- gets current
            case filter ((==line) . snd) files of
              [match@(ident, _)] -> reannotate ident match line
              _ -> return ()
    reannotate ident match line =
      modify $ \x -> x { annotated = annotated x V.// [ (ident, update line $ currentInfo x) ]
                       , current = filter (/= match) $ current x }
    update line inf = (Just inf, BC.concat [ " -- created as: ", line ])
updateDirectory p = (==Directory) <$> gets what >>= flip when go
  where
    go = do let line = fn2ps p
            files <- gets current
            case filter ((==line) . snd) files of
              [match@(ident, _)] -> reannotate ident match line
              _ -> return ()
    reannotate ident match line =
      modify $ \x -> x { annotated = annotated x V.// [ (ident, update line $ currentInfo x) ]
                       , current = filter (/= match) $ current x }
    update line inf = (Just inf, BC.concat [ " -- created as: ", line ])