-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Lists with a focused element
--   
--   Please see <a>README.md</a>.
@package focuslist
@version 0.1.1.0

module Data.FocusList

-- | A list with a given element having the <a>Focus</a>.
--   
--   <a>FocusList</a> has some invariants that must be protected. You
--   should not use the <a>FocusList</a> constructor or the
--   <a>focusListFocus</a> or <a>focusList</a> accessors.
--   
--   Implemented under the hood as a <a>Seq</a>.
data FocusList a
FocusList :: !Focus -> !Seq a -> FocusList a
[focusListFocus] :: FocusList a -> !Focus
[focusList] :: FocusList a -> !Seq a

-- | Safely create a <a>FocusList</a> from a list.
--   
--   <pre>
--   &gt;&gt;&gt; fromListFL (Focus 1) ["cat","dog","goat"]
--   Just (FocusList (Focus 1) ["cat","dog","goat"])
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromListFL NoFocus []
--   Just (FocusList NoFocus [])
--   </pre>
--   
--   If the <a>Focus</a> is out of range for the list, then <a>Nothing</a>
--   will be returned.
--   
--   <pre>
--   &gt;&gt;&gt; fromListFL (Focus (-1)) ["cat","dog","goat"]
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromListFL (Focus 3) ["cat","dog","goat"]
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromListFL NoFocus ["cat","dog","goat"]
--   Nothing
--   </pre>
--   
--   <i>complexity</i>: <tt>O(n)</tt> where <tt>n</tt> is the length of the
--   input list.
fromListFL :: Focus -> [a] -> Maybe (FocusList a)

-- | Create a <a>FocusList</a> from any <a>Foldable</a> container.
--   
--   This just calls <a>toList</a> on the <a>Foldable</a>, and then passes
--   the result to <a>fromListFL</a>.
--   
--   <pre>
--   fromFoldableFL foc (foldable :: Data.Sequence.Seq Int) == fromListFL foc (toList foldable)
--   </pre>
--   
--   <i>complexity</i>: <tt>O(n)</tt> where <tt>n</tt> is the length of the
--   <a>Foldable</a>
fromFoldableFL :: Foldable f => Focus -> f a -> Maybe (FocusList a)

-- | Get the underlying <a>Seq</a> in a <a>FocusList</a>.
--   
--   <i>complexity</i>: <tt>O(1)</tt>
toSeqFL :: FocusList a -> Seq a

-- | Return the length of a <a>FocusList</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["hello", "bye", "parrot"]
--   
--   &gt;&gt;&gt; lengthFL fl
--   3
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
lengthFL :: FocusList a -> Int

-- | Return <a>True</a> if the <a>FocusList</a> is empty.
--   
--   <pre>
--   &gt;&gt;&gt; isEmptyFL emptyFL
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isEmptyFL $ singletonFL "hello"
--   False
--   </pre>
--   
--   Any <a>FocusList</a> with a <a>Focus</a> should never be empty.
--   
--   <pre>
--   hasFocusFL fl ==&gt; not (isEmptyFL fl)
--   </pre>
--   
--   The opposite is also true.
--   
--   <i>complexity</i>: <tt>O(1)</tt>
isEmptyFL :: FocusList a -> Bool

-- | Get the item the <a>FocusList</a> is focusing on. Return
--   <a>Nothing</a> if the <a>FocusList</a> is empty.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ['a'..'c']
--   
--   &gt;&gt;&gt; getFocusItemFL fl
--   Just 'a'
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getFocusItemFL emptyFL
--   Nothing
--   </pre>
--   
--   This will always return <a>Just</a> if there is a <a>Focus</a>.
--   
--   <pre>
--   hasFocusFL fl ==&gt; isJust (getFocusItemFL fl)
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   the <a>Focus</a>, and <tt>n</tt> is the length of the
--   <a>FocusList</a>.
getFocusItemFL :: FocusList a -> Maybe a

-- | Lookup the element at the specified index, counting from 0.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ['a'..'c']
--   
--   &gt;&gt;&gt; lookupFL 0 fl
--   Just 'a'
--   </pre>
--   
--   Returns <a>Nothing</a> if the index is out of bounds.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ['a'..'c']
--   
--   &gt;&gt;&gt; lookupFL 100 fl
--   Nothing
--   
--   &gt;&gt;&gt; lookupFL (-1) fl
--   Nothing
--   </pre>
--   
--   Always returns <a>Nothing</a> if the <a>FocusList</a> is empty.
--   
--   <pre>
--   lookupFL i emptyFL == Nothing
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   the index you want to look up, and <tt>n</tt> is the length of the
--   <a>FocusList</a>.
lookupFL :: Int -> FocusList a -> Maybe a

