Just to further the points in 3. a little, in addition to @pdamoc 's proof of concept with patching ELM_HOME
linked above I’ve started dreaming up a format of how these “patched” snapshots could be described declaratively and applied.
I’m sure there is a bunch of other prior art in all of the elm-git-install
and shelm
-like tools that we could explore.
Here’s my noodling:
elm-patchwork.json
{
"elmVersion": "0.19.1",
"packages": {
"elm/core": {
"version": "1.0.5",
"base": {
"gitRepoUrl": "https://github.com/elm/core",
"gitCommitHash": "84f38891468e8e153fc85a9b63bdafd81b24664e"
},
"patchPlan": [
{
"name": "List.concatMap performance improvements",
"filePath": "./patches/elm-core-1.0.5-list-concatmap.patch"
}
]
}
}
}
consumed by some tool into types like:
{-| The top-level type corresponding to the elm-patchwork.json file
-}
type alias Project =
{ elmVersion : String -- "0.19.1"
, packages : List Package
}
type alias Package =
{ name : String -- "elm/core"
, version : String -- "1.0.5"
, base : PackageBase
, patches : List Patch
}
type PackageBase
= BaseFromGit
{ gitRepoUrl : String -- not strictly GitHub?
, gitCommitHash : String -- this is how we'll download that package
}
| BaseFromFilesystem
{ folderPath : String -- "./patchwork/bases/elm/core/hacked-1.0.5"
}
type alias Patch =
{ name : String -- "List.concat: performance improvement"
, contents : PatchContents
}
type PatchContents
= PatchFromGit
{ gitRepoUrl : String -- not strictly GitHub?
, gitCommitHash : String -- this is how we'll download that patch
, filePath : String -- "patches/elm-core-1.0.5-list-concat.patch"
}
| PatchFromFilesystem
{ filePath : String -- "./patches/elm-core-1.0.5-list-concat.patch"
}