HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

ModuleAgda-2.8.0.2Haskell2010

Agda.Syntax.Parser.Alex

This module defines the things required by Alex and some other Alex related things.

Contents
  1. Alex requirements
  2. Lex actions
  3. Monad operations
Synopsis
  • PackageAgda-2.8.0.2
  • Exports15
  • LanguageHaskell2010
  • LicenceMIT
  • SourceAlex.hs

Alex requirements

Returns the next byte, and updates the AlexInput value.

A trick is used to handle the fact that there are more than 256 Unicode code points. The function translates characters to bytes in the following way:

  • Whitespace characters other than '\t' and '\n' are translated to ' '.

  • Non-ASCII alphabetical characters are translated to 'z'.

  • Other non-ASCII printable characters are translated to '+'.

  • Everything else is translated to '\1'.

Note that it is important that there are no keywords containing 'z', '+', ' ' or '\1'.

This function is used by Alex (version 3).

Lex actions

newtypenewtype LexAction r

In the lexer, regular expressions are associated with lex actions who's task it is to construct the tokens.

Instances4Monad, Functor, Applicative, MonadState

Monad operations