-- | Find the index of the first element in the <a>FocusList</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "tree"]
--   
--   &gt;&gt;&gt; indexOfFL "hello" fl
--   Just 0
--   </pre>
--   
--   If more than one element exists, then return the index of the first
--   one.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["dog", "cat", "cat"]
--   
--   &gt;&gt;&gt; indexOfFL "cat" fl
--   Just 1
--   </pre>
--   
--   If the element doesn't exist, then return <a>Nothing</a>
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["foo", "bar", "baz"]
--   
--   &gt;&gt;&gt; indexOfFL "hogehoge" fl
--   Nothing
--   </pre>
indexOfFL :: Eq a => a -> FocusList a -> Maybe Int

-- | Find a value in a <a>FocusList</a>. Similar to
--   <tt>Data.List.<a>find</a></tt>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "tree"]
--   
--   &gt;&gt;&gt; findFL (\a -&gt; a == "hello") fl
--   Just "hello"
--   </pre>
--   
--   This will only find the first value.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ["hello", "bye", "bye"]
--   
--   &gt;&gt;&gt; findFL (\a -&gt; a == "bye") fl
--   Just "bye"
--   </pre>
--   
--   If no values match the comparison, this will return <a>Nothing</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "parrot"]
--   
--   &gt;&gt;&gt; findFL (\a -&gt; a == "ball") fl
--   Nothing
--   </pre>
--   
--   <i>complexity</i>: <tt>O(n)</tt> where <tt>n</tt> is the length of the
--   <a>FocusList</a>.
findFL :: (a -> Bool) -> FocusList a -> Maybe a

-- | Return <a>True</a> if the <a>Focus</a> in a <a>FocusList</a> exists.
--   
--   Return <a>False</a> if the <a>Focus</a> in a <a>FocusList</a> is
--   <a>NoFocus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; hasFocusFL $ singletonFL "hello"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; hasFocusFL emptyFL
--   False
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
hasFocusFL :: FocusList a -> Bool

-- | Get the <a>Focus</a> from a <a>FocusList</a>.
--   
--   <pre>
--   &gt;&gt;&gt; getFocusFL $ singletonFL "hello"
--   Focus 0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 3) [0..9]
--   
--   &gt;&gt;&gt; getFocusFL fl
--   Focus 3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getFocusFL emptyFL
--   NoFocus
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
getFocusFL :: FocusList a -> Focus

-- | Prepend a value to a <a>FocusList</a>.
--   
--   This can be thought of as a "cons" operation.
--   
--   <pre>
--   &gt;&gt;&gt; prependFL "hello" emptyFL
--   FocusList (Focus 0) ["hello"]
--   </pre>
--   
--   The focus will be updated when prepending:
--   
--   <pre>
--   &gt;&gt;&gt; prependFL "bye" (singletonFL "hello")
--   FocusList (Focus 1) ["bye","hello"]
--   </pre>
--   
--   Prepending to a <a>FocusList</a> will always update the <a>Focus</a>:
--   
--   <pre>
--   getFocusFL fl &lt; getFocusFL (prependFL a fl)
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
prependFL :: a -> FocusList a -> FocusList a

-- | Append a value to the end of a <a>FocusList</a>.
--   
--   This can be thought of as a "snoc" operation.
--   
--   <pre>
--   &gt;&gt;&gt; appendFL emptyFL "hello"
--   FocusList (Focus 0) ["hello"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; appendFL (singletonFL "hello") "bye"
--   FocusList (Focus 0) ["hello","bye"]
--   </pre>
--   
--   Appending a value to an empty <a>FocusList</a> is the same as using
--   <a>singletonFL</a>.
--   
--   <pre>
--   appendFL emptyFL a == singletonFL a
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log n)</tt> where <tt>n</tt> is the length of
--   the <a>FocusList</a>.
appendFL :: FocusList a -> a -> FocusList a

-- | A combination of <a>appendFL</a> and <a>setFocusFL</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "tree"]
--   
--   &gt;&gt;&gt; appendSetFocusFL fl "pie"
--   FocusList (Focus 3) ["hello","bye","tree","pie"]
--   </pre>
--   
--   The <a>Focus</a> will always be updated after calling
--   <a>appendSetFocusFL</a>.
--   
--   <pre>
--   getFocusFL (appendSetFocusFL fl a) &gt; getFocusFL fl
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log n)</tt> where <tt>n</tt> is the length of
--   the <a>FocusList</a>.
appendSetFocusFL :: FocusList a -> a -> FocusList a

