From 4ebdea0354da6116f3de255324db8009ef463dd3 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 28 Sep 2026 09:53:01 -0400 Subject: [PATCH 1/2] Fix --watch crash on new fsnotify event constructors (#679) fsnotify 0.4 added CloseWrite, ModifiedAttributes and WatchedDirectoryRemoved, which mkEventPathRelative did not match, crashing on the first file save. Use a record update on eventPath so all constructors are handled. --- src/Neuron/Reactor.hs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Neuron/Reactor.hs b/src/Neuron/Reactor.hs index 03880086..1819db66 100644 --- a/src/Neuron/Reactor.hs +++ b/src/Neuron/Reactor.hs @@ -216,15 +216,10 @@ watchDirWithDebounce ms dirPath' = do nubByKeepLast f = reverse . nubBy f . reverse mkEventPathRelative :: FilePath -> FSN.Event -> Maybe FSN.Event - mkEventPathRelative baseDir = \case - FSN.Added fp t d -> - mkR fp <&> \p -> FSN.Added p t d - FSN.Modified fp t d -> - mkR fp <&> \p -> FSN.Modified p t d - FSN.Removed fp t d -> - mkR fp <&> \p -> FSN.Removed p t d - FSN.Unknown fp t d e -> - mkR fp <&> \p -> FSN.Unknown p t d e + mkEventPathRelative baseDir fse = + -- Use record update (rather than matching on each constructor), so that + -- new constructors in fsnotify (eg: CloseWrite) are handled. See #679. + mkR (FSN.eventPath fse) <&> \p -> fse {FSN.eventPath = p} where mkR fp = do let rel = makeRelative baseDir fp From 6715c98d892686ef94c34ab7659509c2812b28f3 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 28 Sep 2026 13:27:19 -0400 Subject: [PATCH 2/2] Add changelog entry and bump to 1.9.38.0 --- CHANGELOG.md | 1 + neuron.cabal | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e40d178b..5df12928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Add Apple Silicon (aarch64-darwin) support (#677) - Upgrade to GHC 9.10 (#677) +- Fix `gen --watch` crashing with "Non-exhaustive patterns" on file save (#679) - Web interface - Introducing *impulse* -- foundation for upcoming advanced search, replacing both z-index and legacy JS search (#108) - Remove autoscroll behaviour (which had questionable value to begin with) diff --git a/neuron.cabal b/neuron.cabal index a799c159..5e7dddcd 100644 --- a/neuron.cabal +++ b/neuron.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: neuron -version: 1.9.37.0 +version: 1.9.38.0 license: AGPL-3.0-only copyright: 2020 Sridhar Ratnakumar maintainer: srid@srid.ca