| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Bytes.Formatting.Base
Description
Provides types for abstracting over formatters.
Since: 0.1
Synopsis
- class Formatter a where
- data IntegralFormatter = MkIntegralFormatter
- newtype FloatingFormatter = MkFloatingFormatter (Maybe Word8)
- type family BaseFormatter a
- formatBase :: (BaseFormatter a ~ f, Formatter f, PrintfArg a) => f -> a -> Text
- data CaseFormat
- _CaseFormatLower :: Prism' CaseFormat ()
- _CaseFormatTitle :: Prism' CaseFormat ()
- _CaseFormatUpper :: Prism' CaseFormat ()
- caseFormatToFn :: CaseFormat -> Text -> Text
Abstracting over formatters
class Formatter a where Source #
Maps the formatter to its format string.
Since: 0.1
Instances
| Formatter FloatingFormatter Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Base Methods formatStr :: FloatingFormatter -> Text Source # | |
| Formatter IntegralFormatter Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Base Methods formatStr :: IntegralFormatter -> Text Source # | |
| Formatter DirectedFormatter Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Direction Methods formatStr :: DirectedFormatter -> Text Source # | |
| Formatter SizedFormatter Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Size Methods formatStr :: SizedFormatter -> Text Source # | |
data IntegralFormatter Source #
Formatter for integral types.
Since: 0.1
Constructors
| MkIntegralFormatter |
Instances
| Formatter IntegralFormatter Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Base Methods formatStr :: IntegralFormatter -> Text Source # | |
newtype FloatingFormatter Source #
Formatter for floating types. Takes an optional param for rounding digits.
Since: 0.1
Constructors
| MkFloatingFormatter (Maybe Word8) |
Instances
| Formatter FloatingFormatter Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Base Methods formatStr :: FloatingFormatter -> Text Source # | |
type family BaseFormatter a Source #
Relates a "base" value with its given formatter. This is used to enforce
type-safe formatting e.g. floating types can only be used with
FloatingFormatter.
Since: 0.1
Instances
formatBase :: (BaseFormatter a ~ f, Formatter f, PrintfArg a) => f -> a -> Text Source #
Formats a value to a string. BaseFormatter is used to enforce
type-safety.
Since: 0.1
Common formatting types
data CaseFormat Source #
Case formatting.
Since: 0.1
Constructors
| CaseFormatLower | Since: 0.1 |
| CaseFormatTitle | Since: 0.1 |
| CaseFormatUpper | Since: 0.1 |
Instances
| Show CaseFormat Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Base Methods showsPrec :: Int -> CaseFormat -> ShowS # show :: CaseFormat -> String # showList :: [CaseFormat] -> ShowS # | |
| Eq CaseFormat Source # | Since: 0.1 |
Defined in Data.Bytes.Formatting.Base | |
_CaseFormatLower :: Prism' CaseFormat () Source #
Since: 0.1
_CaseFormatTitle :: Prism' CaseFormat () Source #
Since: 0.1
_CaseFormatUpper :: Prism' CaseFormat () Source #
Since: 0.1
caseFormatToFn :: CaseFormat -> Text -> Text Source #
Since: 0.1