-- | Insert a new value into the <a>FocusList</a>. The <a>Focus</a> of the
--   list is changed appropriately.
--   
--   Inserting an element into an empty <a>FocusList</a> will set the
--   <a>Focus</a> on that element.
--   
--   <pre>
--   &gt;&gt;&gt; insertFL 0 "hello" emptyFL
--   FocusList (Focus 0) ["hello"]
--   </pre>
--   
--   The <a>Focus</a> will not be changed if you insert a new element after
--   the current <a>Focus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; insertFL 1 "hello" (singletonFL "bye")
--   FocusList (Focus 0) ["bye","hello"]
--   </pre>
--   
--   The <a>Focus</a> will be bumped up by one if you insert a new element
--   before the current <a>Focus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; insertFL 0 "hello" (singletonFL "bye")
--   FocusList (Focus 1) ["hello","bye"]
--   </pre>
--   
--   Behaves like <tt>Data.Sequence.<a>insertAt</a></tt>. If the index is
--   out of bounds, it will be inserted at the nearest available index
--   
--   <pre>
--   &gt;&gt;&gt; insertFL 100 "hello" emptyFL
--   FocusList (Focus 0) ["hello"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; insertFL 100 "bye" (singletonFL "hello")
--   FocusList (Focus 0) ["hello","bye"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; insertFL (-1) "bye" (singletonFL "hello")
--   FocusList (Focus 1) ["bye","hello"]
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   the index you want to insert at, and <tt>n</tt> is the length of the
--   <a>FocusList</a>.
insertFL :: Int -> a -> FocusList a -> FocusList a

-- | Remove an element from a <a>FocusList</a>.
--   
--   If the element to remove is not the <a>Focus</a>, then update the
--   <a>Focus</a> accordingly.
--   
--   For example, if the <a>Focus</a> is on index 1, and we have removed
--   index 2, then the focus is not affected, so it is not changed.
--   
--   <pre>
--   &gt;&gt;&gt; let focusList = unsafeFromListFL (Focus 1) ["cat","goat","dog","hello"]
--   
--   &gt;&gt;&gt; removeFL 2 focusList
--   Just (FocusList (Focus 1) ["cat","goat","hello"])
--   </pre>
--   
--   If the <a>Focus</a> is on index 2 and we have removed index 1, then
--   the <a>Focus</a> will be moved back one element to set to index 1.
--   
--   <pre>
--   &gt;&gt;&gt; let focusList = unsafeFromListFL (Focus 2) ["cat","goat","dog","hello"]
--   
--   &gt;&gt;&gt; removeFL 1 focusList
--   Just (FocusList (Focus 1) ["cat","dog","hello"])
--   </pre>
--   
--   If we remove the <a>Focus</a>, then the next item is set to have the
--   <a>Focus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let focusList = unsafeFromListFL (Focus 0) ["cat","goat","dog","hello"]
--   
--   &gt;&gt;&gt; removeFL 0 focusList
--   Just (FocusList (Focus 0) ["goat","dog","hello"])
--   </pre>
--   
--   If the element to remove is the only element in the list, then the
--   <a>Focus</a> will be set to <a>NoFocus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let focusList = unsafeFromListFL (Focus 0) ["hello"]
--   
--   &gt;&gt;&gt; removeFL 0 focusList
--   Just (FocusList NoFocus [])
--   </pre>
--   
--   If the <a>Int</a> for the index to remove is either less than 0 or
--   greater then the length of the list, then <a>Nothing</a> is returned.
--   
--   <pre>
--   &gt;&gt;&gt; let focusList = unsafeFromListFL (Focus 0) ["hello"]
--   
--   &gt;&gt;&gt; removeFL (-1) focusList
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; let focusList = unsafeFromListFL (Focus 1) ["hello","bye","cat"]
--   
--   &gt;&gt;&gt; removeFL 3 focusList
--   Nothing
--   </pre>
--   
--   If the <a>FocusList</a> passed in is <a>Empty</a>, then <a>Nothing</a>
--   is returned.
--   
--   <pre>
--   &gt;&gt;&gt; removeFL 0 emptyFL
--   Nothing
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   index of the element to remove, and <tt>n</tt> is the length of the
--   <a>FocusList</a>.
removeFL :: Int -> FocusList a -> Maybe (FocusList a)

-- | Delete an element from a <a>FocusList</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ["hello", "bye", "tree"]
--   
--   &gt;&gt;&gt; deleteFL "bye" fl
--   FocusList (Focus 0) ["hello","tree"]
--   </pre>
--   
--   The focus will be updated if an item before it is deleted.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "tree"]
--   
--   &gt;&gt;&gt; deleteFL "hello" fl
--   FocusList (Focus 0) ["bye","tree"]
--   </pre>
--   
--   If there are multiple matching elements in the <a>FocusList</a>,
--   remove them all.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ["hello", "bye", "bye"]
--   
--   &gt;&gt;&gt; deleteFL "bye" fl
--   FocusList (Focus 0) ["hello"]
--   </pre>
--   
--   If there are no matching elements, return the original
--   <a>FocusList</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["hello", "good", "bye"]
--   
--   &gt;&gt;&gt; deleteFL "frog" fl
--   FocusList (Focus 2) ["hello","good","bye"]
--   </pre>
deleteFL :: Eq a => a -> FocusList a -> FocusList a

-- | Move an existing item in a <a>FocusList</a> to a new index.
--   
--   The <a>Focus</a> gets updated appropriately when moving items.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "parrot"]
--   
--   &gt;&gt;&gt; moveFromToFL 0 1 fl
--   Just (FocusList (Focus 0) ["bye","hello","parrot"])
--   </pre>
--   
--   The <a>Focus</a> may not get updated if it is not involved.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ["hello", "bye", "parrot"]
--   
--   &gt;&gt;&gt; moveFromToFL 1 2 fl
--   Just (FocusList (Focus 0) ["hello","parrot","bye"])
--   </pre>
--   
--   If the element with the <a>Focus</a> is moved, then the <a>Focus</a>
--   will be updated appropriately.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["hello", "bye", "parrot"]
--   
--   &gt;&gt;&gt; moveFromToFL 2 0 fl
--   Just (FocusList (Focus 0) ["parrot","hello","bye"])
--   </pre>
--   
--   If the index of the item to move is out bounds, then <a>Nothing</a>
--   will be returned.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["hello", "bye", "parrot"]
--   
--   &gt;&gt;&gt; moveFromToFL 3 0 fl
--   Nothing
--   </pre>
--   
--   If the new index is out of bounds, then <a>Nothing</a> wil be
--   returned.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["hello", "bye", "parrot"]
--   
--   &gt;&gt;&gt; moveFromToFL 1 (-1) fl
--   Nothing
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log n)</tt> where <tt>n</tt> is the length of
--   the <a>FocusList</a>.
moveFromToFL :: Show a => Int -> Int -> FocusList a -> Maybe (FocusList a)

