pakej-0.2.0.0: Status bar daemon

Safe HaskellNone
LanguageHaskell2010

Pakej.Widget

Contents

Description

Pakej Widgets

Synopsis

Documentation

newtype Widget m l v a b Source

Widget is an Automaton that operates over Monad m collecting results in the mapping l -> v

Constructors

Widget 

Fields

unWidget :: Wire (Timed NominalDiffTime ()) SomeException (StateT (HashMap l (Access v)) m) a b
 

Instances

Monad m => Category * (Widget m l v) 
Monad m => Functor (Widget m l v a) 
Monad m => Applicative (Widget m l v a) 

type PakejWidget = Widget IO Text Text (WidgetConf Integer) Source

A highly monomorphic Widget type used by Pakej itself

fromWire :: Monad n => (forall e m. Monad m => Wire (Timed NominalDiffTime ()) e m a b) -> Widget n l v a b Source

Get a widget from an abstract Wire

Store the result

data Access t Source

Public results are available everywhere, but the private ones are only available for local queries (meaning queries to the local UNIX socket Pakej's listening)

Constructors

Public 

Fields

unAccess :: !t
 
Private 

Fields

unAccess :: !t
 

Instances

Eq t => Eq (Access t) 
Show t => Show (Access t) 

public :: (Eq l, Hashable l, Monad m) => l -> Widget m l v v v Source

Store the Widget's result under the specified label publicly

private :: (Eq l, Hashable l, Monad m) => l -> Widget m l v v v Source

Store the Widget's result under the specified label privately

Combine the results

aggregate :: (Hashable l, Monad m) => [Widget m l v (WidgetConf n) Text] -> Widget m l v (WidgetConf n) Text Source

Aggregate all successful Widget's results

Failed Widget's results are skipped so they do not clutter the resulting value

Construct

text :: (Hashable l, MonadIO m, Integral n) => IO Text -> Widget m l v (WidgetConf n) Text Source

Construct a Widget from the IO action that returns Text

system :: (Hashable l, MonadIO m, Integral n) => IO (ExitCode, Text, Text) -> Widget m l v (WidgetConf n) Text Source

Construct a Widget from the external command.

constant :: (Hashable l, MonadIO m, Integral n) => IO b -> Widget m l v (WidgetConf n) b Source

Construct a Widget from the IO action

widget :: (Hashable l, MonadIO m, Integral n) => a -> (a -> IO a) -> Widget m l v (WidgetConf n) a Source

Construct a Widget from the iterating IO action

Configure

data WidgetConf n Source

Widget configuration

Instances

Eq n => Eq (WidgetConf n) 
Show n => Show (WidgetConf n) 

defaultWidgetConf :: Num n => WidgetConf n Source

The default Widget configuration

every :: (Hashable l, Monad m) => n -> Widget m l v (WidgetConf n) (WidgetConf n) Source

Wait n seconds between Widget updates

second :: Num a => a Source

1 second timeout

minute :: Num a => a Source

1 minute timeout

hour :: Num a => a Source

1 hour timeout

day :: Num a => a Source

1 day timeout

inbetween :: (Hashable l, Monad m) => Text -> Widget m l v (WidgetConf n) (WidgetConf n) Source

Separate Widgets values by some Text

Misc

data PakejException Source

Exceptions that can be thrown while updating Widgets

netwire-4 helpers

mkFix :: Monoid s => (s -> a -> Either e b) -> Wire s e m a b Source

A port of netwire-4's mkFix

mkFixM :: (Monad m, Monoid s) => (s -> a -> m (Either e b)) -> Wire s e m a b Source

A port of netwire-4's mkFixM

mkState :: Monoid t => s -> (t -> (a, s) -> (Either e b, s)) -> Wire t e m a b Source

A port of netwire-4's mkState

mkStateM :: (Monad m, Monoid t) => s -> (t -> (a, s) -> m (Either e b, s)) -> Wire t e m a b Source

A port of netwire-4's mkStateM