- (<>) :: Monoid a => a -> a -> a
- (++) :: [a] -> [a] -> [a]
- (=<<) :: Monad m => (a -> m b) -> m a -> m b
- data Double
- data Char
- data Either a b
- type Endom a = a -> a
- class Eq a where
- class Num a => Fractional a where
- (/) :: a -> a -> a
- recip :: a -> a
- fromRational :: Rational -> a
- class Functor f where
- data IO a
- data Integer
- class (Real a, Enum a) => Integral a where
- class Bounded a where
- class Enum a where
- succ :: a -> a
- pred :: a -> a
- toEnum :: Int -> a
- fromEnum :: a -> Int
- enumFrom :: a -> [a]
- enumFromThen :: a -> a -> [a]
- enumFromTo :: a -> a -> [a]
- enumFromThenTo :: a -> a -> a -> [a]
- data Maybe a
- class Monad m where
- class (Eq a, Show a) => Num a where
- class Eq a => Ord a where
- class Read a where
- class (Num a, Ord a) => Real a where
- toRational :: a -> Rational
- class (Real a, Fractional a) => RealFrac a where
- newtype ReaderT r m a = ReaderT {
- runReaderT :: r -> m a
- class SemiNum absolute relative | absolute -> relative where
- type String = [Char]
- commonPrefix :: Eq a => [[a]] -> [a]
- discard :: Functor f => f a -> f ()
- every :: Traversable t => Accessor whole part -> Accessor (t whole) (t part)
- fromIntegral :: (Integral a, Num b) => a -> b
- fst :: (a, b) -> a
- fst3 :: (a, b, c) -> a
- groupBy' :: (a -> a -> Bool) -> [a] -> [[a]]
- list :: b -> (a -> [a] -> b) -> [a] -> b
- head :: [a] -> a
- init :: [a] -> [a]
- io :: MonadIO m => IO a -> m a
- last :: [a] -> a
- lookup :: Eq a => a -> [(a, b)] -> Maybe b
- mapAdjust' :: Ord k => (a -> a) -> k -> Map k a -> Map k a
- mapAlter' :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a
- module Control.Applicative
- module Control.Category
- module Data.Accessor
- module Data.Accessor.Monad.FD.State
- putA :: MonadState r m => T r a -> a -> m ()
- getA :: MonadState r m => T r a -> m a
- modA :: MonadState r m => T r a -> (a -> a) -> m ()
- module Data.Bool
- module Data.Foldable
- module Data.Function
- module Data.Int
- data Rope
- fromString :: String -> Rope
- toString :: Rope -> String
- toReverseString :: Rope -> String
- null :: Rope -> Bool
- empty :: Rope
- take :: Int -> Rope -> Rope
- drop :: Int -> Rope -> Rope
- append :: Rope -> Rope -> Rope
- splitAt :: Int -> Rope -> (Rope, Rope)
- splitAtLine :: Int -> Rope -> (Rope, Rope)
- length :: Rope -> Int
- reverse :: Rope -> Rope
- countNewLines :: Rope -> Int
- readFile :: FilePath -> IO Rope
- writeFile :: FilePath -> Rope -> IO ()
- splitAtChunkBefore :: Int -> Rope -> (Rope, Rope)
- module Data.Traversable
- module Text.Show
- module Yi.Debug
- module Yi.Monad
- nubSet :: Ord a => [a] -> [a]
- null :: [a] -> Bool
- print :: Show a => a -> IO ()
- putStrLn :: String -> IO ()
- replicate :: Int -> a -> [a]
- read :: Read a => String -> a
- seq :: a -> b -> b
- singleton :: a -> [a]
- snd :: (a, b) -> b
- snd3 :: (a, b, c) -> b
- tail :: [a] -> [a]
- trd3 :: (a, b, c) -> c
- undefined :: a
- unlines :: [String] -> String
- when :: Monad m => Bool -> m () -> m ()
- writeFile :: FilePath -> String -> IO ()
Documentation
(++) :: [a] -> [a] -> [a]
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
data Double
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
data Char
Bounded Char | |
Enum Char | |
Eq Char | |
Data Char | |
Ord Char | |
Read Char | |
Show Char | |
Ix Char | |
Typeable Char | |
PrintfArg Char | |
IsChar Char | |
Storable Char | |
Binary Char | |
Lift Char | |
Outputable Char | |
ErrorList Char | |
Promptable Char | |
IArray UArray Char | |
RegexMaker Regex CompOption ExecOption (Seq Char) | |
RegexMaker Regex CompOption ExecOption (Seq Char) | |
RegexLike Regex (Seq Char) | |
RegexLike Regex (Seq Char) | |
RegexContext Regex (Seq Char) (Seq Char) | |
RegexContext Regex (Seq Char) (Seq Char) | |
IsString [Char] | |
MArray (STUArray s) Char (ST s) |
data Either a b
The Either
type represents values with two possibilities: a value of
type
is either Either
a b
or Left
a
.
Right
b
The Either
type is sometimes used to represent a value which is
either correct or an error; by convention, the Left
constructor is
used to hold an error value and the Right
constructor is used to
hold a correct value (mnemonic: "right" also means "correct").
Typeable2 Either | |
Error e => MonadError e (Either e) | |
Error e => MonadError e (Either e) | |
Monad (Either e) | |
Monad (Either e) | |
Functor (Either a) | |
MonadFix (Either e) | |
MonadFix (Either e) | |
Error e => MonadPlus (Either e) | |
Error e => MonadPlus (Either e) | |
Applicative (Either e) | |
Error e => Alternative (Either e) | |
(Eq a, Eq b) => Eq (Either a b) | |
(Data a, Data b) => Data (Either a b) | |
(Ord a, Ord b) => Ord (Either a b) | |
(Read a, Read b) => Read (Either a b) | |
(Show a, Show b) => Show (Either a b) | |
(Binary a, Binary b) => Binary (Either a b) | |
(Lift a, Lift b) => Lift (Either a b) |
class Eq a where
The Eq
class defines equality (==
) and inequality (/=
).
All the basic datatypes exported by the Prelude are instances of Eq
,
and Eq
may be derived for any datatype whose constituents are also
instances of Eq
.
class Num a => Fractional a where
Fractional numbers, supporting real division.
Minimal complete definition: fromRational
and (recip
or (
)
/
)
(/) :: a -> a -> a
fractional division
recip :: a -> a
reciprocal fraction
fromRational :: Rational -> a
Conversion from a Rational
(that is
).
A floating literal stands for an application of Ratio
Integer
fromRational
to a value of type Rational
, so such literals have type
(
.
Fractional
a) => a
class Functor f where
The Functor
class is used for types that can be mapped over.
Instances of Functor
should satisfy the following laws:
fmap id == id
fmap (f . g) == fmap f . fmap g
The instances of Functor
for lists, Data.Maybe.Maybe and System.IO.IO
defined in the Prelude satisfy these laws.
data IO a
A value of type
is a computation which, when performed,
does some I/O before returning a value of type IO
aa
.
There is really only one way to "perform" an I/O action: bind it to
Main.main
in your program. When your program is run, the I/O will
be performed. It isn't possible to perform I/O from an arbitrary
function, unless that function is itself in the IO
monad and called
at some point, directly or indirectly, from Main.main
.
IO
is a monad, so IO
actions can be combined using either the do-notation
or the >> and >>= operations from the Monad class.
Monad IO | |
Functor IO | |
Typeable1 IO | |
MonadFix IO | |
MonadPlus IO | Note: this instance does not satisfy the second v >> mzero = mzero |
MonadPlus IO | |
Applicative IO | |
MonadCatchIO IO | |
Quasi IO | |
MonadIO IO | |
MonadIO IO | |
MonadError IOException IO | |
MonadError IOError IO | |
MArray IOArray e IO | |
Typeable a => Data (IO a) | |
PrintfType (IO a) | |
HPrintfType (IO a) | |
YiAction (IO x) x |
data Integer
Arbitrary-precision integers.
class (Real a, Enum a) => Integral a where
quot :: a -> a -> a
integer division truncated toward zero
rem :: a -> a -> a
integer remainder, satisfying
(x `quot` y)*y + (x `rem` y) == x
div :: a -> a -> a
integer division truncated toward negative infinity
mod :: a -> a -> a
integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
quotRem :: a -> a -> (a, a)
divMod :: a -> a -> (a, a)
conversion to Integer
class Bounded a where
The Bounded
class is used to name the upper and lower limits of a
type. Ord
is not a superclass of Bounded
since types that are not
totally ordered may also have upper and lower bounds.
The Bounded
class may be derived for any enumeration type;
minBound
is the first constructor listed in the data
declaration
and maxBound
is the last.
Bounded
may also be derived for single-constructor datatypes whose
constituent types are in Bounded
.
class Enum a where
Class Enum
defines operations on sequentially ordered types.
The enumFrom
... methods are used in Haskell's translation of
arithmetic sequences.
Instances of Enum
may be derived for any enumeration type (types
whose constructors have no fields). The nullary constructors are
assumed to be numbered left-to-right by fromEnum
from 0
through n-1
.
See Chapter 10 of the Haskell Report for more details.
For any type that is an instance of class Bounded
as well as Enum
,
the following should hold:
- The calls
andsucc
maxBound
should result in a runtime error.pred
minBound
-
fromEnum
andtoEnum
should give a runtime error if the result value is not representable in the result type. For example,
is an error.toEnum
7 ::Bool
-
enumFrom
andenumFromThen
should be defined with an implicit bound, thus:
enumFrom x = enumFromTo x maxBound
enumFromThen x y = enumFromThenTo x y bound
where
bound | fromEnum y >= fromEnum x = maxBound
| otherwise = minBound
succ :: a -> a
the successor of a value. For numeric types, succ
adds 1.
pred :: a -> a
the predecessor of a value. For numeric types, pred
subtracts 1.
Convert from an Int
.
Convert to an Int
.
It is implementation-dependent what fromEnum
returns when
applied to a value that is too large to fit in an Int
.
enumFrom :: a -> [a]
Used in Haskell's translation of [n..]
.
enumFromThen :: a -> a -> [a]
Used in Haskell's translation of [n,n'..]
.
enumFromTo :: a -> a -> [a]
Used in Haskell's translation of [n..m]
.
enumFromThenTo :: a -> a -> a -> [a]
Used in Haskell's translation of [n,n'..m]
.
Enum Bool | |
Enum Char | |
Enum Double | |
Enum Float | |
Enum Int | |
Enum Int8 | |
Enum Int16 | |
Enum Int32 | |
Enum Int64 | |
Enum Integer | |
Enum Ordering | |
Enum Word | |
Enum Word8 | |
Enum Word16 | |
Enum Word32 | |
Enum Word64 | |
Enum () | |
Enum CDev | |
Enum CIno | |
Enum CMode | |
Enum COff | |
Enum CPid | |
Enum CSsize | |
Enum CGid | |
Enum CNlink | |
Enum CUid | |
Enum CCc | |
Enum CSpeed | |
Enum CTcflag | |
Enum CRLim | |
Enum Fd | |
Enum GeneralCategory | |
Enum CChar | |
Enum CSChar | |
Enum CUChar | |
Enum CShort | |
Enum CUShort | |
Enum CInt | |
Enum CUInt | |
Enum CLong | |
Enum CULong | |
Enum CLLong | |
Enum CULLong | |
Enum CFloat | |
Enum CDouble | |
Enum CPtrdiff | |
Enum CSize | |
Enum CWchar | |
Enum CSigAtomic | |
Enum CClock | |
Enum CTime | |
Enum CIntPtr | |
Enum CUIntPtr | |
Enum CIntMax | |
Enum CUIntMax | |
Enum SeekMode | |
Enum IOMode | |
Enum GConfValueType | |
Enum GConfPreloadType | |
Enum GConfError | |
Enum IOCondition | |
Enum PangoGravityHint | |
Enum PangoGravity | |
Enum Underline | |
Enum Weight | |
Enum FontStyle | |
Enum PangoDirection | |
Enum FontMask | Set the style field.
|
Enum TabAlign | |
Enum LayoutAlignment | |
Enum LayoutWrapMode | |
Enum Stretch | |
Enum Variant | |
Enum GdkWindowHints | Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque.
(Values of the opacity parameter are clamped to the [0,1] range.)
On X11 this has any effect only on X screens with a compositing manager running.
See Note that setting a window's opacity after the window has been shown causes it to flicker once on Windows.
|
Enum EllipsizeMode | |
Enum WidgetHelpType | |
Enum TreeViewGridLines | |
Enum PixbufError | |
Enum Colorspace | |
Enum InterpType | |
Enum PixbufRotation | Add an opacity layer to the
|
Enum TreeModelFlags | |
Enum IconSize | |
Enum AccelFlags | Arrow directions for the arrow widget |
Enum ArrowType | |
Enum AttachOptions | Mouse buttons. |
Enum MouseButton | |
Enum ButtonBoxStyle | |
Enum CalendarDisplayOptions | |
Enum Click | |
Enum CornerType | |
Enum DeleteType | |
Enum DestDefaults | Gives an indication why a drag operation failed. The value can by
obtained by connecting to the
|
Enum DragResult | |
Enum DirectionType | |
Enum Justification | |
Enum MatchType | |
Enum MenuDirectionType | |
Enum MetricType | |
Enum MovementStep | |
Enum Orientation | |
Enum Packing | |
Enum PackType | |
Enum PathPriorityType | Scrollbar policy types (for scrolled windows) |
Enum PathType | |
Enum PolicyType | |
Enum PositionType | |
Enum ProgressBarOrientation | |
Enum ReliefStyle | |
Enum ResizeMode | |
Enum ScrollType | |
Enum ScrollStep | |
Enum SelectionMode | |
Enum ShadowType | |
Enum SortType | |
Enum StateType | |
Enum SubmenuDirection | |
Enum SubmenuPlacement | |
Enum SpinButtonUpdatePolicy | |
Enum SpinType | |
Enum TargetFlags | Is the text written from left to right or the exotic way? |
Enum TextDirection | |
Enum TextSearchFlags | |
Enum TextWindowType | |
Enum ToolbarStyle | |
Enum TreeViewColumnSizing | |
Enum UpdateType | |
Enum Visibility | |
Enum WindowPosition | |
Enum WindowType | |
Enum WrapMode | |
Enum CapStyle | |
Enum CrossingMode | |
Enum DragProtocol | |
Enum DragAction | |
Enum Dither | |
Enum EventMask | |
Enum Modifier | |
Enum ExtensionMode | |
Enum Fill | |
Enum Function | |
Enum InputCondition | Determines how adjacent line ends are drawn. |
Enum JoinStyle | |
Enum LineStyle | |
Enum NotifyType | Determine if child widget may be overdrawn. |
Enum ScrollDirection | |
Enum SubwindowMode | visibility of a window |
Enum VisibilityState | |
Enum WindowState | These are hints for the window manager that indicate what type of function the window has. The window manager can use this when determining decoration and behaviour of the window. The hint must be set before mapping the window. See the extended window manager hints specification for more details about window types. |
Enum WindowEdge | |
Enum WindowTypeHint | |
Enum Gravity | Returned by
|
Enum GrabStatus | Specifies why a selection ownership was changed.
|
Enum OwnerChange | |
Enum DoPa | |
Enum WhichTest | |
Enum NominalDiffTime | |
Enum Day | |
Enum DiffTime | |
Enum Size | |
Enum Point | |
Integral a => Enum (Ratio a) | |
Enum a => Enum (Flag a) | |
Enum (Fixed a) |
data Maybe a
The Maybe
type encapsulates an optional value. A value of type
either contains a value of type Maybe
aa
(represented as
),
or it is empty (represented as Just
aNothing
). Using Maybe
is a good way to
deal with errors or exceptional cases without resorting to drastic
measures such as error
.
The Maybe
type is also a monad. It is a simple kind of error
monad, where all errors are represented by Nothing
. A richer
error monad can be built using the Data.Either.Either type.
Monad Maybe | |
Functor Maybe | |
Typeable1 Maybe | |
MonadFix Maybe | |
MonadPlus Maybe | |
Applicative Maybe | |
Foldable Maybe | |
Traversable Maybe | |
Alternative Maybe | |
Eq a => Eq (Maybe a) | |
Data a => Data (Maybe a) | |
Ord a => Ord (Maybe a) | |
Read a => Read (Maybe a) | |
Show a => Show (Maybe a) | |
Monoid a => Monoid (Maybe a) | |
Binary a => Binary (Maybe a) | |
Lift a => Lift (Maybe a) | |
GConfValueClass value => GConfValueClass (Maybe value) | |
UserOfLocalRegs a => UserOfLocalRegs (Maybe a) | |
UserOfSlots a => UserOfSlots (Maybe a) | |
Typeable a => Initializable (Maybe a) |
class Monad m where
The Monad
class defines the basic operations over a monad,
a concept from a branch of mathematics known as category theory.
From the perspective of a Haskell programmer, however, it is best to
think of a monad as an abstract datatype of actions.
Haskell's do
expressions provide a convenient syntax for writing
monadic expressions.
Minimal complete definition: >>=
and return
.
Instances of Monad
should satisfy the following laws:
return a >>= k == k a
m >>= return == m
m >>= (\x -> k x >>= h) == (m >>= k) >>= h
Instances of both Monad
and Functor
should additionally satisfy the law:
fmap f xs == xs >>= return . f
The instances of Monad
for lists, Data.Maybe.Maybe and System.IO.IO
defined in the Prelude satisfy these laws.
(>>=) :: m a -> (a -> m b) -> m b
Sequentially compose two actions, passing any value produced by the first as an argument to the second.
(>>) :: m a -> m b -> m b
Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.
return :: a -> m a
Inject a value into the monadic type.
Fail with a message. This operation is not part of the
mathematical definition of a monad, but is invoked on pattern-match
failure in a do
expression.
class (Eq a, Show a) => Num a where
Basic numeric class.
Minimal complete definition: all except negate
or (-)
(+) :: a -> a -> a
(*) :: a -> a -> a
(-) :: a -> a -> a
negate :: a -> a
Unary negation.
abs :: a -> a
Absolute value.
signum :: a -> a
Sign of a number.
The functions abs
and signum
should satisfy the law:
abs x * signum x == x
For real numbers, the signum
is either -1
(negative), 0
(zero)
or 1
(positive).
fromInteger :: Integer -> a
Conversion from an Integer
.
An integer literal represents the application of the function
fromInteger
to the appropriate value of type Integer
,
so such literals have type (
.
Num
a) => a
Num Double | |
Num Float | |
Num Int | |
Num Int8 | |
Num Int16 | |
Num Int32 | |
Num Int64 | |
Num Integer | |
Num Word | |
Num Word8 | |
Num Word16 | |
Num Word32 | |
Num Word64 | |
Num CDev | |
Num CIno | |
Num CMode | |
Num COff | |
Num CPid | |
Num CSsize | |
Num CGid | |
Num CNlink | |
Num CUid | |
Num CCc | |
Num CSpeed | |
Num CTcflag | |
Num CRLim | |
Num Fd | |
Num CChar | |
Num CSChar | |
Num CUChar | |
Num CShort | |
Num CUShort | |
Num CInt | |
Num CUInt | |
Num CLong | |
Num CULong | |
Num CLLong | |
Num CULLong | |
Num CFloat | |
Num CDouble | |
Num CPtrdiff | |
Num CSize | |
Num CWchar | |
Num CSigAtomic | |
Num CClock | |
Num CTime | |
Num CIntPtr | |
Num CUIntPtr | |
Num CIntMax | |
Num CUIntMax | |
Num NominalDiffTime | |
Num DiffTime | |
Num Size | |
Num Point | |
Num BufferRef | |
Integral a => Num (Ratio a) | |
HasResolution a => Num (Fixed a) | |
Num t => Num (::: t doc) |
The Ord
class is used for totally ordered datatypes.
Instances of Ord
can be derived for any user-defined
datatype whose constituent types are in Ord
. The declared order
of the constructors in the data declaration determines the ordering
in derived Ord
instances. The Ordering
datatype allows a single
comparison to determine the precise ordering of two objects.
Minimal complete definition: either compare
or <=
.
Using compare
can be more efficient for complex types.
class Read a where
Parsing of String
s, producing values.
Minimal complete definition: readsPrec
(or, for GHC only, readPrec
)
Derived instances of Read
make the following assumptions, which
derived instances of Text.Show.Show obey:
- If the constructor is defined to be an infix operator, then the
derived
Read
instance will parse only infix applications of the constructor (not the prefix form). - Associativity is not used to reduce the occurrence of parentheses, although precedence may be.
- If the constructor is defined using record syntax, the derived
Read
will parse only the record-syntax form, and furthermore, the fields must be given in the same order as the original declaration. - The derived
Read
instance allows arbitrary Haskell whitespace between tokens of the input string. Extra parentheses are also allowed.
For example, given the declarations
infixr 5 :^:
data Tree a = Leaf a | Tree a :^: Tree a
the derived instance of Read
in Haskell 98 is equivalent to
instance (Read a) => Read (Tree a) where
readsPrec d r = readParen (d > app_prec)
(\r -> [(Leaf m,t) |
("Leaf",s) <- lex r,
(m,t) <- readsPrec (app_prec+1) s]) r
++ readParen (d > up_prec)
(\r -> [(u:^:v,w) |
(u,s) <- readsPrec (up_prec+1) r,
(":^:",t) <- lex s,
(v,w) <- readsPrec (up_prec+1) t]) r
where app_prec = 10
up_prec = 5
Note that right-associativity of :^:
is unused.
The derived instance in GHC is equivalent to
instance (Read a) => Read (Tree a) where
readPrec = parens $ (prec app_prec $ do
Ident "Leaf" <- lexP
m <- step readPrec
return (Leaf m))
+++ (prec up_prec $ do
u <- step readPrec
Symbol ":^:" <- lexP
v <- step readPrec
return (u :^: v))
where app_prec = 10
up_prec = 5
readListPrec = readListPrecDefault
:: Int | the operator precedence of the enclosing
context (a number from |
-> ReadS a |
attempts to parse a value from the front of the string, returning a list of (parsed value, remaining string) pairs. If there is no successful parse, the returned list is empty.
Derived instances of Read
and Text.Show.Show satisfy the following:
-
(x,"")
is an element of(
.readsPrec
d (Text.Show.showsPrec d x ""))
That is, readsPrec
parses the string produced by
Text.Show.showsPrec, and delivers the value that
Text.Show.showsPrec started with.
class (Num a, Ord a) => Real a where
toRational :: a -> Rational
the rational equivalent of its real argument with full precision
class (Real a, Fractional a) => RealFrac a where
Extracting components of fractions.
Minimal complete definition: properFraction
properFraction :: Integral b => a -> (b, a)
The function properFraction
takes a real fractional number x
and returns a pair (n,f)
such that x = n+f
, and:
-
n
is an integral number with the same sign asx
; and -
f
is a fraction with the same type and sign asx
, and with absolute value less than1
.
The default definitions of the ceiling
, floor
, truncate
and round
functions are in terms of properFraction
.
truncate :: Integral b => a -> b
returns the integer nearest truncate
xx
between zero and x
returns the nearest integer to round
xx
;
the even integer if x
is equidistant between two integers
ceiling :: Integral b => a -> b
returns the least integer not less than ceiling
xx
returns the greatest integer not greater than floor
xx
newtype ReaderT r m a
The reader monad transformer, which adds a read-only environment to the given monad.
The return
function ignores the environment, while >>=
passes
the inherited environment to both subcomputations.
ReaderT | |
|
MonadError e m => MonadError e (ReaderT r m) | |
Monad m => MonadReader r (ReaderT r m) | |
MonadState s m => MonadState s (ReaderT r m) | |
MonadWriter w m => MonadWriter w (ReaderT r m) | |
MonadTrans (ReaderT r) | |
Monad m => Monad (ReaderT r m) | |
Functor m => Functor (ReaderT r m) | |
MonadFix m => MonadFix (ReaderT r m) | |
MonadPlus m => MonadPlus (ReaderT r m) | |
Applicative m => Applicative (ReaderT r m) | |
Alternative m => Alternative (ReaderT r m) | |
MonadIO m => MonadIO (ReaderT r m) |
class SemiNum absolute relative | absolute -> relative whereSource
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)
every :: Traversable t => Accessor whole part -> Accessor (t whole) (t part)Source
Lift an accessor to a traversable structure. (This can be seen as a generalization of fmap)
fromIntegral :: (Integral a, Num b) => a -> b
general coercion from integral types
fst :: (a, b) -> a
Extract the first component of a pair.
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'.
head :: [a] -> a
Extract the first element of a list, which must be non-empty.
init :: [a] -> [a]
Return all the elements of a list except the last one. The list must be non-empty.
last :: [a] -> a
Extract the last element of a list, which must be finite and non-empty.
mapAdjust' :: Ord k => (a -> a) -> k -> Map k a -> Map k aSource
As Map.adjust, but the combining function is applied strictly.
mapAlter' :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k aSource
As Map.alter, but the newly inserted element is forced with the map.
module Control.Applicative
module Control.Category
module Data.Accessor
module Data.Accessor.Monad.FD.State
putA :: MonadState r m => T r a -> a -> m ()Source
getA :: MonadState r m => T r a -> m aSource
modA :: MonadState r m => T r a -> (a -> a) -> m ()Source
module Data.Bool
module Data.Foldable
module Data.Function
module Data.Int
Conversions to Rope
fromString :: String -> RopeSource
Conversions from Rope
toReverseString :: Rope -> StringSource
List-like functions
splitAtLine :: Int -> Rope -> (Rope, Rope)Source
Split before the specified line. Lines are indexed from 0.
Get the length of the string. (This information cached, so O(1) amortized runtime.)
countNewLines :: Rope -> IntSource
Count the number of newlines in the strings. (This information cached, so O(1) amortized runtime.)
IO
Low level functions
splitAtChunkBefore :: Int -> Rope -> (Rope, Rope)Source
Split the rope on a chunk, so that the desired position lies within the first chunk of the second rope.
module Data.Traversable
module Text.Show
module Yi.Debug
module Yi.Monad
The print
function outputs a value of any printable type to the
standard output device.
Printable types are those that are instances of class Show
; print
converts values to strings for output using the show
operation and
adds a newline.
For example, a program to print the first 20 integers and their powers of 2 could be written as:
main = print ([(n, 2^n) | n <- [0..19]])
replicate
n x
is a list of length n
with x
the value of
every element.
It is an instance of the more general Data.List.genericReplicate,
in which n
may be of any integral type.
The read
function reads input from a string, which must be
completely consumed by the input process.
seq :: a -> b -> b
Evaluates its first argument to head normal form, and then returns its second argument as the result.
snd :: (a, b) -> b
Extract the second component of a pair.
tail :: [a] -> [a]
Extract the elements after the head of a list, which must be non-empty.
undefined :: a