module StrUtils (justifyLeft, justifyRight) where import Buf justifyLeft :: (Buf a) => Int -> Char -> a -> a justifyLeft :: forall a. Buf a => Int -> Char -> a -> a justifyLeft Int n Char c a s | Int diff forall a. Ord a => a -> a -> Bool <= Int 0 = a s | Bool otherwise = a s forall a. Semigroup a => a -> a -> a <> forall a. Buf a => Int -> Char -> a repeatN Int diff Char c where diff :: Int diff = Int n forall a. Num a => a -> a -> a - forall a. Buf a => a -> Int size a s justifyRight :: (Buf a) => Int -> Char -> a -> a justifyRight :: forall a. Buf a => Int -> Char -> a -> a justifyRight Int n Char c a s | Int diff forall a. Ord a => a -> a -> Bool <= Int 0 = a s | Bool otherwise = forall a. Buf a => Int -> Char -> a repeatN Int diff Char c forall a. Semigroup a => a -> a -> a <> a s where diff :: Int diff = Int n forall a. Num a => a -> a -> a - forall a. Buf a => a -> Int size a s