ogma-extra-1.14.0: Ogma: Helper tool to interoperate between Copilot and other languages.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.String.Extra

Contents

- Safe I/O
- String transformation
- String sanitization

Description

Auxiliary functions for working with values of type `String`.

Synopsis

- safeReadFile :: FilePath -> IO (Either String String)
- pascalCase :: String -> String
- sanitizeLCIdentifier :: String -> String
- sanitizeUCIdentifier :: String -> String

# Safe I/O

safeReadFile :: FilePath -> IO (Either String String) Source #

Safely read a file into a `String`, returning a `Left` error message if the file cannot be opened.

# String transformation

pascalCase :: String -> String Source #

Convert a string with underscores to PascalCase.

# String sanitization

sanitizeLCIdentifier :: String -> String Source #

Remove extraneous characters from an identifier and make the starting character lowercase.

This function currently replaces hyphens with underscores.

sanitizeUCIdentifier :: String -> String Source #

Remove extraneous characters from an identifier and make the starting character uppercase.

This function currently replaces hyphens with underscores.