-- | Intersperse a new element between existing elements in the
--   <a>FocusList</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ["hello", "bye", "cat"]
--   
--   &gt;&gt;&gt; intersperseFL "foo" fl
--   FocusList (Focus 0) ["hello","foo","bye","foo","cat"]
--   </pre>
--   
--   The <a>Focus</a> is updated accordingly.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["hello", "bye", "cat", "goat"]
--   
--   &gt;&gt;&gt; intersperseFL "foo" fl
--   FocusList (Focus 4) ["hello","foo","bye","foo","cat","foo","goat"]
--   </pre>
--   
--   The item with the <a>Focus</a> should never change after calling
--   <a>intersperseFL</a>.
--   
--   <pre>
--   getFocusItemFL (fl :: FocusList Int) == getFocusItemFL (intersperseFL a fl)
--   </pre>
--   
--   <a>intersperseFL</a> should not have any effect on a <a>FocusList</a>
--   with less than two items.
--   
--   <pre>
--   emptyFL == intersperseFL x emptyFL
--   </pre>
--   
--   <pre>
--   singletonFL a == intersperseFL x (singletonFL a)
--   </pre>
--   
--   <i>complexity</i>: <tt>O(n)</tt> where <tt>n</tt> is the length of the
--   <a>FocusList</a>.
intersperseFL :: a -> FocusList a -> FocusList a

