Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 错误,出现意外的{。我刚刚注意到解决这个问题的另一种方法是使用ScopedTypeVariables,就像我最初在问题中尝试的那样。我只是缺少为所有m添加。到文本字段的类型签名,我没有意识到将变量添加到范围是必要的。但是,类型应用程序似乎很酷。而且,无论哪_Haskell_Ghc_Yesod_Yesod Forms - Fatal编程技术网

Haskell 错误,出现意外的{。我刚刚注意到解决这个问题的另一种方法是使用ScopedTypeVariables,就像我最初在问题中尝试的那样。我只是缺少为所有m添加。到文本字段的类型签名,我没有意识到将变量添加到范围是必要的。但是,类型应用程序似乎很酷。而且,无论哪

Haskell 错误,出现意外的{。我刚刚注意到解决这个问题的另一种方法是使用ScopedTypeVariables,就像我最初在问题中尝试的那样。我只是缺少为所有m添加。到文本字段的类型签名,我没有意识到将变量添加到范围是必要的。但是,类型应用程序似乎很酷。而且,无论哪,haskell,ghc,yesod,yesod-forms,Haskell,Ghc,Yesod,Yesod Forms,错误,出现意外的{。我刚刚注意到解决这个问题的另一种方法是使用ScopedTypeVariables,就像我最初在问题中尝试的那样。我只是缺少为所有m添加。到文本字段的类型签名,我没有意识到将变量添加到范围是必要的。但是,类型应用程序似乎很酷。而且,无论哪种方式,链接第一次提到的I.textField的m都是不必要的,因为它除了将m作为参数传递给类型族之外,还以另一种方式使用它,这使得它已经被很好地链接了。我做这些评论是为了将来读者的利益。@JoL Note你可以用你最终得到的解决方案来回答你自


错误,出现意外的
{
。我刚刚注意到解决这个问题的另一种方法是使用
ScopedTypeVariables
,就像我最初在问题中尝试的那样。我只是缺少为所有m添加
文本字段的类型签名,我没有意识到将变量添加到范围是必要的。但是,
类型应用程序
似乎很酷。而且,无论哪种方式,链接第一次提到的
I.textField
m
都是不必要的,因为它除了将
m
作为参数传递给类型族之外,还以另一种方式使用它,这使得它已经被很好地链接了。我做这些评论是为了将来读者的利益。@JoL Note你可以用你最终得到的解决方案来回答你自己的问题。因此,政府的政策允许这样做,这正是为了未来读者的利益。好吧,这个问题的重点是理解正在发生的事情,而不是找到解决方案,因为当我问qu时,我已经找到了一个解决办法,尽管不理解它为什么有效我想我无法解释发生了什么,比你在这里解释得更好。
textField
  :: ( Monad m
     , RenderMessage (HandlerSite m) FormMessage
     )
  => Field m Text
textField = I.textField
    { fieldView = fieldView I.textField
    }
Foo.hs:37:19: error:
    • Couldn't match type ‘HandlerSite m0’ with ‘HandlerSite m’
      Expected type: FieldViewFunc m Text
        Actual type: FieldViewFunc m0 Text
      NB: ‘HandlerSite’ is a type function, and may not be injective
      The type variable ‘m0’ is ambiguous
    • In the ‘fieldView’ field of a record
      In the expression: I.textField {fieldView = fieldView I.textField}
      In an equation for ‘textField’:
          textField = I.textField {fieldView = fieldView I.textField}
    • Relevant bindings include
        textField :: Field m Text
          (bound at Foo.hs:36:1)
textField
  :: ( Monad m
     , RenderMessage (HandlerSite m) FormMessage
     )
  => Field m Text
textField = f
    { fieldView = fieldView
    }
  where
    f@Field {..} = I.textField
textField
  :: ( Monad m
     , RenderMessage (HandlerSite m) FormMessage
     )
  => Field m Text
textField = I.textField
    { fieldView = fieldView
    }
  where
    Field {..} = I.textField
textField
  :: ( Monad m
     , RenderMessage (HandlerSite m) FormMessage
     )
  => Field m Text
textField = (I.textField :: Field m Text)
    { fieldView = fieldView (I.textField :: Field m Text)
    }
textField
  :: ( Monad m
     , RenderMessage (HandlerSite m) FormMessage
     )
  => Field m Text
textField = f
    { fieldView = fieldView f
    }
  where
    f = I.textField
type family F a
type instance F Int  = String
type instance F Bool = String
foo :: F a -> SomeResultType
foo "some string"
bar (foo "string") (foo "string")
x :: forall a . F a
foo (x :: F Int)
foo (x :: String)
foo (x :: F Bool)
Couldn't match type ‘HandlerSite m0’ with ‘HandlerSite m’
    Expected type: FieldViewFunc m Text
    Actual type:   FieldViewFunc m0 Text
NB: ‘HandlerSite’ is a type function, and may not be injective
textField :: forall m . 
     ( Monad m
     , RenderMessage (HandlerSite m) FormMessage
     )
     => Field m Text
textField = I.textField @ m
    { fieldView = fieldView (I.textField @ m)
    }