turingMachine-1.0.0.0: An implementation of Turing Machine and Automaton

Copyright(c) Jorge Santiago Alvarez Cuadros 2016
LicenseGPL-3
Maintainersanjorgek@ciencias.unam.mx
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Label

Contents

Description

Simple Label-State function, have an isomorphism with Maybe but order are diferent

Synopsis

Data and type

data Label a Source #

Machine states are only a label, maybe a letter

Constructors

Q a

State constructor

QE

Error state

Instances

Monad Label Source #

Same as Maybe

Methods

(>>=) :: Label a -> (a -> Label b) -> Label b #

(>>) :: Label a -> Label b -> Label b #

return :: a -> Label a #

fail :: String -> Label a #

Functor Label Source #

Same as Maybe

Methods

fmap :: (a -> b) -> Label a -> Label b #

(<$) :: a -> Label b -> Label a #

Applicative Label Source #

Same as Maybe

Methods

pure :: a -> Label a #

(<*>) :: Label (a -> b) -> Label a -> Label b #

liftA2 :: (a -> b -> c) -> Label a -> Label b -> Label c #

(*>) :: Label a -> Label b -> Label b #

(<*) :: Label a -> Label b -> Label a #

Foldable Label Source # 

Methods

fold :: Monoid m => Label m -> m #

foldMap :: Monoid m => (a -> m) -> Label a -> m #

foldr :: (a -> b -> b) -> b -> Label a -> b #

foldr' :: (a -> b -> b) -> b -> Label a -> b #

foldl :: (b -> a -> b) -> b -> Label a -> b #

foldl' :: (b -> a -> b) -> b -> Label a -> b #

foldr1 :: (a -> a -> a) -> Label a -> a #

foldl1 :: (a -> a -> a) -> Label a -> a #

toList :: Label a -> [a] #

null :: Label a -> Bool #

length :: Label a -> Int #

elem :: Eq a => a -> Label a -> Bool #

maximum :: Ord a => Label a -> a #

minimum :: Ord a => Label a -> a #

sum :: Num a => Label a -> a #

product :: Num a => Label a -> a #

Bounded a => Bounded (Label a) Source #

In this differ with Maybe because this show a upper bounded order

Methods

minBound :: Label a #

maxBound :: Label a #

Enum a => Enum (Label a) Source #

Holds

>>> QE /= (toEnum:: State Int) . fromEnum QE
True

Methods

succ :: Label a -> Label a #

pred :: Label a -> Label a #

toEnum :: Int -> Label a #

fromEnum :: Label a -> Int #

enumFrom :: Label a -> [Label a] #

enumFromThen :: Label a -> Label a -> [Label a] #

enumFromTo :: Label a -> Label a -> [Label a] #

enumFromThenTo :: Label a -> Label a -> Label a -> [Label a] #

Eq a => Eq (Label a) Source # 

Methods

(==) :: Label a -> Label a -> Bool #

(/=) :: Label a -> Label a -> Bool #

Ord a => Ord (Label a) Source # 

Methods

compare :: Label a -> Label a -> Ordering #

(<) :: Label a -> Label a -> Bool #

(<=) :: Label a -> Label a -> Bool #

(>) :: Label a -> Label a -> Bool #

(>=) :: Label a -> Label a -> Bool #

max :: Label a -> Label a -> Label a #

min :: Label a -> Label a -> Label a #

Show a => Show (Label a) Source # 

Methods

showsPrec :: Int -> Label a -> ShowS #

show :: Label a -> String #

showList :: [Label a] -> ShowS #

Monoid a => Monoid (Label a) Source # 

Methods

mempty :: Label a #

mappend :: Label a -> Label a -> Label a #

mconcat :: [Label a] -> Label a #

type Final a = Set (Label a) Source #

Final label state represent a set of states which elements put end to computation

Functions

isError :: Eq a => Label a -> Bool Source #

Tells if a label state is a error state

terminal :: Ord a => Final a -> Label a -> Bool Source #

Tells if a label state is final

Alias

type SetLabel a = Set (Label a) Source #

Alias for a set of lalbel states

type LabelSS a = Label (SetLabel a) Source #

Alias for a label state of a set of label states