module System.FSNotify.Types
( act
, ActionPredicate
, Action
, WatchConfig(..)
, Debounce(..)
, DebounceData(..)
, DebouncePayload
, Event(..)
, EventChannel
, eventPath
, eventTime
, eventIsDirectory
, IOEvent
) where
import Control.Concurrent.Chan
import Data.IORef (IORef)
import Data.Time (NominalDiffTime)
import Data.Time.Clock (UTCTime)
import Prelude hiding (FilePath)
import System.FilePath
data Event =
Added FilePath UTCTime Bool
| Modified FilePath UTCTime Bool
| Removed FilePath UTCTime Bool
| Unknown FilePath UTCTime String
deriving (Event -> Event -> Bool
(Event -> Event -> Bool) -> (Event -> Event -> Bool) -> Eq Event
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Event -> Event -> Bool
$c/= :: Event -> Event -> Bool
== :: Event -> Event -> Bool
$c== :: Event -> Event -> Bool
Eq, Int -> Event -> ShowS
[Event] -> ShowS
Event -> String
(Int -> Event -> ShowS)
-> (Event -> String) -> ([Event] -> ShowS) -> Show Event
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Event] -> ShowS
$cshowList :: [Event] -> ShowS
show :: Event -> String
$cshow :: Event -> String
showsPrec :: Int -> Event -> ShowS
$cshowsPrec :: Int -> Event -> ShowS
Show)
eventPath :: Event -> FilePath
eventPath :: Event -> String
eventPath (Added path :: String
path _ _) = String
path
eventPath (Modified path :: String
path _ _) = String
path
eventPath (Removed path :: String
path _ _) = String
path
eventPath (Unknown path :: String
path _ _) = String
path
eventTime :: Event -> UTCTime
eventTime :: Event -> UTCTime
eventTime (Added _ timestamp :: UTCTime
timestamp _) = UTCTime
timestamp
eventTime (Modified _ timestamp :: UTCTime
timestamp _) = UTCTime
timestamp
eventTime (Removed _ timestamp :: UTCTime
timestamp _) = UTCTime
timestamp
eventTime (Unknown _ timestamp :: UTCTime
timestamp _) = UTCTime
timestamp
eventIsDirectory :: Event -> Bool
eventIsDirectory :: Event -> Bool
eventIsDirectory (Added _ _ isDir :: Bool
isDir) = Bool
isDir
eventIsDirectory (Modified _ _ isDir :: Bool
isDir) = Bool
isDir
eventIsDirectory (Removed _ _ isDir :: Bool
isDir) = Bool
isDir
eventIsDirectory (Unknown _ _ _) = Bool
False
type EventChannel = Chan Event
data WatchConfig = WatchConfig
{ WatchConfig -> Debounce
confDebounce :: Debounce
, WatchConfig -> Int
confPollInterval :: Int
, WatchConfig -> Bool
confUsePolling :: Bool
}
data Debounce
= DebounceDefault
| Debounce NominalDiffTime
| NoDebounce
type IOEvent = IORef Event
data DebounceData = DebounceData NominalDiffTime IOEvent
type DebouncePayload = Maybe DebounceData
type ActionPredicate = Event -> Bool
type Action = Event -> IO ()
act :: ActionPredicate
act :: Event -> Bool
act _ = Bool
True