tokenify-0.1.2.0: A regex lexer

Safe HaskellNone
LanguageHaskell2010

Text.Tokenify.CharSeq

Description

An abstaction over string like data types to prevent restricting tokenizer to a particular data type, as there are many string types in haskell.

Synopsis

Documentation

class (Monoid a, Eq a) => CharSeq a where Source

This typeclass is designed to make the tokenizer more polymorphic, which is why it's a super set of both Monoid and Eq.

Methods

head :: a -> Maybe Char Source

The first char in a CharSeq

tail :: a -> a Source

Every char but the first in a CharSeq

cons :: Char -> a -> a Source

Pushes the to the head of a CharSeq

snoc :: a -> Char -> a Source

Pushes the to the end of a CharSeq

null :: a -> Bool Source

A CharSeq containing a single character

singleton :: Char -> a Source

Makes a CharSeq containing a single character

lineInfo :: a -> [Int] Source

Provides line information of a CharSeq

Instances

CharSeq Text

Enables Text to be used for tokenizer

CharSeq [Char]

the main purpose of this implemenation is make testing in the repl non-painful