{"id":27048539,"url":"https://github.com/soficshift/unionmount-co-log","last_synced_at":"2025-04-05T07:15:08.128Z","repository":{"id":285501003,"uuid":"958352808","full_name":"soficshift/unionmount-co-log","owner":"soficshift","description":"  Union mount in Haskell, with fsnotify and co-log ","archived":false,"fork":false,"pushed_at":"2025-04-01T04:02:27.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T07:15:04.784Z","etag":null,"topics":["filesystem","haskell","unionfs"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soficshift.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-01T04:00:47.000Z","updated_at":"2025-04-01T04:04:23.000Z","dependencies_parsed_at":"2025-04-01T04:30:34.882Z","dependency_job_id":"11a7d7e4-2d45-4df7-8cb3-96bf5c11c36c","html_url":"https://github.com/soficshift/unionmount-co-log","commit_stats":null,"previous_names":["estradilua/unionmount-co-log","soficshift/unionmount-co-log"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soficshift%2Funionmount-co-log","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soficshift%2Funionmount-co-log/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soficshift%2Funionmount-co-log/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soficshift%2Funionmount-co-log/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soficshift","download_url":"https://codeload.github.com/soficshift/unionmount-co-log/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299850,"owners_count":20916193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filesystem","haskell","unionfs"],"created_at":"2025-04-05T07:15:07.383Z","updated_at":"2025-04-05T07:15:08.122Z","avatar_url":"https://github.com/soficshift.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unionmount\n\nHaskell library to \"[union mount](https://en.wikipedia.org/wiki/Union_mount)\" a bunch of folders onto an in-memory data structure, and keeping the latter in sync as the files change over time. Used in [Ema](https://ema.srid.ca) and [Emanote](https://emanote.srid.ca).\n\n## Usage\n\nBoth the `mount` and `unionMount` functions return a tuple value of type [Dynamic](https://ema.srid.ca/guide/model/dynamic), giving direct access to the initial value as well as the updater function that may be run in a separate thread. See [how Ema uses it](https://github.com/EmaApps/ema/blob/459d3899e0b9ea13e23c81126279dc62530b994c/src/Ema/App.hs#L72-L84) for an illustration.\n\nHere's a simple example of loading Markdown files onto a TVar of `Map FilePath Text` (file contents keyed by path).\n\n```haskell\nimport System.UnionMount qualified as UM\nimport Data.Map.Strict qualified as Map\n\nmain :: IO ()\nmain = do\n  runStdoutLoggingT $ do\n    let baseDir = \"/Users/srid/Documents/Notebook\"\n    (model0, modelF) \u003c- UM.mount baseDir (one ((), \"*.md\")) [] mempty (const $ handlePathUpdate baseDir)\n    modelVar \u003c- newTVarIO model0\n    modelF $ \\newModel -\u003e do\n      atomically $ writeTVar modelVar newModel\n\nhandlePathUpdate ::\n  (MonadIO m) =\u003e\n  FilePath -\u003e FilePath -\u003e UM.FileAction () -\u003e m (Map FilePath Text -\u003e Map FilePath Text)\nhandlePathUpdate baseDir path action = do\n  case action of\n    UM.Refresh _ _ -\u003e do\n      s \u003c- decodeUtf8 \u003c$\u003e readFileBS (baseDir \u003c/\u003e path)\n      pure $ Map.insert path s\n    UM.Delete -\u003e do\n      pure $ Map.delete path\n```\n\n### Examples\n\nSee [this example](https://github.com/EmaApps/ema/blob/459d3899e0b9ea13e23c81126279dc62530b994c/src/Ema/Route/Lib/Extra/PandocRoute.hs#L132-L139) illustrating mounting a directory of Markdown files into (effectively) a `Map FilePath String`. A [more involved example](https://github.com/EmaApps/emanote/blob/7c49c73cd3b7dbeace72353574f3decfb68929f2/src/Emanote/Source/Dynamic.hs#L58-L64) from Emanote demonstrates the \"union\" aspect of the library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoficshift%2Funionmount-co-log","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoficshift%2Funionmount-co-log","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoficshift%2Funionmount-co-log/lists"}