-- | Reverse a <a>FocusList</a>. The <a>Focus</a> is updated accordingly.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ["hello", "bye", "cat"]
--   
--   &gt;&gt;&gt; reverseFL fl
--   FocusList (Focus 2) ["cat","bye","hello"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["hello", "bye", "cat", "goat"]
--   
--   &gt;&gt;&gt; reverseFL fl
--   FocusList (Focus 1) ["goat","cat","bye","hello"]
--   </pre>
--   
--   The item with the <a>Focus</a> should never change after calling
--   <a>intersperseFL</a>.
--   
--   <pre>
--   getFocusItemFL (fl :: FocusList Int) == getFocusItemFL (reverseFL fl)
--   </pre>
--   
--   Reversing twice should not change anything.
--   
--   <pre>
--   (fl :: FocusList Int) == reverseFL (reverseFL fl)
--   </pre>
--   
--   Reversing empty lists and single lists should not do anything.
--   
--   <pre>
--   emptyFL == reverseFL emptyFL
--   </pre>
--   
--   <pre>
--   singletonFL a == reverseFL (singletonFL a)
--   </pre>
--   
--   <i>complexity</i>: <tt>O(n)</tt> where <tt>n</tt> is the length of the
--   <a>FocusList</a>.
reverseFL :: FocusList a -> FocusList a

-- | Update the item the <a>FocusList</a> is focusing on. Do nothing if the
--   <a>FocusList</a> is empty.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) [10, 20, 30]
--   
--   &gt;&gt;&gt; updateFocusItemFL (\a -&gt; a + 5) fl
--   FocusList (Focus 1) [10,25,30]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; updateFocusItemFL (\a -&gt; a * 100) emptyFL
--   FocusList NoFocus []
--   </pre>
--   
--   Note: this function forces the updated item. The following throws an
--   exception from <a>undefined</a> even though we updated the focused
--   item at index 1, but lookup the item at index 0.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) [10, 20, 30]
--   
--   &gt;&gt;&gt; let newFl = updateFocusItemFL (const undefined) fl
--   
--   &gt;&gt;&gt; lookupFL 0 newFl
--   *** Exception: ...
--   ...
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   the <a>Focus</a>, and <tt>n</tt> is the length of the
--   <a>FocusList</a>.
updateFocusItemFL :: (a -> a) -> FocusList a -> FocusList a

-- | Set the item the <a>FocusList</a> is focusing on.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) [10, 20, 30]
--   
--   &gt;&gt;&gt; setFocusItemFL 0 fl
--   FocusList (Focus 1) [10,0,30]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; setFocusItemFL "hello" emptyFL
--   FocusList NoFocus []
--   </pre>
--   
--   Note: this function forces the updated item. The following throws an
--   exception from <a>undefined</a> even though we updated the focused
--   item at index 1, but lookup the item at index 0.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) [10, 20, 30]
--   
--   &gt;&gt;&gt; let newFl = setFocusItemFL undefined fl
--   
--   &gt;&gt;&gt; lookupFL 0 newFl
--   *** Exception: ...
--   ...
--   </pre>
--   
--   This is a specialization of <a>updateFocusItemFL</a>:
--   
--   <pre>
--   updateFocusItemFL (const a) fl == setFocusItemFL a fl
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   the <a>Focus</a>, and <tt>n</tt> is the length of the
--   <a>FocusList</a>.
setFocusItemFL :: a -> FocusList a -> FocusList a

-- | A <tt>Traversal</tt> for the focused item in a <a>FocusList</a>.
--   
--   This can be used to get the focused item:
--   
--   <pre>
--   &gt;&gt;&gt; import Control.Lens ((^?))
--   
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "tree"]
--   
--   &gt;&gt;&gt; fl ^? traversalFocusItem
--   Just "bye"
--   
--   &gt;&gt;&gt; emptyFL ^? traversalFocusItem
--   Nothing
--   </pre>
--   
--   This can also be used to set the focused item:
--   
--   <pre>
--   &gt;&gt;&gt; import Control.Lens (set)
--   
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) ["hello", "bye", "tree"]
--   
--   &gt;&gt;&gt; set traversalFocusItem "new val" fl
--   FocusList (Focus 1) ["hello","new val","tree"]
--   
--   &gt;&gt;&gt; set traversalFocusItem "new val" emptyFL
--   FocusList NoFocus []
--   </pre>
--   
--   Note that this traversal will apply to no elements if the
--   <a>FocusList</a> is empty and <a>NoFocus</a>. This traversal will
--   apply to a single element if the <a>FocusList</a> has a <a>Focus</a>.
--   This makes <a>traversalFocusItem</a> an affine traversal.
--   
--   <pre>
--   length (fl ^.. traversalFocusItem) &lt;= 1
--   </pre>
traversalFocusItem :: forall a f. Applicative f => (a -> f a) -> FocusList a -> f (FocusList a)

