We present a new framework for transforming data representations in a
strongly typed intermediate language. Our method allows both value pro
ducers (sources) and value consumers (sinks) to support multiple repre
sentations, automatically inserting any required code. Specialized rep
resentations can be easily chosen for particular source/sink pairs. Th
e framework is based on these techniques: 1. Flow annotated types enco
de the ''flows-from'' (source) and ''flows-to'' (sink) information of
a flow graph. 2. Intersection and union types support (a) encoding pre
cise flow information, (b) separating flow information so that transfo
rmations can be well typed, (c) automatically reorganizing flow paths
to enable multiple representations. As an instance of our framework, w
e provide a function representation transformation that encompasses bo
th closure conversion and inlining. Our framework is adaptable to data
other than functions.