Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
インタラクティブシェルと(オンライン)REPLで入力できます
:type 1
式「1」の型を調べます。同じ効果を得るためにコードから使用できる関数はありますか?
現時点では、これを行う簡単な方法はありません。
しかし、REPL自体はFregeで書かれているので、確かに可能です。
「トリック」は、次のような完全なプログラムを構築することです
module Foo where { x = 1 }
型チェック パスまでの最初のコンパイラ パスを実行します。その後、最上位のシンボルxとそのタイプをシンボル テーブルに問い合わせることができます。
x