Yi.Prelude
 Contents Conversions to Rope Conversions from Rope List-like functions IO Low level functions
Synopsis
(<>) :: 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
 = Left a | Right b
type Endom a = a -> a
class Eq a where
 (==) :: a -> a -> Bool (/=) :: a -> a -> Bool
class Num a => Fractional a where
 (/) :: a -> a -> a recip :: a -> a fromRational :: Rational -> a
class Functor f where
 fmap :: (a -> b) -> f a -> f b (<\$) :: a -> f b -> f a
data IO a
data Integer
class (Real a, Enum a) => Integral a where
 quot :: a -> a -> a rem :: a -> a -> a div :: a -> a -> a mod :: a -> a -> a quotRem :: a -> a -> (a, a) divMod :: a -> a -> (a, a) toInteger :: a -> Integer
class Bounded a where
 minBound :: a maxBound :: a
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
 = Nothing | Just a
 (>>=) :: m a -> (a -> m b) -> m b (>>) :: m a -> m b -> m b return :: a -> m a fail :: String -> m a
class (Eq a, Show a) => Num a where
 (+) :: a -> a -> a (*) :: a -> a -> a (-) :: a -> a -> a negate :: a -> a abs :: a -> a signum :: a -> a fromInteger :: Integer -> a
class Eq a => Ord a where
 compare :: a -> a -> Ordering (<) :: a -> a -> Bool (>=) :: a -> a -> Bool (>) :: a -> a -> Bool (<=) :: a -> a -> Bool max :: a -> a -> a min :: a -> a -> a
class (Num a, Ord a) => Real a where
 toRational :: a -> Rational
