Interested in the question of how to get information about the functions that the module contains. I want to get something like what FSI issues.
For example for the following module
module Test = let ign _ = () let getNowDateTime() = System.DateTime.Now let getNumbers count = [1..count] FSI displays this information.
module Test = begin val ign : 'a -> unit val getNowDateTime : unit -> System.DateTime val getNumbers : count:int -> int list end I tried to get the data through reflection as follows.
let getInfoAboutModule (t : Type) = let genericToString (t : Type) = match t.GenericTypeArguments with | [| |] -> t.FullName | x -> x |> Seq.map (fun x -> x.Name) |> String.concat "," |> sprintf "%s<%s>" t.Name let getInfo (mi:MethodInfo) = let parameter = let sb = System.Text.StringBuilder() for x in mi.GetParameters() do x.ParameterType |> genericToString |> sprintf "%s : %s ->" x.Name |> sb.Append |> ignore sb.ToString() |> fun str -> if str |> System.String.IsNullOrEmpty then "unit -> " else str sprintf "%s : %s %s" mi.Name parameter (genericToString mi.ReturnType) t.GetMethods(BindingFlags.Public ||| BindingFlags.Static) |> Seq.map getInfo for the Test module, the result will be as follows
ign : _arg1 : -> System.Void getNowDateTime : unit -> System.DateTime getNumbers : count : System.Int32 -> FSharpList`1<Int32> but, naturally, so I receive names far from F # -s.
PS It is impossible to add any attributes to the module, since you need to leave the ability to extract data from modules from other assemblies.