GithubHelp home page GithubHelp logo

fsharpapisearch's People

Contributors

bleis-tift avatar forki avatar gab-km avatar hafuu avatar magu701 avatar nosami avatar pocketberserker avatar wallymathieu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fsharpapisearch's Issues

FSharpApiSearch can search functions.

Examples

  1. 'a -> 'b
    • match
      • 'a -> string
      • 'a -> 'a
      • 'a -> int * int
      • int * int -> int
      • ('a -> 'b) -> 'c
      • ('a -> 'b)
      • 'a -> ('b -> 'c)
    • not match
      • 'a -> 'b -> 'c
      • 'a -> ('b -> 'c) -> 'd
  2. 'a -> string
    • match
      • 'a -> string
      • int -> string
    • not match
      • string -> int
      • 'a -> 'b
  3. 'a seq -> 'b
    • match
      • 'a seq -> 'a
      • 'a seq -> int
    • not match
      • 'a list -> 'a

Search by function name

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

Constraints of generic parameter

  • 制約を考慮したマッチング、制約をロード
    • Subtype constraints
      • 'a -> 'a というクエリで #seq<int> -> int というシグネチャをテストすると失敗するはず
    • Nullness constraints
    • Member constraints
    • Default constructor constraints
    • Value type constraints
    • Reference type constraints
    • Equality constraints
      • array
    • Comparison constraints
      • array
      • IntPtr, UIntPtr
    • and (テスト書く)
  • 対応しないがロードだけする
    • Enumeration constraints
    • Delegate constraints
    • Unmanaged constraints
  • C# の制約をロードできるかテストする
    • <A, B> when A : Bの挙動に注意する
  • QueryTypes.TupleSystem.Tupleとして振る舞う
  • 結果に制約を表示する

LINK: https://msdn.microsoft.com/ja-jp/library/dd233203.aspx

Order by distance

'a and int : 1

int and int : 0

'a and 'x -> 'y: 2

ナドナド

Static method of class

  • classからstatic method を抽出する
  • classからstatic peroperty, field は抽出しない
  • classからF# constructorを抽出する 'a -> SomeClass
  • classからC# constructorを抽出する 'a -> unit
  • 内部クラスからstatic methodを抽出する
  • 'a -> 'b -> 'c というクエリで検索する

ActivePattern

intを受け取るActivePattern一覧とか取得できると嬉しい

Computation Expression

  • ある型に対応してる(っぽい)Builderクラスを探す
  • ある構文に対応している(っぽい)Builderクラスを探す

クエリ

query : { syntax-list } : type
syntax-list : syntax | syntax ; syntax-list
syntax : let! | do! ...
  • 検索
  • 結果に対応している構文一覧を出力する
  • CustomOperation

制限
#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の呼び出しが遅いようだ。

Searching scope

namespace, module, class...

Examples

System.* : _
List.* : _

Read C# Entities by System.Reflection

CompilerServiceではC#のフィールドを読み込めないのでリフレクションを使ってフィールドを読み込む

  • class
  • interface
  • constructor as static method
  • instance method
  • instance peroperty
  • instance field
  • static method
  • static property
  • static field
  • overloads
  • primitive type abbreviation (int, float ...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.