class (Real a, Fractional a) => RealFrac a where
 properFraction :: Integral b => a -> (b, a) truncate :: Integral b => a -> b round :: Integral b => a -> b ceiling :: Integral b => a -> b floor :: Integral b => a -> b
 runReaderT :: r -> m a
}
class SemiNum absolute relative | absolute -> relative where
 (+~) :: absolute -> relative -> absolute (-~) :: absolute -> relative -> absolute (~-) :: absolute -> absolute -> relative
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
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
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
nubSet :: Ord a => [a] -> [a]
null :: [a] -> Bool
print :: Show a => a -> IO ()
putStrLn :: String -> IO ()
replicate :: Int -> a -> [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
 (<>) :: Monoid a => a -> a -> a Source
 (++) :: [a] -> [a] -> [a] Source

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.

 (=<<) :: Monad m => (a -> m b) -> m a -> m b Source
Same as >>=, but with the arguments interchanged.
 data Double Source
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.
Instances
 Enum Double Eq Double Floating Double Fractional Double Data Double Num Double Ord Double Read Double Real Double RealFloat Double RealFrac Double Show Double Typeable Double PrintfArg Double Storable Double Binary Double AffineSpace Double VectorSpace Double InnerSpace Double IArray UArray Double MArray (STUArray s) Double (ST s)
 data Char Source
Instances
 Bounded Char Enum Char Eq Char Data Char Ord Char Read Char Show Char Ix Char Typeable Char HasTrie 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 Source

The Either type represents values with two possibilities: a value of type Either a b is either Left a or 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").

Constructors
 Left a Right b
Instances
 type Endom a = a -> a Source
 class Eq a where Source

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.

Minimal complete definition: either == or /=.

Methods
 (==) :: a -> a -> Bool Source
 (/=) :: a -> a -> Bool Source
Instances
 Eq Bool Eq Char Eq Double Eq Float Eq Int Eq Int8 Eq Int16 Eq Int32 Eq Int64 Eq Integer Eq Ordering Eq Word Eq Word8 Eq Word16 Eq Word32 Eq Word64 Eq Exp Eq Match Eq Clause Eq Pat Eq Type Eq Dec Eq Name Eq FunDep Eq Pred Eq TyVarBndr Eq () Eq PackageDescription Eq BuildType Eq Library Eq Executable Eq BuildInfo Eq SourceRepo Eq RepoKind Eq RepoType Eq GenericPackageDescription Eq Flag Eq FlagName Eq ConfVar Eq CompilerFlavor Eq CompilerId Eq PackageName Eq PackageIdentifier Eq InstalledPackageId Eq Dependency Eq License Eq VersionRange Eq VersionIntervals Eq LowerBound Eq UpperBound Eq Bound Eq Extension Eq ModuleName Eq Version Eq DL Eq DI Eq Handle Eq Finalizers Eq Key Eq KeyPr Eq Exception Eq All Eq Any Eq Constr Eq DataRep Eq ConstrRep Eq Fixity Eq HandlePosn Eq ThreadId Eq BlockReason Eq ThreadStatus Eq CDev Eq CIno Eq CMode Eq COff Eq CPid Eq CSsize Eq CGid Eq CNlink Eq CUid Eq CCc Eq CSpeed Eq CTcflag Eq CRLim Eq Fd Eq Errno Eq AsyncException Eq ArrayException Eq ExitCode Eq IOErrorType Eq BufferMode Eq Newline Eq NewlineMode Eq BufferState Eq GeneralCategory Eq CChar Eq CSChar Eq CUChar Eq CShort Eq CUShort Eq CInt Eq CUInt Eq CLong Eq CULong Eq CLLong Eq CULLong Eq CFloat Eq CDouble Eq CPtrdiff Eq CSize Eq CWchar Eq CSigAtomic Eq CClock Eq CTime Eq CIntPtr Eq CUIntPtr Eq CIntMax Eq CUIntMax Eq IODeviceType Eq SeekMode Eq IOMode Eq Lexeme Eq IOException Eq ArithException Eq TypeRep Eq TyCon Eq ByteString Eq ByteString Eq IntSet Eq RequiredInstance Eq OccName Eq PkgName Eq ModName Eq Kind Eq Con Eq Strict Eq InlineSpec Eq Pragma Eq Safety Eq Callconv Eq Foreign Eq FamFlavour Eq Range Eq Stmt Eq Guard Eq Body Eq FixityDirection Eq Fixity Eq NameSpace Eq NameFlavour Eq GuardedAlt Eq GuardedAlts Eq Alt Eq FieldUpdate Eq QualStmt Eq Stmt Eq PatField Eq RPat Eq RPatOp Eq PXAttr Eq Pat Eq WarningText Eq RuleVar Eq Rule Eq Activation Eq ModulePragma Eq CallConv Eq Safety Eq Splice Eq Bracket Eq XAttr Eq XName Eq Exp Eq Literal Eq Asst Eq FunDep Eq Kind Eq TyVarBind Eq Type Eq GuardedRhs Eq Rhs Eq BangType Eq InstDecl Eq ClassDecl Eq GadtDecl Eq ConDecl Eq QualConDecl Eq Match Eq IPBind Eq Binds Eq DataOrNew Eq Annotation Eq Decl Eq Assoc Eq ImportSpec Eq ImportDecl Eq ExportSpec Eq Module Eq CName Eq Op Eq QOp Eq IPName Eq Name Eq QName Eq SpecialCon Eq ModuleName Eq Lit Eq Permissions Eq Prec Eq Tick Eq CheckHiWay Eq TraceBinIFaceReading Eq TargetId Eq Warnings Eq Dependencies Eq Usage Eq Middle Eq MidCallTarget Eq Convention Eq ForeignConvention Eq ForeignSafety Eq ValueDirection Eq SimplifierSwitch Eq PredType Eq TimeLocale Eq PhantomModule Eq ModuleElem Eq Extension Eq Message Eq SourcePos Eq Pattern Eq PatternSet Eq PatternSetCharacterClass Eq PatternSetCollatingElement Eq PatternSetEquivalenceClass Eq DoPa Eq OP Eq QT Eq WhichTest Eq TagTask Eq TagUpdate Eq Action Eq DelimPolicy Eq CondensePolicy Eq EndPolicy Eq LocalTime Eq UTCTime Eq NominalDiffTime Eq Day Eq UniversalTime Eq DiffTime Eq GroupEntry Eq UserEntry Eq DisplayRegion Eq Key Eq Modifier Eq Button Eq Event Eq Image Eq Attr Eq FixedAttr Eq Color Eq ModuleKind Eq FolderKind Eq FileKind Eq ProjectItem Eq Rope Eq Chunk Eq Event Eq Key Eq Modifier Eq Color Eq Attributes Eq Direction Eq Size Eq Point Eq BufferRef Eq Mark Eq SearchOption Eq Window Eq MarkValue Eq Overlay Eq OvlLayer Eq IndentBehaviour Eq IndentSettings Eq FBuffer Eq RegionStyle Eq DiredOpState Eq DiredState Eq DiredEntry Eq DiredFileInfo Eq Posn Eq Token Eq ReservedOp Eq Reserved Eq Token Eq OpType Eq ReservedType Eq CommentType Eq Token Eq Operator Eq Reserved Eq CommentType Eq Token Eq HlState Eq Token Eq Report Eq Warning Eq Error Eq DependentMarks Eq BufferMarks Eq MarkInfo Eq QueuedUpdate Eq a => Eq [a] Integral a => Eq (Ratio a) Eq (Ptr a) Eq (FunPtr a) Eq a => Eq (Maybe a) Eq a => Eq (Flag a) Eq c => Eq (Condition c) Eq (ForeignPtr a) Eq (Fixed a) Eq a => Eq (Dual a) Eq a => Eq (Sum a) Eq a => Eq (Product a) Eq a => Eq (First a) Eq a => Eq (Last a) Eq a => Eq (Down a) Eq (TVar a) Eq (IORef a) Eq (MVar a) Eq a => Eq (Tree a) Eq a => Eq (Set a) Eq a => Eq (Seq a) Eq a => Eq (ViewL a) Eq a => Eq (ViewR a) Eq name => Eq (GenAvailInfo name) Eq a => Eq (PointedList a) Eq a => Eq (TreeLoc a) Eq a => Eq (Chunk a) Eq v => Eq (MaybeDefault v) (Eq a, Eq b) => Eq (Either a b) (Eq a, Eq b) => Eq (a, b) (HasTrie a, Eq b) => Eq (:->: a b) (Ix ix, Eq e, IArray UArray e) => Eq (UArray ix e) (Ix i, Eq e) => Eq (Array i e) Eq (STRef s a) (Eq k, Eq a) => Eq (Map k a) (Eq a, Eq (s a)) => Eq (ViewL s a) (Eq a, Eq (s a)) => Eq (ViewR s a) (Measured v a, Eq a) => Eq (FingerTree v a) Eq t => Eq (::: t doc) (Eq a, Eq b, Eq c) => Eq (a, b, c) (Eq v, Eq c, Eq a) => Eq (CondTree v c a) Eq (STUArray s i e) Eq (STArray s i e) (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) (Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
 class Num a => Fractional a where Source

Fractional numbers, supporting real division.

Minimal complete definition: fromRational and (recip or (/))

Methods
 (/) :: a -> a -> a Source
fractional division
 recip :: a -> a Source
reciprocal fraction
 fromRational :: Rational -> a Source
Conversion from a Rational (that is Ratio Integer). A floating literal stands for an application of fromRational to a value of type Rational, so such literals have type (Fractional a) => a.
Instances
 Fractional Double Fractional Float Fractional CFloat Fractional CDouble Fractional NominalDiffTime Fractional DiffTime Integral a => Fractional (Ratio a) HasResolution a => Fractional (Fixed a)
 class Functor f where Source

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.

Methods
 fmap :: (a -> b) -> f a -> f b Source
 (<\$) :: a -> f b -> f a Source
Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.
Instances
 data IO a Source

A value of type IO a is a computation which, when performed, does some I/O before returning a value of type a.

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.

Instances
 data Integer Source
Arbitrary-precision integers.
Instances
 Enum Integer Eq Integer Integral Integer Data Integer Num Integer Ord Integer Read Integer Real Integer Show Integer Ix Integer Typeable Integer HasTrie Integer PrintfArg Integer Bits Integer Binary Integer Lift Integer
 class (Real a, Enum a) => Integral a where Source

Integral numbers, supporting integer division.

Minimal complete definition: quotRem and toInteger

Methods
 quot :: a -> a -> a Source
integer division truncated toward zero
 rem :: a -> a -> a Source

integer remainder, satisfying

(x `quot` y)*y + (x `rem` y) == x
 div :: a -> a -> a Source
integer division truncated toward negative infinity
 mod :: a -> a -> a Source

integer modulus, satisfying

(x `div` y)*y + (x `mod` y) == x
 quotRem :: a -> a -> (a, a) Source
simultaneous quot and rem
 divMod :: a -> a -> (a, a) Source
simultaneous div and mod
 toInteger :: a -> Integer Source
conversion to Integer
Instances
 Integral Int Integral Int8 Integral Int16 Integral Int32 Integral Int64 Integral Integer Integral Word Integral Word8 Integral Word16 Integral Word32 Integral Word64 Integral CIno Integral CMode Integral COff Integral CPid Integral CSsize Integral CGid Integral CNlink Integral CUid Integral CTcflag Integral CRLim Integral Fd Integral CChar Integral CSChar Integral CUChar Integral CShort Integral CUShort Integral CInt Integral CUInt Integral CLong Integral CULong Integral CLLong Integral CULLong Integral CPtrdiff Integral CSize Integral CWchar Integral CSigAtomic Integral CIntPtr Integral CUIntPtr Integral CIntMax Integral CUIntMax Integral Size Integral Point
 class Bounded a where Source

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.

Methods
 minBound :: a Source
 maxBound :: a Source
Instances
 Bounded Bool Bounded Char Bounded Int Bounded Int8 Bounded Int16 Bounded Int32 Bounded Int64 Bounded Ordering Bounded Word Bounded Word8 Bounded Word16 Bounded Word32 Bounded Word64 Bounded () Bounded All Bounded Any Bounded CIno Bounded CMode Bounded COff Bounded CPid Bounded CSsize Bounded CGid Bounded CNlink Bounded CUid Bounded CTcflag Bounded CRLim Bounded Fd Bounded GeneralCategory Bounded CChar Bounded CSChar Bounded CUChar Bounded CShort Bounded CUShort Bounded CInt Bounded CUInt Bounded CLong Bounded CULong Bounded CLLong Bounded CULLong Bounded CPtrdiff Bounded CSize Bounded CWchar Bounded CSigAtomic Bounded CIntPtr Bounded CUIntPtr Bounded CIntMax Bounded CUIntMax Bounded Point Bounded a => Bounded (Flag a) Bounded a => Bounded (Dual a) Bounded a => Bounded (Sum a) Bounded a => Bounded (Product a) (Bounded a, Bounded b) => Bounded (a, b) (Bounded a, Bounded b, Bounded c) => Bounded (a, b, c) (Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (a, b, c, d, e, f, g, h) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (a, b, c, d, e, f, g, h, i) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j) => Bounded (a, b, c, d, e, f, g, h, i, j) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k) => Bounded (a, b, c, d, e, f, g, h, i, j, k) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n) (Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)
 class Enum a where Source

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:

enumFrom x = enumFromTo x maxBound enumFromThen x y = enumFromThenTo x y bound where bound | fromEnum y >= fromEnum x = maxBound | otherwise = minBound
Methods
 succ :: a -> a Source
the successor of a value. For numeric types, succ adds 1.
 pred :: a -> a Source
the predecessor of a value. For numeric types, pred subtracts 1.
 toEnum :: Int -> a Source
Convert from an Int.
 fromEnum :: a -> Int Source
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] Source
Used in Haskell's translation of [n..].
 enumFromThen :: a -> a -> [a] Source
Used in Haskell's translation of [n,n'..].
 enumFromTo :: a -> a -> [a] Source
Used in Haskell's translation of [n..m].
 enumFromThenTo :: a -> a -> a -> [a] Source
Used in Haskell's translation of [n,n'..m].
Instances
 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 Message 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 Source

The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a), or it is empty (represented as Nothing). 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.

Constructors
 Nothing Just a
Instances
 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) UserOfLocalRegs a => UserOfLocalRegs (Maybe a) UserOfSlots a => UserOfSlots (Maybe a) VectorSpace v => VectorSpace (Maybe v) (InnerSpace a, AdditiveGroup (Scalar a)) => InnerSpace (Maybe a) Typeable a => Initializable (Maybe a)

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

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.