-- | Set the <a>Focus</a> for a <a>FocusList</a>.
--   
--   This is just like <a>updateFocusFL</a>, but doesn't return the newly
--   focused item.
--   
--   <pre>
--   setFocusFL i fl == fmap snd (updateFocusFL i fl)
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
setFocusFL :: Int -> FocusList a -> Maybe (FocusList a)

-- | Update the <a>Focus</a> for a <a>FocusList</a> and get the new focused
--   element.
--   
--   <pre>
--   &gt;&gt;&gt; updateFocusFL 1 =&lt;&lt; fromListFL (Focus 2) ["hello","bye","dog","cat"]
--   Just ("bye",FocusList (Focus 1) ["hello","bye","dog","cat"])
--   </pre>
--   
--   If the <a>FocusList</a> is empty, then return <a>Nothing</a>.
--   
--   <pre>
--   &gt;&gt;&gt; updateFocusFL 1 emptyFL
--   Nothing
--   </pre>
--   
--   If the new focus is less than 0, or greater than or equal to the
--   length of the <a>FocusList</a>, then return <a>Nothing</a>.
--   
--   <pre>
--   &gt;&gt;&gt; updateFocusFL (-1) =&lt;&lt; fromListFL (Focus 2) ["hello","bye","dog","cat"]
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; updateFocusFL 4 =&lt;&lt; fromListFL (Focus 2) ["hello","bye","dog","cat"]
--   Nothing
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   the new index to put the <a>Focus</a> on, and <tt>n</tt> -- is the
--   length of the <a>FocusList</a>.
updateFocusFL :: Int -> FocusList a -> Maybe (a, FocusList a)

-- | Sort a <a>FocusList</a>.
--   
--   The <a>Focus</a> will stay with the element that has the <a>Focus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 2) ["b", "c", "a"]
--   
--   &gt;&gt;&gt; sortByFL compare fl
--   FocusList (Focus 0) ["a","b","c"]
--   </pre>
--   
--   Nothing will happen if you try to sort an empty <a>FocusList</a>, or a
--   <a>FocusList</a> with only one element.
--   
--   <pre>
--   emptyFL == sortByFL compare emptyFL
--   </pre>
--   
--   <pre>
--   singletonFL a == sortByFL compare (singletonFL a)
--   </pre>
--   
--   The element with the <a>Focus</a> should be the same before and after
--   sorting.
--   
--   <pre>
--   getFocusItemFL (fl :: FocusList Int) == getFocusItemFL (sortByFL compare fl)
--   </pre>
--   
--   Sorting a <a>FocusList</a> and getting the underlying <a>Seq</a>
--   should be the same as getting the underlying <a>Seq</a> and then
--   sorting it.
--   
--   <pre>
--   toSeqFL (sortByFL compare (fl :: FocusList Int)) == sortBy compare (toSeqFL fl)
--   </pre>
--   
--   <b>WARNING</b>: The computational complexity for this is very bad. It
--   should be able to be done in <tt>O(n * log n)</tt>, but the current
--   implementation is <tt>O(n^2)</tt> (or worse), where <tt>n</tt> is the
--   length of the <a>FocusList</a>. This function could be implemented the
--   same way <tt>Data.Sequence.<a>sortBy</a></tt> is implemented. However,
--   a small change needs to be added to that function to keep track of the
--   <a>Focus</a> in the <a>FocusList</a> and make sure it gets updated
--   properly. If you're interested in fixing this, please send a PR.
sortByFL :: (a -> a -> Ordering) -> FocusList a -> FocusList a

-- | Create an empty <a>FocusList</a> without a <a>Focus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; emptyFL
--   FocusList NoFocus []
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
emptyFL :: FocusList a

-- | Create a <a>FocusList</a> with a single element.
--   
--   <pre>
--   &gt;&gt;&gt; singletonFL "hello"
--   FocusList (Focus 0) ["hello"]
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
singletonFL :: a -> FocusList a

