私は、タスクリストを設定するためのさまざまなテルミットのチュートリアルに従っています。多くの説明を含む唯一のチュートリアルもかなり古くなっているので、現在のThermiteに合わせて変更しています。しかし、データ型を一致させることができない呼び出しが1つあります。エラーメッセージは、特に私はT.focus
に渡しています_tasks
パラメータについて話しているpurescriptの `Thermite.focus`に渡すためのレンズをどうやって作るのですか?
Could not match type p0 with type Function while trying to match type p0 t1 with type Function (List { text :: String } ) while checking that expression _tasks has type p0 t1 t1 -> p0 t2 t2 in value declaration taskList where p0 is a rigid type variable bound at line 213, column 20 - line 213, column 26 t1 is an unknown type t2 is an unknown type
:
import Optic.Lens (lens)
import Optic.Prism (prism)
import Optic.Types (Prism', Lens')
import Thermite as T
_TaskAction :: Prism' TaskListAction (Tuple Int TaskAction)
_TaskAction = ...
_tasks :: Lens' TaskListState (L.List TaskState)
_tasks = lens _.tasks (_ { tasks = _ })
taskList :: T.Spec _ TaskListState _ TaskListAction
taskList = T.focus _tasks _TaskAction taskSpec
しかし、これは私にエラーメッセージを表示します。しかし、私はエラーが私に言っているのか分からない。私はまた、T.focus
のための型シグネチャだから、最初のパラメータはレンズである...
focus :: forall eff props state2 state1 action1 action2.
Lens' state2 state1
-> Prism' action2 action1
-> Spec eff state1 props action1
-> Spec eff state2 props action2
であることを知っています。
私はもっとモダンな(しかし、より大きく理解しにくい)サンプルコードをチェックしました。これは私がここにあるように正確に同じ定義を_tasks
に示しています。
このエラーメッセージはどういう意味ですか、それを修正するために何をする必要がありますか?
不適切なレンズライブラリを使用しています。 Thermiteは 'profunctor-lenses'を使用しています。 –
これは完全に機能しました。それを回答に昇進させると、私はあなたに信用を与えます。 –