我已经过滤了[Maybe Text]类型以从列表中删除Nothing,现在我想将结果放在[Text]类型中,但编译器抱怨不兼容的类型:
(bd_rows_WDS :: [Only (Maybe Text)]) <- query conn qry_head_WDS (Only (name::String))
-- remove the records having N°BD NULL
let fltWDS :: [Only Text] = Prelude.filter (\(Only a) ->
case a of
Nothing -> False
Just a -> True)
bd_rows_WDS
Prelude> :load UpdateSidonie
[1 of 1] Compiling Main ( UpdateSidonie.hs, interpreted )
UpdateSidonie.hs:282:33: error:
• Couldn't match type ‘Maybe Text’ with ‘Text’
Expected type: [Only Text]
Actual type: [Only (Maybe Text)]
• In the expression:
Prelude.filter
(\ (Only a) …Run Code Online (Sandbox Code Playgroud) haskell ×1