mirror of
https://github.com/sayo-hs/heftia.git
synced 2024-11-23 02:42:06 +03:00
[add] information about the 'Could not deduce KnownNat' error.
This commit is contained in:
parent
7f2f1984f8
commit
1794222905
@ -193,6 +193,9 @@ main =
|
||||
エフェクトクラス・リストに掛かる制約だ。
|
||||
関数を書いていて`Could not deduce (Forall HFunctor ...)`が出たら、関数の制約にこれを追加しよう。
|
||||
|
||||
また、`Could not deduce KnownNat`といったエラーは、制約を関数に追加せずとも
|
||||
`ghc-typelits-knownnat`プラグインを導入することで回避できるだろう。
|
||||
|
||||
そして`Hef`だが、これは`Fre` (Freer)に対する高階版、その名も**Heftia**(のモナドトランスフォーマー)である。
|
||||
FreerがFreeモナドとco-Yonedaの合成であるように、
|
||||
Heftiaはhefty treeとco-Yoneda(の高階版)の合成であり、高階エフェクトの取り扱いのために本ライブラリが新たに導入するものだ。
|
||||
|
@ -184,6 +184,8 @@ Also here, the function type has a slightly unusual structure.
|
||||
|
||||
First, the constraint `ForallHFunctor ...` is a constraint on the effect class list in `heftia-effects`, required throughout the library. If you encounter a `Could not deduce (Forall HFunctor ...)` error while writing a function, add this to the function's constraints.
|
||||
|
||||
Additionally, errors like `Could not deduce KnownNat` can be avoided by introducing the `ghc-typelits-knownnat` plugin without adding constraints to the function.
|
||||
|
||||
Then, there's `Hef`, which is a higher-order version of `Fre` (Freer) and is (a monad transformer) called **Heftia**. Just as Freer is a combination of the Free monad and co-Yoneda, Heftia is a combination of a hefty tree and a higher-order co-Yoneda. This is introduced by this library specifically for handling higher-order effects.
|
||||
|
||||
In `heftia-effects`, the system uses the Heftia transformer to handle higher-order effects. And the carriers for first-order effects (namely, Freer) are usually placed as subordinate carriers under the carriers for higher-order effects (namely, Heftia).
|
||||
|
Loading…
Reference in New Issue
Block a user