在elm中解构列表列表

在elm中解构列表列表,elm,Elm,我试图在elm(0.18)中对列表列表进行解构。下面是函数调用: twoColumns [ [ Widget1, Widget2 ] , [ Widget3, Widget4 ] ] 调用此函数的: twoColumns : List List Widget -> Html Msg twoColumns listoflists = case listoflists of listLeft :: listRight :: _

我试图在elm(0.18)中对列表列表进行解构。下面是函数调用:

  twoColumns
       [ [ Widget1, Widget2 ]
       , [ Widget3, Widget4 ]
       ]
调用此函数的:

twoColumns : List List Widget -> Html Msg
twoColumns listoflists =
   case listoflists of
      listLeft :: listRight :: _ ->
         div []
             [ div [ class "col-md-6" ] (parsingOperation listLeft)
             , div [ class "col-md-6" ] (parsingOperation listRight)
             ]
      _ ->
         div [] [ text "Error" ]
(假设parseOptions接受
列表小部件
作为参数。)

这看起来像是简单的解构,但我得到了一个错误:

Tag `::` is causing problems in this pattern match.

71|             listLeft :: listRight :: _ ->
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
The pattern matches things of type:

    List a

But the values it will actually be trying to match are:

    List List Widget
有什么想法吗


注意:当我尝试使用模式
(listLeft::listRight::)
时,elm格式将其还原为上面的模式。

列表小部件
应改为
列表(列表小部件)
。因为
列表小部件
的意思完全不同(而且毫无意义)。然而,这很有趣,为什么Elm编译器甚至允许
列表小部件
。我猜这是编译器的一个bug。

列表小部件
应该是
列表(列表小部件)
。因为
列表小部件
的意思完全不同(而且毫无意义)。然而,这很有趣,为什么Elm编译器甚至允许
列表小部件
。我猜这是编译器的一个bug