License | GPL-2 |
---|---|
Maintainer | yi-devel@googlegroups.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions |
|
This module defines a Rope representation.
While the representation are ByteStrings stored in a finger tree, the indices are actually in number of characters.
This is currently based on utf8-string, but a couple of other packages might be better: text, compact-string.
At the moment none of them has a lazy implementation, which forces us to always export plain Strings. (Utf8-string does not have a proper newtype)
Important: The reason this module exists is to allow benchmarking and behaviour checks against a new implementation. As of today (10th September 2014), Yi imports this module. Notably, this module will be going away and Yi will start using Yi.Rope instead in the near future.
- data Rope
- fromString :: IsString a => String -> a
- toString :: Rope -> String
- toReverseString :: Rope -> String
- null :: Rope -> Bool
- empty :: Rope
- take :: Int -> Rope -> Rope
- drop :: Int -> Rope -> Rope
- length :: Rope -> Int
- reverse :: Rope -> Rope
- countNewLines :: Rope -> Int
- split :: Word8 -> Rope -> [Rope]
- splitAt :: Int -> Rope -> (Rope, Rope)
- splitAtLine :: Int -> Rope -> (Rope, Rope)
- append :: Rope -> Rope -> Rope
- concat :: [Rope] -> Rope
- readFile :: FilePath -> IO Rope
- writeFile :: FilePath -> Rope -> IO ()
- splitAtChunkBefore :: Int -> Rope -> (Rope, Rope)
Documentation
Conversions to Rope
fromString :: IsString a => String -> a
Conversions from Rope
toReverseString :: Rope -> String Source
List-like functions
Get the length of the string. (This information cached, so O(1) amortized runtime.)
countNewLines :: Rope -> Int Source
Count the number of newlines in the strings. (This information cached, so O(1) amortized runtime.)
splitAtLine :: Int -> Rope -> (Rope, Rope) Source
Split before the specified line. Lines are indexed from 0.