{-# LANGUAGE CPP #-}

{- |
Copyright: (c) 2020-2021 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <xrom.xkov@gmail.com>

This module contains short aliases for most frequently used pure functions.
-}

module Colourista.Short
    ( b
    , i
    , u
    ) where

import Data.ByteString (ByteString)
#if __GLASGOW_HASKELL__ < 804
import Data.Semigroup (Semigroup)
#endif
import Data.String (IsString)
import Data.Text (Text)

import Colourista.Pure (bold, formatWith, italic, underline)


-- | Short alias for 'bold'.
b :: (IsString str, Semigroup str) => str -> str
b :: str -> str
b = [str] -> str -> str
forall str. (IsString str, Semigroup str) => [str] -> str -> str
formatWith [str
forall str. IsString str => str
bold]
{-# SPECIALIZE b :: String -> String         #-}
{-# SPECIALIZE b :: Text -> Text             #-}
{-# SPECIALIZE b :: ByteString -> ByteString #-}

-- | Short alias for 'italic'.
i :: (IsString str, Semigroup str) => str -> str
i :: str -> str
i = [str] -> str -> str
forall str. (IsString str, Semigroup str) => [str] -> str -> str
formatWith [str
forall str. IsString str => str
italic]
{-# SPECIALIZE i :: String -> String         #-}
{-# SPECIALIZE i :: Text -> Text             #-}
{-# SPECIALIZE i :: ByteString -> ByteString #-}

-- | Short alias for 'underline'.
u :: (IsString str, Semigroup str) => str -> str
u :: str -> str
u = [str] -> str -> str
forall str. (IsString str, Semigroup str) => [str] -> str -> str
formatWith [str
forall str. IsString str => str
underline]
{-# SPECIALIZE u :: String -> String         #-}
{-# SPECIALIZE u :: Text -> Text             #-}
{-# SPECIALIZE u :: ByteString -> ByteString #-}