navi-0.1: A utility program for sending system notifications.
Safe HaskellSafe-Inferred
LanguageGHC2021

Navi.Event.Types

Description

This module provides types for defining notification events.

Synopsis

Documentation

data Event result Source #

Event represents sending notifications. An event will:

  1. Query for information (i.e. run a shell command).
  2. Parse the result.
  3. Raise an alert if the result matches some condition.

Constructors

MkEvent 

Fields

Instances

Instances details
(k ~ A_Lens, a ~ ErrorNote, b ~ ErrorNote) => LabelOptic "errorNote" k (Event result) (Event result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (Event result) (Event result) a b Source #

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "name" k (Event result) (Event result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (Event result) (Event result) a b Source #

(k ~ A_Lens, a ~ PollInterval, b ~ PollInterval) => LabelOptic "pollInterval" k (Event result) (Event result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (Event result) (Event result) a b Source #

(k ~ A_Lens, a ~ (result -> Maybe NaviNote), b ~ (result -> Maybe NaviNote)) => LabelOptic "raiseAlert" k (Event result) (Event result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (Event result) (Event result) a b Source #

(k ~ A_Lens, a ~ RepeatEvent result, b ~ RepeatEvent result) => LabelOptic "repeatEvent" k (Event result) (Event result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (Event result) (Event result) a b Source #

(k ~ A_Lens, a ~ ServiceType result, b ~ ServiceType result) => LabelOptic "serviceType" k (Event result) (Event result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (Event result) (Event result) a b Source #

Show (Event result) Source # 
Instance details

Defined in Navi.Event.Types

Methods

showsPrec :: Int -> Event result -> ShowS Source #

show :: Event result -> String Source #

showList :: [Event result] -> ShowS Source #

data AnyEvent where Source #

Existentially quantifies result type on an Event. Used so that we can store different events in the same list.

Constructors

MkAnyEvent :: (Eq result, Show result) => Event result -> AnyEvent 

Instances

Instances details
Show AnyEvent Source # 
Instance details

Defined in Navi.Event.Types

data RepeatEvent a Source #

Determines if we are allowed to send off duplicate notifications simultaneously. If we are not, then NoRepeats holds the last trigger so that we can detect duplicates.

Constructors

NoRepeats !(IORef (Maybe a)) 
AllowRepeats 

Instances

Instances details
Show (RepeatEvent a) Source # 
Instance details

Defined in Navi.Event.Types

_NoRepeats :: forall a a. Prism (RepeatEvent a) (RepeatEvent a) (IORef (Maybe a)) (IORef (Maybe a)) Source #

data ErrorNote Source #

Determines if we should send notifications for errors and, if so, if we allow repeats.

Constructors

NoErrNote 
AllowErrNote !(RepeatEvent ()) 

Instances

Instances details
Show ErrorNote Source # 
Instance details

Defined in Navi.Event.Types

data EventError Source #

Represents an error when querying an Event.

Constructors

MkEventError 

Fields

Instances

Instances details
Exception EventError Source # 
Instance details

Defined in Navi.Event.Types

Show EventError Source # 
Instance details

Defined in Navi.Event.Types

Eq EventError Source # 
Instance details

Defined in Navi.Event.Types

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "long" k EventError EventError a b Source # 
Instance details

Defined in Navi.Event.Types

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "name" k EventError EventError a b Source # 
Instance details

Defined in Navi.Event.Types

(k ~ A_Lens, a ~ Text, b ~ Text) => LabelOptic "short" k EventError EventError a b Source # 
Instance details

Defined in Navi.Event.Types

data EventSuccess result Source #

Holds the Event data used after an event is successfully run.

Since: 0.1

Constructors

MkEventSuccess 

Fields

Instances

Instances details
(k ~ A_Lens, a ~ (result -> Maybe NaviNote), b ~ (result -> Maybe NaviNote)) => LabelOptic "raiseAlert" k (EventSuccess result) (EventSuccess result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (EventSuccess result) (EventSuccess result) a b Source #

(k ~ A_Lens, a ~ RepeatEvent result, b ~ RepeatEvent result) => LabelOptic "repeatEvent" k (EventSuccess result) (EventSuccess result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (EventSuccess result) (EventSuccess result) a b Source #

(k ~ A_Lens, a ~ result, b ~ result) => LabelOptic "result" k (EventSuccess result) (EventSuccess result) a b Source # 
Instance details

Defined in Navi.Event.Types

Methods

labelOptic :: Optic k NoIx (EventSuccess result) (EventSuccess result) a b Source #