yhccore-0.9.1: Yhc's Internal Core language.

Yhc.Core.UniqueName

Description

This module implements unique names in Yhc.Core.

Given a name, it can be dividied into [rest][digits]. The digits form a number (0 for no digits).

Given a set of names, they must all represent unique numbers.

Synopsis

Documentation

uniqueSplit :: String -> (String, Int)Source

Split a name into a prefix and a unique id. 0 means no trailing number.

uniqueJoin :: String -> Int -> StringSource

Given a name, and a unique id, join them together. Replaces any existing id.

uniqueFuncsSplit :: (FuncsSplitM CoreFuncName -> (CoreFunc -> FuncsSplitM ()) -> CoreExpr -> FuncsSplitM CoreExpr) -> Core -> CoreSource

A more advanced combinator to capture the pattern of splitting one function into many (i.e. recursive let's, lambda lifting)

Needs rank-2 types to do properly

uniqueFuncsRename :: Core -> CoreSource

Rename functions so they use consecutive numbers starting at 2, to aid human understanding