Methods
 (>>=) :: m a -> (a -> m b) -> m b Source
Sequentially compose two actions, passing any value produced by the first as an argument to the second.
 (>>) :: m a -> m b -> m b Source
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 Source
Inject a value into the monadic type.
 fail :: String -> m a Source
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.
Instances
 class (Eq a, Show a) => Num a where Source

Basic numeric class.

Minimal complete definition: all except negate or (-)

Methods
 (+) :: a -> a -> a Source
 (*) :: a -> a -> a Source
 (-) :: a -> a -> a Source
 negate :: a -> a Source
Unary negation.
 abs :: a -> a Source
Absolute value.
 signum :: a -> a Source

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 Source
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.
Instances
 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)
 class Eq a => Ord a where Source

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.

Methods
 compare :: a -> a -> Ordering Source
 (<) :: a -> a -> Bool Source
 (>=) :: a -> a -> Bool Source
 (>) :: a -> a -> Bool Source
 (<=) :: a -> a -> Bool Source
 max :: a -> a -> a Source
 min :: a -> a -> a Source
Instances
 Ord Bool Ord Char Ord Double Ord Float Ord Int Ord Int8 Ord Int16 Ord Int32 Ord Int64 Ord Integer Ord Ordering Ord Word Ord Word8 Ord Word16 Ord Word32 Ord Word64 Ord Name Ord () Ord RepoKind Ord RepoType Ord FlagName Ord CompilerFlavor Ord CompilerId Ord PackageName Ord PackageIdentifier Ord InstalledPackageId Ord LowerBound Ord UpperBound Ord ModuleName Ord Version Ord DL Ord All Ord Any Ord ThreadId Ord BlockReason Ord ThreadStatus Ord CDev Ord CIno Ord CMode Ord COff Ord CPid Ord CSsize Ord CGid Ord CNlink Ord CUid Ord CCc Ord CSpeed Ord CTcflag Ord CRLim Ord Fd Ord AsyncException Ord ArrayException Ord ExitCode Ord BufferMode Ord GeneralCategory Ord CChar Ord CSChar Ord CUChar Ord CShort Ord CUShort Ord CInt Ord CUInt Ord CLong Ord CULong Ord CLLong Ord CULLong Ord CFloat Ord CDouble Ord CPtrdiff Ord CSize Ord CWchar Ord CSigAtomic Ord CClock Ord CTime Ord CIntPtr Ord CUIntPtr Ord CIntMax Ord CUIntMax Ord SeekMode Ord IOMode Ord ArithException Ord ByteString Ord ByteString Ord IntSet Ord RequiredInstance Ord OccName Ord PkgName Ord ModName Ord NameSpace Ord NameFlavour Ord GuardedAlt Ord GuardedAlts Ord Alt Ord FieldUpdate Ord QualStmt Ord Stmt Ord PatField Ord RPat Ord RPatOp Ord PXAttr Ord Pat Ord WarningText Ord RuleVar Ord Rule Ord Activation Ord ModulePragma Ord CallConv Ord Safety Ord Splice Ord Bracket Ord XAttr Ord XName Ord Exp Ord Literal Ord Asst Ord FunDep Ord Kind Ord TyVarBind Ord Type Ord GuardedRhs Ord Rhs Ord BangType Ord InstDecl Ord ClassDecl Ord GadtDecl Ord ConDecl Ord QualConDecl Ord Match Ord IPBind Ord Binds Ord DataOrNew Ord Annotation Ord Decl Ord Assoc Ord ImportSpec Ord ImportDecl Ord ExportSpec Ord Module Ord CName Ord Op Ord QOp Ord IPName Ord Name Ord QName Ord SpecialCon Ord ModuleName Ord Permissions Ord Prec Ord Tick Ord SimplifierSwitch Ord PredType Ord TimeLocale Ord Message Ord SourcePos Ord PatternSetCharacterClass Ord PatternSetCollatingElement Ord PatternSetEquivalenceClass Ord DoPa Ord WhichTest Ord LocalTime Ord UTCTime Ord NominalDiffTime Ord Day Ord UniversalTime Ord DiffTime Ord Key Ord Modifier Ord Button Ord Event Ord ModuleKind Ord FolderKind Ord FileKind Ord ProjectItem Ord Event Ord Key Ord Modifier Ord Color Ord Attributes Ord Direction Ord Size Ord Point Ord BufferRef Ord Mark Ord MarkValue Ord Overlay Ord OvlLayer Ord Posn Ord Token Ord MarkInfo Ord QueuedUpdate Ord a => Ord [a] Integral a => Ord (Ratio a) Ord (Ptr a) Ord (FunPtr a) Ord a => Ord (Maybe a) Ord (ForeignPtr a) Ord (Fixed a) Ord a => Ord (Dual a) Ord a => Ord (Sum a) Ord a => Ord (Product a) Ord a => Ord (First a) Ord a => Ord (Last a) Ord a => Ord (Down a) Ord a => Ord (Set a) Ord a => Ord (Seq a) Ord a => Ord (ViewL a) Ord a => Ord (ViewR a) Ord a => Ord (PointedList a) (Ord a, Ord b) => Ord (Either a b) (Ord a, Ord b) => Ord (a, b) (Ix ix, Ord e, IArray UArray e) => Ord (UArray ix e) (Ix i, Ord e) => Ord (Array i e) (Ord k, Ord v) => Ord (Map k v) (Ord a, Ord (s a)) => Ord (ViewL s a) (Ord a, Ord (s a)) => Ord (ViewR s a) (Measured v a, Ord a) => Ord (FingerTree v a) (Ord a, Ord b, Ord c) => Ord (a, b, c) (Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) (Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n) (Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)

