shortcut-0.1

Safe HaskellSafe
LanguageHaskell98

Control.Shortcut

Synopsis

Documentation

class Shortcutable s where Source #

class of things that can be run in parallel and can be shortcuted. The funtion in parameter is called everytime an intermediate result is known, as soon as it returns True the intermediate results are returned (discarding those not yet available). the order of the lists must be preserved

Minimal complete definition

shortcut

Methods

shortcut :: [s a] -> ([Maybe a] -> Bool) -> s [Maybe a] Source #

shortcut_ :: (Functor s, Shortcutable s) => [s a] -> ([a] -> Bool) -> s [a] Source #

version without the maybes

shortcut2 :: (Functor s, Monad s, Shortcutable s) => [s a] -> [s b] -> ([Maybe a] -> [Maybe b] -> Bool) -> s ([Maybe a], [Maybe b]) Source #

version with two different types of result

shortcut2b :: (Functor s, Monad s, Shortcutable s) => [s a] -> s b -> ([Maybe a] -> Bool -> Bool) -> s ([Maybe a], Bool) Source #

version with a supplementary event which result is discarded

fromLeft :: Either a b -> a Source #

fromRight :: Either a b -> b Source #