haskell-token-utils-0.0.0.1: Utilities to tie up tokens to an AST

Safe HaskellSafe-Inferred

Language.Haskell.TokenUtils.API

Synopsis

Documentation

class Show a => IsToken a whereSource

The IsToken class captures the different token type in use. For GHC it represents the type returned by getRichTokenStream, namely [(GHC.Located GHC.Token, String)] For haskell-src-exts this is the reult of lexTokenStream, namely `[HSE.Loc HSE.Token]`

Methods

getSpan :: a -> SpanSource

putSpan :: a -> Span -> aSource

tokenLen :: a -> IntSource

tokenLen returns the length of the string representation of the token, not just the difference in the location, as the string may have changed without the position being updated, e.g. in a renaming

isComment :: a -> BoolSource

isEmpty :: a -> BoolSource

Zero-length tokens, as appear in GHC as markers

isDo :: a -> BoolSource

isElse :: a -> BoolSource

isIn :: a -> BoolSource

isLet :: a -> BoolSource

isOf :: a -> BoolSource

isThen :: a -> BoolSource

isWhere :: a -> BoolSource

tokenToString :: a -> StringSource

showTokenStream :: [a] -> StringSource

class HasLoc a whereSource