ref: 4161ae98a0bd95edcd9a8f48c5daf019dd7164bb misc/reflex-gl-demo/src/Reflex/FSNotify.hs -rw-r--r-- 377 bytes View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
{-# LANGUAGE GADTs           #-}

module Reflex.FSNotify (watchDir) where

import           Reflex
import qualified System.FSNotify as FS

watchDir
  :: TriggerEvent t m
  => FS.WatchManager -> FilePath -> m (Event t FS.Event)
watchDir manager path = newEventWithLazyTriggerWithOnComplete $ \fire ->
  FS.watchDir manager path (\_ -> True) (\fsEvent -> fire fsEvent (pure ()))