Safe Haskell | Safe-Inferred |
---|
Synopsis
- class Textlike a where
- toText :: a -> Text
- fromText :: Text -> a
- toString :: a -> String.String
- toByteString :: a -> ByteString.ByteString
- toLazyByteString :: a -> ByteString.Lazy.ByteString
- replaceMany :: [(Text, Text)] -> Text -> Text
- unwords2 :: Textlike a => a -> a -> a
- unlines2 :: Textlike a => a -> a -> a
- join2 :: Textlike a => a -> a -> a -> a
- join :: Textlike a => a -> [a] -> a
- unlines :: Textlike a => [a] -> a
- split1 :: Text -> Text -> (Text, Text)
- ellipsis :: Int -> Text -> Text
- ellipsisList :: Int -> [Text] -> [Text]
- dropPrefix :: Text -> Text -> Text
- dropSuffix :: Text -> Text -> Text
- enumeration :: (Textlike a, Monoid a, String.IsString a) => [a] -> a
- columns :: Int -> [[Text]] -> [Text]
- columnsSome :: Int -> [Either.Either Text [Text]] -> [Text]
- mapDelimited :: Bool -> Char.Char -> (Text -> Text) -> Text -> Text
- mapDelimitedM :: Monad m => Bool -> Char.Char -> (Text -> m Text) -> Text -> m Text
- extractDelimited :: Bool -> Char.Char -> Text -> [(Text, Maybe.Maybe Text)]
- interpolate :: Text -> Map Text Text -> Either.Either Text Text
- type Files = Set FilePath
- type Url = String.String
- haddockUrl :: Files -> FilePath -> Text -> Maybe.Maybe Url
- symbolAnchor :: String.String -> String.String
conversion
class Textlike a where Source #
fromText :: Text -> a Source #
toString :: a -> String.String Source #
toByteString :: a -> ByteString.ByteString Source #
toLazyByteString :: a -> ByteString.Lazy.ByteString Source #
Instances
operations
unwords2 :: Textlike a => a -> a -> a Source #
Join the two pieces with a space, if they are non-empty.
join2 :: Textlike a => a -> a -> a -> a Source #
The 2 variants join two texts, but omit the separator if one is null.
enumeration :: (Textlike a, Monoid a, String.IsString a) => [a] -> a Source #
columns :: Int -> [[Text]] -> [Text] Source #
Format the given rows into columns, aligned vertically.
columnsSome :: Int -> [Either.Either Text [Text]] -> [Text] Source #
Like columns
, but some rows can opt out of formatting by being Left.
mapDelimited :: Bool -> Char.Char -> (Text -> Text) -> Text -> Text Source #
Apply a function to the contents delimited by the given Char. You can quote a delimiter with a backslash.
:: Bool | If false, a delimiter doesn't count if the text after it has a space. |
-> Char.Char | |
-> Text | |
-> [(Text, Maybe.Maybe Text)] |
This is more awkward than a parser, but... ok, maybe I should have used a parser.
interpolate
interpolate :: Text -> Map Text Text -> Either.Either Text Text Source #
Replace ${variable}
.
haddockUrl
type Url = String.String Source #
haddockUrl :: Files -> FilePath -> Text -> Maybe.Maybe Url Source #
This doesn't really belong here, but it can't go in Linkify
since
that's a main module.