Copyright | (c) Eric Mertens 2022 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2022/day/7
The immediate size of a directory is the list of the files contained in it directly, while the total size includes the files that are contained within subdirectories.
>>>
:{
:main + "$ cd /\n\ \$ ls\n\ \dir a\n\ \14848514 b.txt\n\ \8504156 c.dat\n\ \dir d\n\ \$ cd a\n\ \$ ls\n\ \dir e\n\ \29116 f\n\ \2557 g\n\ \62596 h.lst\n\ \$ cd e\n\ \$ ls\n\ \584 i\n\ \$ cd ..\n\ \$ cd ..\n\ \$ cd d\n\ \$ ls\n\ \4060174 j\n\ \8033020 d.log\n\ \5626152 d.ext\n\ \7214296 k\n" :} 95437 24933642
Documentation
File paths are represented as a list of directory components in reverse order to make it quicker to manipulate.
type Input = [Either String [Either (Int, String) String]] Source #
The input is a list of directory change commands and directory listings.