| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Parser.Utilities
Description
- Assorted utilities.
- Relative directories and file paths.
Synopsis
- data Back = Back
- data Directory = Directory [Back] [String]
- data File_path = File_path Directory String String
- (<->) :: String -> String -> String
- (<//>) :: Directory -> File_path -> File_path
- all_equal :: Eq t => [t] -> Maybe (Maybe t)
- between :: Ord t => t -> t -> t -> Bool
- check :: MonadError error f => error -> Bool -> f ()
- check_ext :: String -> File_path -> Bool
- construct_map :: Ord t => [(t, u)] -> Maybe (Map t u)
- construct_set :: Ord t => [t] -> Maybe (Set t)
- drop_file_name :: File_path -> Directory
- element_at :: Int -> [t] -> Maybe t
- lcm_all :: (Foldable f, Integral t) => f t -> t
- read_file :: File_path -> IO (Maybe String)
- swap_either :: Either t u -> Either u t
- write_file_path :: File_path -> FilePath
Documentation
Relative directory.
Instances
| Monoid Directory Source # | |
| Semigroup Directory Source # | |
| Show Directory Source # | |
| Eq Directory Source # | |
| Ord Directory Source # | |
Relative file path.
Instances
| Show File_path Source # | |
| Eq File_path Source # | |
| Ord File_path Source # | |
(<->) :: String -> String -> String infixr 5 Source #
Concatenate strings with a whitespace in between.
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.
check :: MonadError error f => error -> Bool -> f () Source #
Throw an error if the condition is not satisfied.
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.
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.