Parsing of Strings, producing values.

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

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
Methods
 :: Int the operator precedence of the enclosing context (a number from 0 to 11). Function application has precedence 10. -> 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.
The method readList is provided to allow the programmer to give a specialised way of parsing lists of values. For example, this is used by the predefined Read instance of the Char type, where values of type String should be are expected to use double quotes, rather than square brackets.
Instances
 class (Num a, Ord a) => Real a where Source
Methods
 toRational :: a -> Rational Source
the rational equivalent of its real argument with full precision
Instances
 Real Double Real Float Real Int Real Int8 Real Int16 Real Int32 Real Int64 Real Integer Real Word Real Word8 Real Word16 Real Word32 Real Word64 Real CDev Real CIno Real CMode Real COff Real CPid Real CSsize Real CGid Real CNlink Real CUid Real CCc Real CSpeed Real CTcflag Real CRLim Real Fd Real CChar Real CSChar Real CUChar Real CShort Real CUShort Real CInt Real CUInt Real CLong Real CULong Real CLLong Real CULLong Real CFloat Real CDouble Real CPtrdiff Real CSize Real CWchar Real CSigAtomic Real CClock Real CTime Real CIntPtr Real CUIntPtr Real CIntMax Real CUIntMax Real NominalDiffTime Real DiffTime Real Size Real Point Integral a => Real (Ratio a) HasResolution a => Real (Fixed a)
 class (Real a, Fractional a) => RealFrac a where Source

