tip-lib-0.2.2: tons of inductive problems - support library and tools

Safe HaskellNone
LanguageHaskell2010

Tip.Fresh

Description

Fresh monad and the Name type class

Synopsis

Documentation

newtype Fresh a Source

The Fresh monad

Constructors

Fresh (State Int a) 

freshPass :: (Foldable f, Name a) => (f a -> Fresh b) -> f a -> b Source

Continues making unique names after the highest numbered name in a foldable value.

freshFrom :: (Foldable f, Name b) => Fresh a -> f b -> a Source

Run fresh from starting from the greatest unique in a structure

runFresh :: Fresh a -> a Source

Run fresh, starting from zero

runFreshFrom :: Int -> Fresh a -> a Source

Run fresh from some starting value

class (PrettyVar a, Ord a) => Name a where Source

The Name type class

Minimal complete definition

fresh, getUnique

Methods

fresh :: Fresh a Source

Make a fresh name

refresh :: a -> Fresh a Source

Refresh a name, which could have some resemblance to the original name

freshNamed :: String -> Fresh a Source

Make a fresh name that can incorporate the given string

refreshNamed :: String -> a -> Fresh a Source

Refresh a name with an additional hint string

getUnique :: a -> Int Source

Gets the unique associated with a name.

Instances