Copyright | (c) George Steel 2017 |
---|---|
License | BSD3 |
Maintainer | george.steel@gmail.org |
Safe Haskell | None |
Language | Haskell2010 |
Utility Functions which do not fit anywhere else in the package.
- mapBAsync :: Eq a => Event () -> b -> (a -> b) -> Behavior a -> Now (Behavior b, Behavior Bool)
- beforeE :: Event a -> Event () -> Behavior (Event a)
- setLockedFuturistic :: WidgetClass w => w -> Behavior Bool -> Now ()
- runFileChooserDialog :: FileChooserDialog -> Now (Event (Maybe FilePath))
- checkIOError :: IO a -> IO (Maybe a)
- widgetAddClasses :: (MonadIO m, WidgetClass widget) => [Text] -> widget -> m widget
Documentation
mapBAsync :: Eq a => Event () -> b -> (a -> b) -> Behavior a -> Now (Behavior b, Behavior Bool) Source #
Map an expensive computation over a Behavior
to WHNF in a background thread (force
is useful to get deep evaluation). The output behavior will lag behind the input behavior and thus requires an initial value.
To control the running of the computation, this function also takes an event after which all changes are disregarded (can be provided by getUnrealize
to tie this ti widget lifetimes) and returns a boolean Behavior which indicated if a new result is currently pending.
beforeE :: Event a -> Event () -> Behavior (Event a) Source #
Filter an event so that it only resolves if it does so before a cutoff event.
setLockedFuturistic :: WidgetClass w => w -> Behavior Bool -> Now () Source #
Disable a widget when the condition is true. Does not check the initial state iof the condition and assumes it to be False initially. This isso it can be used inside mfix
where the condition has not been defined yet..
runFileChooserDialog :: FileChooserDialog -> Now (Event (Maybe FilePath)) Source #
Run a FileChooserDialog without blocking and return an Evemnt containing the resulting selected path.
widgetAddClasses :: (MonadIO m, WidgetClass widget) => [Text] -> widget -> m widget Source #
Add CSS classes to a widget.