core-program-0.2.2.0: Opinionated Haskell Interoperability

Safe HaskellNone
LanguageHaskell2010

Core.Program.Notify

Contents

Description

Helpers for watching files for changes and taking action in the event of a change.

Synopsis

Notify

waitForChange :: [FilePath] -> Program τ () Source #

Watch for changes to a given list of files.

Ideally we'd just set up inotifies on these individual files, but that doesn't work when programs like vim move the original file, save a new one, then delete the renamed original. From previous work we know that CLOSE_WRITE is emitted reliably through these sequences, so we can just check to see if a that happens on a filename we care about (rather then the original inodes those files were stored in).

Before continuing we insert a 100ms pause to allow whatever the editor was to finish its write and switcheroo sequence.