hafuu / fsharpapisearch Goto Github PK
View Code? Open in Web Editor NEWF# API search engine
License: MIT License
F# API search engine
License: MIT License
System.Tuple`2とか
System.Tupleと表示させたい
Search functions named map
map: _
Search functions named map and that has the signature
map: ('a -> 'b) -> 'a list -> 'b list
'a -> 'a で nativeptr<'T> -> 'T が出てくる
('a -> 'b) -> 'a option -> 'b option で Option.bind が出てくる
('a -> 'b option) -> 'a option -> 'b option で Option.map が出てくる
? -> ? -> string
引数を2つ受け取ってstring
を返す関数?a -> ?a -> string
同じ型の引数を2つ受け取ってstring
を返す関数!int
、!'a
'a -> 'a
というクエリで #seq<int> -> int
というシグネチャをテストすると失敗するはず<A, B> when A : B
の挙動に注意するQueryTypes.Tuple
はSystem.Tuple
として振る舞うLINK: https://msdn.microsoft.com/ja-jp/library/dd233203.aspx
'a
and int
: 1
int
and int
: 0
'a
and 'x -> 'y
: 2
ナドナド
警告にするなどしたほうが良いのでは?
type A() =
member this.Method (x: int) (y: int) -> 0
名前で検索すると
A.Method: int -> int -> int
と表示はされるが検索に出てこない
'a -> SomeClass
'a -> unit
intを受け取るActivePattern一覧とか取得できると嬉しい
op_Equality
を( = )
など
c<b<a>>
と同じ
example: System.String -> System.String
type A = A
with
member x.B() = 0
[<MeasureAnnotatedAbbreviationAttribute>]
に注意?string <-> System.String
Ref.contents
どっちにしよう?
(a,b,c)->d
クエリ
query : { syntax-list } : type
syntax-list : syntax | syntax ; syntax-list
syntax : let! | do! ...
制限
#103 型拡張を使ったコンピュテーション式
アプリを実行して初期化が完了するまでに時間が(@hafuuの環境で3.0秒)掛かる。
並列化して短くできないだろうか?
FSharpApiSearchClient.fs
のコンストラクタにStopwatchを挟む。その後ReleaseビルドしたFSharpApiSearch.Console
を実行する。
type FSharpApiSearchClient (targets: string seq, dictionaries: ApiDictionary seq) =
let sw = System.Diagnostics.Stopwatch.StartNew()
let targetAssemblies = dictionaries |> Seq.filter (fun x -> targets |> Seq.exists ((=)x.AssemblyName)) |> Seq.toList
let apis = targetAssemblies |> Seq.collect (fun x -> x.Api) |> Seq.cache
do apis |> Seq.iter (fun _ -> ())
let abbreviationTable = dictionaries |> Seq.collect (fun x -> x.TypeAbbreviations) |> Seq.toList
do sw.Stop(); printfn "%d [ms]" sw.ElapsedMilliseconds
x.Api
の評価をアセンブリ毎に並列化してみた。2.2秒に短縮された。
type FSharpApiSearchClient (targets: string seq, dictionaries: ApiDictionary seq) =
let sw = System.Diagnostics.Stopwatch.StartNew()
let targetAssemblies = dictionaries |> Seq.filter (fun x -> targets |> Seq.exists ((=)x.AssemblyName)) |> Seq.toList
let apis =
targetAssemblies
|> Seq.map (fun x -> async { return Seq.toArray x.Api })
|> Async.Parallel
|> Async.RunSynchronously
|> Seq.collect id
|> Seq.toArray
let abbreviationTable = dictionaries |> Seq.collect (fun x -> x.TypeAbbreviations) |> Seq.toList
do sw.Stop(); printfn "%d [ms]" sw.ElapsedMilliseconds
ApiLoader.fs
の317行目、FSharpEntity.MembersFunctionsAndValues
の呼び出しが遅いようだ。
namespace, module, class...
System.* : _
List.* : _
Collections.List.Head
ではなく
Collections.List<'T>.Head
type f = int -> int
FsYaml.CustomTypeDefinition.MaybeNull.constructFromScalar: (string -> '?6659) -> '?6660 -> '?6661 -> Type -> YamlObject -> obj, module value, distance: 0
CompilerServiceではC#のフィールドを読み込めないのでリフレクションを使ってフィールドを読み込む
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.