有没有办法在 Emacs 中使用 Djinn 来 auto-generate Haskell 代码?

Is there a way to use Djinn to auto-generate Haskell code in Emacs?

标题几乎说明了一切。我正在寻找这样的东西:

f :: Int -> Bool -> Int
f = _body

Djinn 可以使用定理证明通过证明类型是有人居住的来为这样的函数生成代码。

我想知道,是否存在从 Emacs 中获取此功能的现有方法?因此,我不是在我的代码中编写 TemplateHaskell,而是 运行 我的代码中的一个命令,它会插入生成的代码?

我安装了ghc-mod,但不是很熟悉

引用Serras的相关部分emacs guide:

This is nice, but in some cases ghc-mod can do even more for you: it can write your whole expression! It does so by leveraging the power of Djinn. For example, let's go back to the definition of maybeMap after splitting:

maybeMap Nothing f = _maybeMap_body

maybeMap (Just x) f = _maybeMap_body

If you press C-c C-a in each of the holes, several options for the code to be written there will be shown, including Nothing in the first case, and Nothing and Just x in the second case. You just need to select the code you want to include from a list, and it will be automatically completed. Note that this functionality becomes very handy when you need to work with expressions involving currying and tupling, because it takes care of obtaining a correctly-typed expression for you.

所以,是的,使用 Djinn 在某些情况下您可以编写完整的表达式。我没有亲自使用过它们,但在 Emacs 中似乎是可行的。