My CI for dhall-ruby now create a full cache directory of the standard Prelude with each build and publishes to IPFS.
You can browse this for example at https://gateway.pinata.cloud/ipfs/bafybeifugaluagsahc4xgipdrnn6cyq3pqd427guznemwjibzinb5tkvrq
This could be used to warm a cache with the entire Prelude so it never needs to be normalized locally, with the easiest way to do that manually being to download a tar using, for example, https://gateway.pinata.cloud/api/v0/get/bafybeifugaluagsahc4xgipdrnn6cyq3pqd427guznemwjibzinb5tkvrq and then untar the downloaded file and move the contents into your cache directory (if using the standard filesystem cache).
Another interesting use for this (especially if I start adding more libraries to my CI – suggestions welcome!) is that since IPFS is content-addressable, a given integrity-protected expression can be looked for in IPFS directly. For example using code like this:
def sha256toIPFS(sha256inHex) "/ipfs/b" + Base32.encode("\x01\x55\x12\x20" + [sha256inHex].pack("H*")).downcase.sub(/=*$/, '') end
printf "/ipfs/b%s\n" $(echo 01551220$HEX_HASH | base16 -d | base32plain -l | sed -e's/=*$//')
The hex-encoded sha256 found in Dhall source code for an integrity-protected expression can be turned into a working IPFS path, which can be fetched even if you don’t have any local IPFS software like so:
This could allow implementations to optionally look up in a sort of global “cache” on the fly for any integrity protected expression in lieu of resolving and normalizing it. So long as the implementation checks that the hash of the downloaded content matches the expected hash, this is just as safe (and often faster) as the normally used resolve-and-normalize mechanisms.
This works today for anything in the v9.0.0 Prelude.