HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulefsnotify-0.4.4.0Haskell2010

System.FSNotify

This library does not currently report changes made to directories, only files within watched directories.

Minimal example:

{-# LANGUAGE OverloadedStrings #-} -- for FilePath literals

import System.FSNotify
import Control.Concurrent (threadDelay)
import Control.Monad (forever)

main =
  withManager $ \mgr -> do
    -- start a watching job (in the background)
    watchDir
      mgr          -- manager
      "."          -- directory to watch
      (const True) -- predicate
      print        -- action

    -- sleep forever (until interrupted)
    forever $ threadDelay 1000000
Contents
  1. Events
  2. Starting/Stopping
  3. Configuration
  4. Lower level
  5. Watching
Synopsis
  • Packagefsnotify-0.4.4.0
  • Exports23
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceFSNotify.hs

Events

datadata Event

A file event reported by a file watcher. Each event contains the canonical path for the file and a timestamp guaranteed to be after the event occurred (timestamps represent current time when FSEvents receives it from the OS and/or platform-specific Haskell modules).

Instances2Eq, Show
  • Eq EventDefined in fsnotify-0.4.4.0 · System.FSNotify.Types
  • Show EventDefined in fsnotify-0.4.4.0 · System.FSNotify.Types

Starting/Stopping

Start a file watch manager. Directories can only be watched when they are managed by a started watch manager. When finished watching. you must release resources via stopManager. It is preferrable if possible to use withManager to handle this automatically.

Stop a file watch manager. Stopping a watch manager will immediately stop watching for files and free resources.

Configuration

datadata ThreadingMode
#

Constructors

  • SingleThread

    Use a single thread for the entire Manager. Event handler callbacks will run sequentially.

  • ThreadPerWatch

    Use a single thread for each watch (i.e. each call to watchDir, watchTree, etc.). Callbacks within a watch will run sequentially but callbacks from different watches may be interleaved.

  • ThreadPerEvent

    Launch a separate thread for every event handler.

Lower level

Watching