module Ribosome.Host.Text where import qualified Data.Text as Text import Exon (exon) import Text.Casing (pascal) ellipsize :: Int -> Text -> Text ellipsize :: Int -> Text -> Text ellipsize Int maxChars Text msg = [exon|#{pre}#{if Text.null post then "" else "..."}|] where (Text pre, Text post) = Int -> Text -> (Text, Text) Text.splitAt Int maxChars Text msg pascalCase :: ToString a => IsString b => a -> b pascalCase :: forall a b. (ToString a, IsString b) => a -> b pascalCase = String -> b forall a. IsString a => String -> a fromString (String -> b) -> (a -> String) -> a -> b forall b c a. (b -> c) -> (a -> b) -> a -> c . String -> String pascal (String -> String) -> (a -> String) -> a -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . a -> String forall a. ToString a => a -> String toString