Agda-2.5.2: A dependently typed functional programming language and proof assistant

Safe Haskell | Safe
Language | Haskell2010

Agda.Utils.Suffix

Synopsis

- isSubscriptDigit :: Char -> Bool
- toSubscriptDigit :: Char -> Char
- fromSubscriptDigit :: Char -> Char
- data Suffix
  - = NoSuffix
  - | Prime Int
  - | Index Int
  - | Subscript Int
- nextSuffix :: Suffix -> Suffix
- suffixView :: String -> (String, Suffix)
- addSuffix :: String -> Suffix -> String
- nameVariant :: (String -> Bool) -> String -> String

# Documentation

isSubscriptDigit :: Char -> Bool #

Is the character one of the subscripts `'₀'`-`'₉'`?

toSubscriptDigit :: Char -> Char #

Converts `'0'`-`'9'` to `'₀'`-`'₉'`.

Precondition: The digit needs to be in range.

fromSubscriptDigit :: Char -> Char #

Converts `'₀'`-`'₉'` to `'0'`-`'9'`.

Precondition: The digit needs to be in range.

data Suffix #

Classification of identifier variants.

Constructors

NoSuffix |
Prime Int | Identifier ends in `Int` many primes.
Index Int | Identifier ends in number `Int` (ordinary digits).
Subscript Int | Identifier ends in number `Int` (subscript digits).

nextSuffix :: Suffix -> Suffix #

Increase the suffix by one. If no suffix yet, put a subscript `1`.

suffixView :: String -> (String, Suffix) #

Parse suffix.

addSuffix :: String -> Suffix -> String #

Print suffix.

nameVariant #

Arguments

:: (String -> Bool) | Is the given name already taken?
-> String | Name of which we want an available variant.
-> String | Name extended by suffix that is not taken already.

Add first available `Suffix` to a name.