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

Safe HaskellSafe-Inferred

DDC.Core.Transform.TransformUpX

Contents

Description

General purpose tree walking boilerplate.

Synopsis

Documentation

class TransformUpMX m c whereSource

Methods

transformUpMXSource

Arguments

:: Ord n 
=> (KindEnv n -> TypeEnv n -> Exp a n -> m (Exp a n))

The worker function is given the current kind and type environments.

-> KindEnv n

Initial kind environment.

-> TypeEnv n

Initial type environment.

-> c a n

Transform this thing.

-> m (c a n) 

Bottom-up monadic rewrite of all core expressions in a thing.

Instances

Monad m => TransformUpMX m Alt 
Monad m => TransformUpMX m Lets 
Monad m => TransformUpMX m Exp 
Monad m => TransformUpMX m Module 

transformUpXSource

Arguments

:: forall c a n . (Ord n, TransformUpMX Identity c) 
=> (KindEnv n -> TypeEnv n -> Exp a n -> Exp a n)

The worker function is given the current kind and type environments.

-> KindEnv n

Initial kind environment.

-> TypeEnv n

Initial type environment.

-> c a n

Transform this thing.

-> c a n 

Bottom up rewrite of all core expressions in a thing.

transformUpX'Source

Arguments

:: forall c a n . (Ord n, TransformUpMX Identity c) 
=> (Exp a n -> Exp a n)

The worker function is given the current kind and type environments.

-> c a n

Transform this thing.

-> c a n 

Like transformUpX, but without using environments.

Via the Simple AST

transformSimpleUpMXSource

Arguments

:: (Ord n, TransformUpMX m c, Monad m) 
=> (KindEnv n -> TypeEnv n -> Exp a n -> m (Maybe (Exp a n)))

The worker function is given the current kind and type environments.

-> KindEnv n

Initial kind environment.

-> TypeEnv n

Initial type environment.

-> c a n

Transform thing thing.

-> m (c a n) 

Like transformUpMX, but the worker takes the Simple version of the AST.

  • To avoid repeated conversions between the different versions of the AST, the worker should return Nothing if the provided expression is unchanged.

transformSimpleUpXSource

Arguments

:: forall c a n . (Ord n, TransformUpMX Identity c) 
=> (KindEnv n -> TypeEnv n -> Exp a n -> Maybe (Exp a n))

The worker function is given the current kind and type environments.

-> KindEnv n

Initial kind environment.

-> TypeEnv n

Initial type environment.

-> c a n

Transform this thing.

-> c a n 

Like transformUpX, but the worker takes the Simple version of the AST.

  • To avoid repeated conversions between the different versions of the AST, the worker should return Nothing if the provided expression is unchanged.

transformSimpleUpX'Source

Arguments

:: forall c a n . (Ord n, TransformUpMX Identity c) 
=> (Exp a n -> Maybe (Exp a n))

The worker function is given the current kind and type environments.

-> c a n

Transform this thing.

-> c a n 

Like transformUpX', but the worker takes the Simple version of the AST.

  • To avoid repeated conversions between the different versions of the AST, the worker should return Nothing if the provided expression is unchanged.