yi-language-0.19.2: Collection of language-related Yi libraries.

License | GPL-2
Maintainer | yi-devel@googlegroups.com
Stability | experimental
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Extensions

- FlexibleContexts
- ConstrainedClassMethods
- MultiParamTypeClasses
- FunctionalDependencies

Yi.Utils

Contents

- Orphan instances

Description

Various utility functions and instances used throughout Yi. Some of the functions from the now-removed Yi.Prelude found a new home here.

Synopsis

- io :: MonadBase IO m => IO a -> m a
- fst3 :: (a, b, c) -> a
- snd3 :: (a, b, c) -> b
- trd3 :: (a, b, c) -> c
- class SemiNum absolute relative | absolute -> relative where
  - (+~) :: absolute -> relative -> absolute
  - (-~) :: absolute -> relative -> absolute
  - (~-) :: absolute -> absolute -> relative
- nubSet :: Ord a => [a] -> [a]
- mapAdjust' :: Ord k => (a -> a) -> k -> Map k a -> Map k a
- mapFromFoldable :: (Foldable t, Ord k) => t (k, a) -> Map k a
- groupBy' :: (a -> a -> Bool) -> [a] -> [[a]]
- chain :: (a -> a -> Bool) -> [a] -> ([a], [a])
- commonPrefix :: Eq a => [[a]] -> [a]
- findPL :: (a -> Bool) -> [a] -> Maybe (PointedList a)
- swapFocus :: (PointedList a -> PointedList a) -> PointedList a -> PointedList a
- makeClassyWithSuffix :: String -> Name -> Q [Dec]
- addSuffix :: Name -> String -> [DefName]
- makeLensesWithSuffix :: String -> Name -> Q [Dec]

# Documentation

io :: MonadBase IO m => IO a -> m a Source #

fst3 :: (a, b, c) -> a Source #

snd3 :: (a, b, c) -> b Source #

trd3 :: (a, b, c) -> c Source #

class SemiNum absolute relative | absolute -> relative where Source #

Methods

(+~) :: absolute -> relative -> absolute Source #

(-~) :: absolute -> relative -> absolute Source #

(~-) :: absolute -> absolute -> relative Source #

#### Instances

Instances details

SemiNum Point Size Source # |
Instance details Defined in Yi.Buffer.Basic Methods (+~) :: Point -> Size -> Point Source # (-~) :: Point -> Size -> Point Source # (~-) :: Point -> Point -> Size Source #

nubSet :: Ord a => [a] -> [a] Source #

As `nub`, but with O(n*log(n)) behaviour.

mapAdjust' :: Ord k => (a -> a) -> k -> Map k a -> Map k a Source #

As Map.adjust, but the combining function is applied strictly.

mapFromFoldable :: (Foldable t, Ord k) => t (k, a) -> Map k a Source #

Generalisation of `fromList` to arbitrary foldables.

groupBy' :: (a -> a -> Bool) -> [a] -> [[a]] Source #

Alternative to groupBy.

    groupBy' (\a b -> abs (a - b) <= 1) [1,2,3] = [[1,2,3]]

whereas

    groupBy (\a b -> abs (a - b) <= 1) [1,2,3] = [[1,2],[3]]

TODO: Check in ghc 6.12 release if groupBy == groupBy'.

chain :: (a -> a -> Bool) -> [a] -> ([a], [a]) Source #

commonPrefix :: Eq a => [[a]] -> [a] Source #

Return the longest common prefix of a set of lists.

    P(xs) === all (isPrefixOf (commonPrefix xs)) xs
    length s > length (commonPrefix xs) --> not (all (isPrefixOf s) xs)

findPL :: (a -> Bool) -> [a] -> Maybe (PointedList a) Source #

Finds the first element satisfying the predicate, and returns a zipper pointing at it.

swapFocus :: (PointedList a -> PointedList a) -> PointedList a -> PointedList a Source #

Given a function which moves the focus from index A to index B, return a function which swaps the elements at indexes A and B and then moves the focus. See Yi.Editor.swapWinWithFirstE for an example.

makeClassyWithSuffix :: String -> Name -> Q [Dec] Source #

addSuffix :: Name -> String -> [DefName] Source #

makeLensesWithSuffix :: String -> Name -> Q [Dec] Source #

# Orphan instances

(Eq k, Hashable k, Binary k, Binary v) => Binary (HashMap k v) Source # |
Instance details Methods put :: HashMap k v -> Put Source # get :: Get (HashMap k v) Source # putList :: [HashMap k v] -> Put Source #