-- | Unsafely create a <a>FocusList</a>. This does not check that the focus
--   actually exists in the list. This is an internal function and should
--   generally not be used. It is only safe to use if you ALREADY know the
--   <a>Focus</a> is within the list.
--   
--   Instead, you should generally use <a>fromListFL</a>.
--   
--   The following is an example of using <a>unsafeFromListFL</a>
--   correctly.
--   
--   <pre>
--   &gt;&gt;&gt; unsafeFromListFL (Focus 1) [0..2]
--   FocusList (Focus 1) [0,1,2]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeFromListFL NoFocus []
--   FocusList NoFocus []
--   </pre>
--   
--   <a>unsafeFromListFL</a> can also be used uncorrectly. The following is
--   an example of <a>unsafeFromListFL</a> allowing you to create a
--   <a>FocusList</a> that does not pass <a>invariantFL</a>.
--   
--   <pre>
--   &gt;&gt;&gt; unsafeFromListFL (Focus 100) [0..2]
--   FocusList (Focus 100) [0,1,2]
--   </pre>
--   
--   If <a>fromListFL</a> returns a <a>Just</a> <a>FocusList</a>, then
--   <a>unsafeFromListFL</a> should return the same <a>FocusList</a>.
--   
--   <i>complexity</i>: <tt>O(n)</tt> where <tt>n</tt> is the length of the
--   input list.
unsafeFromListFL :: Focus -> [a] -> FocusList a

-- | Unsafely get the <a>Focus</a> from a <a>FocusList</a>. If the
--   <a>Focus</a> is <a>NoFocus</a>, this function returns <a>error</a>.
--   
--   This function is only safe if you already have knowledge that the
--   <a>FocusList</a> has a <a>Focus</a>.
--   
--   Generally, <a>getFocusFL</a> should be used instead of this function.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 1) [0..9]
--   
--   &gt;&gt;&gt; unsafeGetFocusFL fl
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeGetFocusFL emptyFL
--   *** Exception: ...
--   ...
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
unsafeGetFocusFL :: FocusList a -> Int

-- | Unsafely get the value of the <a>Focus</a> from a <a>FocusList</a>. If
--   the <a>Focus</a> is <a>NoFocus</a>, this function returns
--   <a>error</a>.
--   
--   This function is only safe if you already have knowledge that the
--   <a>FocusList</a> has a <a>Focus</a>.
--   
--   Generally, <a>getFocusItemFL</a> should be used instead of this
--   function.
--   
--   <pre>
--   &gt;&gt;&gt; let Just fl = fromListFL (Focus 0) ['a'..'c']
--   
--   &gt;&gt;&gt; unsafeGetFocusItemFL fl
--   'a'
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeGetFocusFL emptyFL
--   *** Exception: ...
--   ...
--   </pre>
--   
--   <i>complexity</i>: <tt>O(log(min(i, n - i)))</tt> where <tt>i</tt> is
--   the <a>Focus</a>, and <tt>n</tt> is the length of the
--   <a>FocusList</a>.
unsafeGetFocusItemFL :: FocusList a -> a

-- | This is an invariant that the <a>FocusList</a> must always protect.
--   
--   The functions in this module should generally protect this invariant.
--   If they do not, it is generally a bug.
--   
--   The invariants are as follows:
--   
--   <ul>
--   <li>The <a>Focus</a> in a <a>FocusList</a> can never be negative.</li>
--   <li>If there is a <a>Focus</a>, then it actually exists in the
--   <a>FocusList</a>.</li>
--   <li>There needs to be a <a>Focus</a> if the length of the
--   <a>FocusList</a> is greater than 0.</li>
--   </ul>
--   
--   <i>complexity</i>: <tt>O(log n)</tt>, where <tt>n</tt> is the length
--   of the <a>FocusList</a>.
invariantFL :: FocusList a -> Bool

-- | Given a <a>Gen</a> for <tt>a</tt>, generate a valid <a>FocusList</a>.
genValidFL :: Gen a -> Gen (FocusList a)
lensFocusListFocus :: forall a f. Functor f => (Focus -> f Focus) -> FocusList a -> f (FocusList a)
lensFocusList :: forall a1 a2 f. Functor f => (Seq a1 -> f (Seq a2)) -> FocusList a1 -> f (FocusList a2)