Extracting components of fractions.

Minimal complete definition: properFraction

Methods
 properFraction :: Integral b => a -> (b, a) Source

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 as x; and
• f is a fraction with the same type and sign as x, and with absolute value less than 1.

The default definitions of the ceiling, floor, truncate and round functions are in terms of properFraction.

 truncate :: Integral b => a -> b Source
truncate x returns the integer nearest x between zero and x
 round :: Integral b => a -> b Source
round x returns the nearest integer to x; the even integer if x is equidistant between two integers
 ceiling :: Integral b => a -> b Source
ceiling x returns the least integer not less than x
 floor :: Integral b => a -> b Source
floor x returns the greatest integer not greater than x
Instances
 RealFrac Double RealFrac Float RealFrac CFloat RealFrac CDouble RealFrac NominalDiffTime Integral a => RealFrac (Ratio a) HasResolution a => RealFrac (Fixed a)
 newtype ReaderT r m a Source

The return function ignores the environment, while >>= passes the inherited environment to both subcomputations.

Constructors
 runReaderT :: r -> m a The underlying computation, as a function of the environment.
Instances
 class SemiNum absolute relative | absolute -> relative where Source
Methods
 (+~) :: absolute -> relative -> absolute Source
 (-~) :: absolute -> relative -> absolute Source
 (~-) :: absolute -> absolute -> relative Source
