ddc-core-simpl-0.4.3.1: Disciplined Disciple Compiler code transformations.

Safe HaskellSafe
LanguageHaskell98

DDC.Core.Transform.AnonymizeX

Description

Rewrite all binders to anonymous deBruijn form.

Synopsis

Documentation

anonymizeX :: (Ord n, AnonymizeX c) => c n -> c n Source #

Rewrite all binders in a thing to anonymous form.

class AnonymizeX c where Source #

Minimal complete definition

anonymizeWithX

Methods

anonymizeWithX :: forall n. Ord n => Set n -> [Bind n] -> [Bind n] -> c n -> c n Source #

Rewrite all binders in a thing to be anonymous. The stacks contains existing anonymous binders that we have entered into, and named binders that we have rewritten. All bound occurrences of variables will be replaced by references into these stacks.

Instances

AnonymizeX Bind Source # 

Methods

anonymizeWithX :: Ord n => Set n -> [Bind n] -> [Bind n] -> Bind n -> Bind n Source #

AnonymizeX (Module a) Source # 

Methods

anonymizeWithX :: Ord n => Set n -> [Bind n] -> [Bind n] -> Module a n -> Module a n Source #

AnonymizeX (Exp a) Source # 

Methods

anonymizeWithX :: Ord n => Set n -> [Bind n] -> [Bind n] -> Exp a n -> Exp a n Source #

AnonymizeX (Alt a) Source # 

Methods

anonymizeWithX :: Ord n => Set n -> [Bind n] -> [Bind n] -> Alt a n -> Alt a n Source #

AnonymizeX (Cast a) Source # 

Methods

anonymizeWithX :: Ord n => Set n -> [Bind n] -> [Bind n] -> Cast a n -> Cast a n Source #

AnonymizeX (Witness a) Source # 

Methods

anonymizeWithX :: Ord n => Set n -> [Bind n] -> [Bind n] -> Witness a n -> Witness a n Source #

pushAnonymizeBindX Source #

Arguments

:: Ord n 
=> Set n

Don't anonymize binders with these names.

-> [Bind n]

Stack for Spec binders (level-1)

-> [Bind n]

Stack for Value and Witness binders (level-0)

-> Bind n 
-> ([Bind n], Bind n) 

Push a binding occurrence of a level-0 on the stack, returning the anonyized binding occurrence and the new stack.