bond-0.11.0.3: Bond schema compiler and code generator

Language.Bond.Codegen.Util

Contents

Description

Helper functions for creating common structures useful in code generation. These functions often operate on Text objects.

Synopsis

# Documentation

commonHeader :: ToText a => a -> a -> a -> Text Source #

Returns common header for generated files using specified single-line comment lead character(s) and a file name.

commaSep :: (a -> Text) -> [a] -> Text Source #

Separates elements of a list with a comma.

newlineSep :: Int64 -> (a -> Text) -> [a] -> Text Source #

Separates elements of a list with new lines. Starts new lines at the specified indentation level.

commaLineSep :: Int64 -> (a -> Text) -> [a] -> Text Source #

Separates elements of a list with comma followed by a new line. Starts new lines at the specified indentation level.

newlineSepEnd :: Int64 -> (a -> Text) -> [a] -> Text Source #

Separates elements of a list with new lines, ending with a new line. Starts new lines at the specified indentation level.

newlineBeginSep :: Int64 -> (a -> Text) -> [a] -> Text Source #

Separates elements of a list with new lines, beginning with a new line. Starts new lines at the specified indentation level.

doubleLineSep :: Int64 -> (a -> Text) -> [a] -> Text Source #

Separates elements of a list with two new lines. Starts new lines at the specified indentation level.

doubleLineSepEnd :: Int64 -> (a -> Text) -> [a] -> Text Source #

Separates elements of a list with two new lines, ending with two new lines. Starts new lines at the specified indentation level.

uniqueName :: String -> [String] -> String Source #

Given an intended name and a list of already taken names, returns a unique name. Assumes that it's legal to append digits to the end of the intended name.

uniqueNames :: [String] -> [String] -> [String] Source #

Given a list of names with duplicates and a list of reserved names, create a list of unique names using the uniqueName function.

Converts all file path slashes to forward slashes.

# Orphan instances

 Source # Methods Source # Methods Source # Methods