CurryInfo: printf-3.0.0 / Data.Format.showInt

definition:
showInt :: ShowSpec Int
showInt t mf mw mp i = 
  -- convert to better format
  let flags           = convertFlags mf
      width           = convertWidth mw
      prec            = convertPrecision mp
      precPresent     = maybe False (\_ -> True) mp
      minusFlag       = getMinusFlag flags
      plusFlag        = getPlusFlag  flags
      zeroFlag        = getZeroFlag  flags
      spaceFlag       = getSpaceFlag flags
      hashFlag        = getHashFlag  flags
      -- convert to the right numeric system
      iToString       = case t of
                          'i' -> consistentShowInt i
                          'd' -> consistentShowInt i
                          'o' -> showIntAsOct i
                          'x' -> showIntAsHex i
                          'X' -> map toUpper (showIntAsHex i)
      isPositive      = head iToString /= '-'
      isSigned        = (||) (t == 'i') (t == 'd')
      iToStringPosi   = if isPositive then iToString else (tail iToString)
      -- apply precision
      applyPrecision  = fillWithCharsRightAlign prec '0' iToStringPosi
      afterPrecision  = if isPositive then applyPrecision
                                      else '-':applyPrecision
      -- apply flags
      afterPlusFlag   = if (plusFlag && isSigned && isPositive)
                          then '+':afterPrecision
                          else afterPrecision
      afterHashFlag   = if (not (isSigned) && hashFlag && i /= 0)
                          then case t of
                                'o' -> '0'    :afterPlusFlag
                                'x' -> '0':'x':afterPlusFlag
                                'X' -> '0':'X':afterPlusFlag
                          else afterPlusFlag
      afterSpaceFlag  = if (spaceFlag && isSigned && isPositive && not plusFlag)
                          then ' ':afterHashFlag
                          else afterHashFlag
      -- apply width
      afterWidth      = if minusFlag
                          then fillWithCharsLeftAlign width ' ' afterSpaceFlag
                        else let filler = if (zeroFlag && not (precPresent))
                                            then '0' else ' '
                             in fillWithCharsRightAlign width filler
                                  afterSpaceFlag
  -- result
  in afterWidth
demand:
no demanded arguments
deterministic:
deterministic operation
documentation:
--- The function showInt formats an Int
--- @param t - A char setting the way of number representation
--- @param mf - A string containing all flags
--- @param mw - The minimal number of characters to be printed
--- @param mp - The minimal number of numbers to be printed
--- @param i - The Int which should be formatted
--- @return A string containing the formatted Int
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,_,_,_,_) |-> _}
name:
showInt
precedence:
no precedence defined
result-values:
_
signature:
Prelude.Char -> Prelude.Maybe String -> Prelude.Maybe Prelude.Int
-> Prelude.Maybe Prelude.Int -> Prelude.Int -> String
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term