Introducing aspect orientation to a polymorphically typed functional language strengthens the importance of type-scoped advices; i.e., advices with their effects being harnessed by type constraints. As types are typically treated as compile time entities, it is desirable to be able to perform static weaving to determine at compile time the chaining of type-scoped advices to the invocations of their associated join points. In this paper, we describe a compilation model, as well as its implementation, that enables static type inference and static weaving of programs in an aspect-oriented polymorphically typed functional language, AspectFun . We describe a typedirected weaving scheme that successfully, and coherently, weaves type-scoped advices into base programs, in the presence of nested and second-order advices. We also demonstrate how control-flow based pointcuts (such as cflow and cflowbelow) are compiled away, and describe several type-directed optimization strategies that can i...