percent-format-0.0.1: simple printf-style string formatting

Copyright(c) 2016-2018 Rudy Matela
License3-Clause BSD (see the file LICENSE)
MaintainerRudy Matela <rudy@matela.com.br>
Safe HaskellSafe
LanguageHaskell2010

Text.PercentFormat.Utils

Description

This file is part of PercentFormat a library for printf-style string formatting.

This module provides miscellaneous utility functions.

Synopsis

Documentation

maybeRead :: Read a => String -> Maybe a Source #

Reads a value encoded as a string, return Just the value or Nothing on error.

rightAlign :: Char -> Int -> String -> String Source #

rightAlign c w s aligns String s to the right in a field of width w using Char c as padding.

right ' ' 5 "123"

" 123"

leftAlign :: Char -> Int -> String -> String Source #

left c w s aligns String s to the left in a field of width w using Char c as padding.

left ' ' 5 "123"

"123 "

showWithBase :: Integral a => Int -> a -> String Source #

showWithBase b n returns a string representation of n in base b.

showWithBase 2 10

"1010" > showWithBase 16 49406 "c0f3" > showWithBase 10 (-1234) "-1234"

applyWhen :: Bool -> (a -> a) -> a -> a Source #

theLast :: Int -> [a] -> [a] Source #

loop :: [a] -> [a] Source #

Like cycle, but return an empty list when the source list is empty.

none :: (a -> Bool) -> [a] -> Bool Source #

integerToDigits :: Integral a => Int -> a -> [Int] Source #

Given an integer, returns a list of digits. Signal is ignored.