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.
- uniqueNamesNext :: [String] -> Int
- uniqueSplit :: String -> (String, Int)
- uniqueJoin :: String -> Int -> String
- uniqueFuncsNext :: Core -> Int
- uniqueFuncsSplit :: (FuncsSplitM CoreFuncName -> (CoreFunc -> FuncsSplitM ()) -> CoreExpr -> FuncsSplitM CoreExpr) -> Core -> Core
- uniqueFuncsRename :: Core -> Core
Documentation
uniqueNamesNext :: [String] -> IntSource
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.
uniqueFuncsNext :: Core -> IntSource
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