Instances
 SemiNum Point Size
 type String = [Char] Source
A String is a list of characters. String constants in Haskell are values of type String.
 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)
```
 discard :: Functor f => f a -> f () Source
 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 Source
general coercion from integral types
 fst :: (a, b) -> a Source
Extract the first component of a pair.
 fst3 :: (a, b, c) -> a Source
 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'.

 list :: b -> (a -> [a] -> b) -> [a] -> b Source
 head :: [a] -> a Source
Extract the first element of a list, which must be non-empty.
 init :: [a] -> [a] Source
Return all the elements of a list except the last one. The list must be non-empty.
 io :: MonadIO m => IO a -> m a Source
 last :: [a] -> a Source
Extract the last element of a list, which must be finite and non-empty.
 lookup :: Eq a => a -> [(a, b)] -> Maybe b Source
lookup key assocs looks up a key in an association list.
 mapAdjust' :: Ord k => (a -> a) -> k -> Map k a -> Map k a Source
As Map.adjust, but the combining function is applied strictly.
 mapAlter' :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a Source
As Map.alter, but the newly inserted element is forced with the map.
module Control.Applicative
module Control.Category
module Data.Accessor
 putA :: MonadState r m => T r a -> a -> m () Source
 getA :: MonadState r m => T r a -> m a Source
 modA :: MonadState r m => T r a -> (a -> a) -> m () Source
module Data.Bool
module Data.Foldable
module Data.Function
module Data.Int
 data Rope Source
Instances
 Eq Rope Show Rope Binary Rope
Conversions to Rope
 fromString :: String -> Rope Source
Conversions from Rope
 toString :: Rope -> String Source
 toReverseString :: Rope -> String Source
List-like functions
 null :: Rope -> Bool Source
 empty :: Rope Source
 take :: Int -> Rope -> Rope Source
 drop :: Int -> Rope -> Rope Source
 append :: Rope -> Rope -> Rope Source
Append two strings by merging the two finger trees.
 splitAt :: Int -> Rope -> (Rope, Rope) Source
Split the string at the specified position.
 splitAtLine :: Int -> Rope -> (Rope, Rope) Source
Split before the specified line. Lines are indexed from 0.
 length :: Rope -> Int Source
Get the length of the string. (This information cached, so O(1) amortized runtime.)
 reverse :: Rope -> Rope Source
 countNewLines :: Rope -> Int Source
Count the number of newlines in the strings. (This information cached, so O(1) amortized runtime.)
IO
 readFile :: FilePath -> IO Rope Source
 writeFile :: FilePath -> Rope -> IO () Source
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
 nubSet :: Ord a => [a] -> [a] Source
As Prelude.nub, but with O(n*log(n)) behaviour.
 null :: [a] -> Bool Source
Test whether a list is empty.
 print :: Show a => a -> IO () Source

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]])
 putStrLn :: String -> IO () Source
The same as putStr, but adds a newline character.
 replicate :: Int -> a -> [a] Source
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 Source
Evaluates its first argument to head normal form, and then returns its second argument as the result.
 singleton :: a -> [a] Source
 snd :: (a, b) -> b Source
Extract the second component of a pair.
 snd3 :: (a, b, c) -> b Source
 tail :: [a] -> [a] Source
Extract the elements after the head of a list, which must be non-empty.
 trd3 :: (a, b, c) -> c Source
 undefined :: a Source
A special case of error. It is expected that compilers will recognize this and insert error messages which are more appropriate to the context in which undefined appears.
 unlines :: [String] -> String Source
unlines is an inverse operation to lines. It joins lines, after appending a terminating newline to each.
 when :: Monad m => Bool -> m () -> m () Source

Conditional execution of monadic expressions. For example,

when debug (putStr "Debugging\n")

will output the string Debugging\n if the Boolean value debug is True, and otherwise do nothing.

 writeFile :: FilePath -> String -> IO () Source
The computation writeFile file str function writes the string str, to the file file.