Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Functions that brick event handlers can use to move up or down while skipping a certain kind of elements.
For example, in the above demo program, you can move in the list while skipping separators.
Synopsis
- data Dir
- data Amount
- data Move
- listSkip :: (Foldable t, Splittable t, Searchable t, Ord n) => (e -> Bool) -> Move -> EventM n (GenericList n t e) ()
- listSearchFromCurrent :: Searchable t => (e -> Bool) -> Dir -> EventM n (GenericList n t e) ()
- listShow :: Searchable t => (e -> Bool) -> Dir -> EventM n (GenericList n t e) ()
- class Searchable (t :: * -> *) where
Types
The direction to move in
The amount to move by
One | Move to the next element that fails the test. |
Most | Move forward or backward as much as possible, and start searching in the opposite direction. |
Page | Move by one page. From there, start searching. If the search fails, start searching in the opposite direction. |
HalfPage | Move by half page. From there, start searching. If the search fails, start searching in the opposite direction. |
Description of a movement
Functions
:: (Foldable t, Splittable t, Searchable t, Ord n) | |
=> (e -> Bool) | The test |
-> Move | |
-> EventM n (GenericList n t e) () |
listSearchFromCurrent Source #
:: Searchable t | |
=> (e -> Bool) | The test |
-> Dir | |
-> EventM n (GenericList n t e) () |
From the current element, search for an element that fails the test, and go to it.
:: Searchable t | |
=> (e -> Bool) | The test |
-> Dir | |
-> EventM n (GenericList n t e) () |
If searching for an element that fails the test in the specified direction fails, show as many elements as possible in the direction.
The current element is not included in the search.
Classes
class Searchable (t :: * -> *) where Source #
Functions for searching elements.
viewHead :: t a -> Maybe (a, t a) Source #
Get the head and the rest
viewLast :: t a -> Maybe (t a, a) Source #
Get the last element and the rest
take :: Int -> t a -> t a Source #
Take a number of elements from the beginning
drop :: Int -> t a -> t a Source #
Drop a number of elements from the beginning
Instances
Searchable Seq Source # | O(1) for viewHead and viewLast. O(log(min(i,n-i))) for take and drop. |
Searchable Vector Source # | O(1) for all operations |