f# - How to add generated code to type provider -


i have f# function

generatecode params 

that generates code on f#(.fs file). , want write type provider, runs generatecode() , gives generated functions provided.

for example, function generated:

module calc  open operations let calculate b = add b 

and want have type provider provides such functionality:

type mytype = mytypeprovider<args> sum = mytype.calculate b 

upd main problem add generated code assembly , function names.

unfortunately, creating type provider not simple. rather generating source code, type providers need build implementation of interface , produce f# quotations (which data structure representing source code - linq expression trees).

for tutorial on implementing type providers, see michael newton's type providers ground up , follow type providers first floor.


Comments