| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
BNFC.Backend.Agda.Utilities.Utils
Synopsis
- data ImportNumeric
- imports :: ImportNumeric -> Bool -> Bool -> Bool -> Doc ()
- importPragmas :: Bool -> [ModuleName] -> Doc ()
- sanitize :: String -> String
- data ConstructorStyle
- nameSuggestion :: Type -> String
- nameFor :: String1 -> String
- numberUniquely :: forall a. Ord a => [a] -> [(Maybe Int, a)]
- type Frequency a = Map a Int
- incr :: Ord a => a -> Frequency a -> Frequency a
- uArrow :: String
Documentation
data ImportNumeric Source #
Import the builtin numeric types (content of some token categories)?
Constructors
| YesImportNumeric | Import the numeric types. |
| NoImportNumeric | Don't import the numeric types. |
Instances
| Eq ImportNumeric Source # | |
Defined in BNFC.Backend.Agda.Utilities.Utils Methods (==) :: ImportNumeric -> ImportNumeric -> Bool Source # (/=) :: ImportNumeric -> ImportNumeric -> Bool Source # | |
Arguments
| :: ImportNumeric | Import also numeric types? |
| -> Bool | If have layout, import booleans. |
| -> Bool | If have position information, import natural numbers. |
| -> Bool | Do we need |
| -> Doc () |
Arguments
| :: Bool | Do we use position information? |
| -> [ModuleName] | Haskell modules to import. |
| -> Doc () |
data ConstructorStyle Source #
How to print the types of constructors in Agda?
Constructors
| UnnamedArg | Simply typed, like |
| NamedArg | Dependently typed, like |
nameSuggestion :: Type -> String Source #
Suggest the name of a bound variable of the given category.
>>>map nameSuggestion[ ListType (BaseType (BaseCat 'S':|"tm")), BaseType (TokenCat 'V':|"ar"), (BaseType (BaseCat 'E':|"xp") ] ["ss","x","e"]
nameFor :: String1 -> String Source #
Suggest the name of a bound variable of the given base category.
>>>map nameFor ["Stm","ABC","#String"]["s","a","s"]
numberUniquely :: forall a. Ord a => [a] -> [(Maybe Int, a)] Source #
Number duplicate elements in a list consecutively, starting with 1.
>>>numberUniquely ["a", "b", "a", "a", "c", "b"][(Just 1,"a"),(Just 1,"b"),(Just 2,"a"),(Just 3,"a"),(Nothing,"c"),(Just 2,"b")]
type Frequency a = Map a Int Source #
A frequency map.
NB: this type synonym should be local to numberUniquely, but
Haskell lacks local type synonyms.
https://gitlab.haskell.org/ghc/ghc/issues/4020