-- | A <a>Focus</a> for the <a>FocusList</a>.
--   
--   The <a>Focus</a> is either <a>NoFocus</a> (if the <tt>Focuslist</tt>
--   is empty), or <a>Focus</a> <a>Int</a> to represent focusing on a
--   specific element of the <a>FocusList</a>.
data Focus
Focus :: {-# UNPACK #-} !Int -> Focus
NoFocus :: Focus

-- | Returns <a>True</a> if a <a>Focus</a> exists, and <a>False</a> if not.
--   
--   <pre>
--   &gt;&gt;&gt; hasFocus (Focus 0)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; hasFocus NoFocus
--   False
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
hasFocus :: Focus -> Bool

-- | Get the focus index from a <a>Focus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; getFocus (Focus 3)
--   Just 3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getFocus NoFocus
--   Nothing
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
getFocus :: Focus -> Maybe Int

-- | Convert a <a>Maybe</a> <a>Int</a> to a <a>Focus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; maybeToFocus (Just 100)
--   Focus 100
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; maybeToFocus Nothing
--   NoFocus
--   </pre>
--   
--   <a>maybeToFocus</a> and <a>getFocus</a> witness an isomorphism.
--   
--   <pre>
--   focus == maybeToFocus (getFocus focus)
--   </pre>
--   
--   <pre>
--   maybeInt == getFocus (maybeToFocus maybeInt)
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
maybeToFocus :: Maybe Int -> Focus

-- | A fold function for <a>Focus</a>.
--   
--   This is similar to <a>maybe</a> for <a>Maybe</a>.
--   
--   <pre>
--   &gt;&gt;&gt; foldFocus "empty" (\i -&gt; "focus at " &lt;&gt; show i) (Focus 3)
--   "focus at 3"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; foldFocus Nothing Just NoFocus
--   Nothing
--   </pre>
--   
--   <pre>
--   foldFocus NoFocus Focus focus == focus
--   </pre>
foldFocus :: b -> (Int -> b) -> Focus -> b

-- | A <a>Prism'</a> for focusing on the <a>Focus</a> constructor in a
--   <a>Focus</a> data type.
--   
--   You can use this to get the <a>Int</a> that is being focused on:
--   
--   <pre>
--   &gt;&gt;&gt; import Control.Lens ((^?))
--   
--   &gt;&gt;&gt; Focus 100 ^? _Focus
--   Just 100
--   
--   &gt;&gt;&gt; NoFocus ^? _Focus
--   Nothing
--   </pre>
_Focus :: Prism' Focus Int

-- | A <a>Prism'</a> for focusing on the <a>NoFocus</a> constructor in a
--   <a>Focus</a> data type.
--   
--   <pre>
--   &gt;&gt;&gt; import Control.Lens.Extras (is)
--   
--   &gt;&gt;&gt; is _NoFocus NoFocus
--   True
--   
--   &gt;&gt;&gt; is _NoFocus (Focus 3)
--   False
--   </pre>
_NoFocus :: Prism' Focus ()

-- | Unsafely get the focus index from a <a>Focus</a>.
--   
--   Returns an error if <a>NoFocus</a>.
--   
--   <pre>
--   &gt;&gt;&gt; unsafeGetFocus (Focus 50)
--   50
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeGetFocus NoFocus
--   *** Exception: ...
--   ...
--   </pre>
--   
--   <i>complexity</i>: <tt>O(1)</tt>
unsafeGetFocus :: Focus -> Int
instance Test.QuickCheck.Arbitrary.Arbitrary1 Data.FocusList.FocusList
instance Test.QuickCheck.Arbitrary.Arbitrary Data.FocusList.Focus
instance Test.QuickCheck.Arbitrary.Arbitrary a => Test.QuickCheck.Arbitrary.Arbitrary (Data.FocusList.FocusList a)
instance Test.QuickCheck.Arbitrary.CoArbitrary Data.FocusList.Focus
instance Test.QuickCheck.Arbitrary.CoArbitrary a => Test.QuickCheck.Arbitrary.CoArbitrary (Data.FocusList.FocusList a)
instance GHC.Classes.Eq Data.FocusList.Focus
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.FocusList.FocusList a)
instance GHC.Internal.Data.Foldable.Foldable Data.FocusList.FocusList
instance GHC.Internal.Base.Functor Data.FocusList.FocusList
instance GHC.Internal.Generics.Generic Data.FocusList.Focus
instance GHC.Internal.Generics.Generic (Data.FocusList.FocusList a)
instance Data.MonoTraversable.GrowingAppend (Data.FocusList.FocusList a)
instance Data.MonoTraversable.MonoFoldable (Data.FocusList.FocusList a)
instance Data.MonoTraversable.MonoFunctor (Data.FocusList.FocusList a)
instance Data.MonoTraversable.MonoTraversable (Data.FocusList.FocusList a)
instance GHC.Classes.Ord Data.FocusList.Focus
instance GHC.Internal.Read.Read Data.FocusList.Focus
instance Data.Sequences.SemiSequence (Data.FocusList.FocusList a)
instance GHC.Internal.Show.Show Data.FocusList.Focus
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.FocusList.FocusList a)
instance GHC.Internal.Data.Traversable.Traversable Data.FocusList.FocusList
