0

在我的组件中:

data Query a = SetImageUrl Int String a

主要(应用程序)组件:

  eval :: Query ~> H.ParentDSL State Query ChildQuery ChildSlot Void m
  eval = case _ of
    HandleItemChange groupId (LIS.ActiveChanged selected) next -> do
      let apReq = AP.SetImageUrl groupId (imageUrl selected)
      _ <- H.query' CP.cp2 AvatarPictureSlot (H.request apReq)
      pure next

编译器说:

[1/1 InfiniteType] src/App.purs:85:57

  85        _ <- H.query' CP.cp2 AvatarPictureSlot (H.request apReq)
                                                              ^^^^^

  An infinite type was inferred for an expression:

    t0 -> t0

  while trying to match type t0 -> t0
    with type t0
  while checking that expression apReq
    has type (t0 -> t0) -> t1 t0
  in value declaration app

  where t0 is an unknown type
        t1 is an unknown type

我认为插槽和子路径都可以,因为render函数可以编译并正常工作。

如何修复此错误?我对照指南检查了几次,但我根本看不出有任何区别,而且编译器消息对我来说非常无益(对我来说)。

4

1 回答 1

0

来自github的解决方案:

  _ <- H.query' CP.cp2 AvatarPictureSlot (H.action apReq)

对于不返回任何内容的查询,不应该H.action使用H.request

于 2018-11-11T13:46:56.950 回答