Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MemoizedWebCrawler tutorial #198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add MemoizedWebCrawler tutorial #198

wants to merge 1 commit into from

Conversation

johari
Copy link
Member

@johari johari commented Jul 15, 2024

There is no tutorial out there to explain how to use llbuild2fx. The current GameOfLife example uses the less popular llbuild2BuildSystem layer instead of llbuild2fx.

I wrote up a little tutorial in README.md. I'm intending to fill out the TBD sections prior to merging.

@johari johari requested a review from neonichu July 18, 2024 01:34
* (2) Then it defines a rule for any target that ends with `.tar` extension
* In the body of the rule, (3) it reads content of a `txt` file with the same prefix and (4) dynamically declares dependency via `need contents`
* This may trigger building artifacts that match other rules
* (5) Once the dependencies are met, it spawns `tar -cf` passing all the paths it as CLI arg
Copy link
Member Author

@johari johari Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the paths to it*


## Background

The core reason why llbuild2fx is powerful is its reliance on content-addressable storage. Think of a tree where each node has a checksum. For each labeled node, the checksum is computed by putting together the checksum of the label, and aggregating the checksum of the children.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make this paragraph better:

In particular, CASTrees (an abstraction very similar to Unix file tree) have a very elegant encoding on top of a content-addressable storage. This fits nicely with the kind of use-cases that a conventional distributed build system is expected to address.

@johari johari marked this pull request as ready for review July 26, 2024 04:29
@johari johari requested a review from dmbryson as a code owner July 26, 2024 04:29
@johari johari requested a review from weissi July 26, 2024 04:29
main = shakeArgs shakeOptions $ do
want ["result.tar"] -- (1)
"*.tar" %> \out -> do -- (2)
contents <- readFileLines $ out -<.> "txt" -- (3)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readFile' :: Partial => FilePath -> Action String
Read a file, after calling need. The argument file will be tracked as a dependency.

and

readFileLines :: Partial => FilePath -> Action [String]
A version of readFile' which also splits the result into lines. The argument file will be tracked as a dependency

From https://hackage.haskell.org/package/shake-0.19.8/docs/Development-Shake.html#v:readFile-39-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant