Kawaii-Parser-3.0.0: A simple parsing library and some additional utilities.
Safe HaskellNone
LanguageHaskell2010

Parser.Utilities

Description

  • Assorted utilities.
  • Relative directories and file paths.
Synopsis

Documentation

data Back Source #

Parent directory.

Constructors

Back 

Instances

Instances details
Show Back Source # 
Instance details

Defined in Parser.Utilities

Methods

showsPrec :: Int -> Back -> ShowS #

show :: Back -> String #

showList :: [Back] -> ShowS #

Eq Back Source # 
Instance details

Defined in Parser.Utilities

Methods

(==) :: Back -> Back -> Bool #

(/=) :: Back -> Back -> Bool #

Ord Back Source # 
Instance details

Defined in Parser.Utilities

Methods

compare :: Back -> Back -> Ordering #

(<) :: Back -> Back -> Bool #

(<=) :: Back -> Back -> Bool #

(>) :: Back -> Back -> Bool #

(>=) :: Back -> Back -> Bool #

max :: Back -> Back -> Back #

min :: Back -> Back -> Back #

data Directory Source #

Relative directory.

Constructors

Directory [Back] [String] 

data File_path Source #

Relative file path.

Instances

Instances details
Show File_path Source # 
Instance details

Defined in Parser.Utilities

Eq File_path Source # 
Instance details

Defined in Parser.Utilities

Ord File_path Source # 
Instance details

Defined in Parser.Utilities

(<->) :: String -> String -> String infixr 5 Source #

Concatenate strings with a whitespace in between.

(<//>) :: Directory -> File_path -> File_path infixr 6 Source #

Prepend a directory to file path.

all_equal :: Eq t => [t] -> Maybe (Maybe t) Source #

Checks if all elements of a list are equal. Returns Nothing if all elements aren't equal, Just Nothing if the list is empty and Just (Just x) if all elements are equal to x.

between :: Ord t => t -> t -> t -> Bool Source #

Check if the value is in bounds.

check :: MonadError error f => error -> Bool -> f () Source #

Throw an error if the condition is not satisfied.

check_ext :: String -> File_path -> Bool Source #

Check file path extension.

construct_map :: Ord t => [(t, u)] -> Maybe (Map t u) Source #

Construct a map if all keys are different. Otherwise return Nothing.

construct_set :: Ord t => [t] -> Maybe (Set t) Source #

Construct a set if all elements are different. Otherwise return Nothing.

drop_file_name :: File_path -> Directory Source #

Get the directory part of a file path.

element_at :: Int -> [t] -> Maybe t Source #

Safe list indexation.

lcm_all :: (Foldable f, Integral t) => f t -> t Source #

Aggregate least common denominator.

read_file :: File_path -> IO (Maybe String) Source #

Read a file.

swap_either :: Either t u -> Either u t Source #

Swap Left and Right.

write_file_path :: File_path -> FilePath Source #

Convert a file path to text.