<div dir="ltr"><div class="gmail_default" style="font-size:large"><div class="gmail-adn gmail-ads"><div class="gmail-gs"><div class="gmail-"><div id="gmail-:279" class="gmail-ii gmail-gt"><div id="gmail-:278" class="gmail-a3s gmail-aXjCH"><div dir="ltr"><div class="gmail_default" style="font-size:large"><div class="gmail_default" style="font-size:large">i had filtered a
[Maybe Text] type to remove Nothing from the list and now i want to put
the result in a [Text] type but the compiler complains about the
incompatible type :</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large"> (bd_rows_WDS :: [Only (Maybe Text)]) <- query conn qry_head_WDS (Only (name::String))</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">-- remove the records having N°BD NULL<br> let fltWDS :: [Only Text] = Prelude.filter (\(Only a) -><br> case a of<br> Nothing -> False<br> Just a -> True)<br> bd_rows_WDS</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">Prelude> :load UpdateSidonie<br>[1 of 1] Compiling Main ( UpdateSidonie.hs, interpreted )<br><br>UpdateSidonie.hs:282:33: error:<br> • Couldn't match type ‘Maybe Text’ with ‘Text’<br> Expected type: [Only Text]<br> Actual type: [Only (Maybe Text)]<br> • In the expression:<br> Prelude.filter<br> (\ (Only a)<br> -> case a of<br> Nothing -> False<br> Just a -> True)<br> bd_rows_WDS<br> In a pattern binding:<br> fltWDS :: [Only Text]<br> = Prelude.filter<br> (\ (Only a)<br> -> case a of<br> Nothing -> False<br> Just a -> True)<br> bd_rows_WDS<br> In the expression:<br> do conn <- connect<br> defaultConnectInfo<br> {connectHost = "moita", connectUser = "mattei",<br> connectPassword = "sidonie2", connectDatabase = "sidonie"}<br> (rows :: [(Text, Double)]) <- query_<br> conn<br> "SELECT Nom,distance FROM AngularDistance WHERE distance > 0.000278"<br> (names :: [Only Text]) <- query_<br> conn<br> "SELECT Nom FROM AngularDistance WHERE distance > 0.000278"<br> let resLstNames = Prelude.map fromOnly names<br> ....<br> |<br>282 | let fltWDS :: [Only Text] = Prelude.filter (\(Only a) -><br> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^...<br>Failed, no modules loaded.<br></div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">how can id do the type conversion,now i'm sure there is no more Nothing values?</div></div></div><div class="gmail-adL">
</div></div></div></div></div></div><div class="gmail-gA gmail-gt gmail-acV"><div class="gmail-gB gmail-xu"><div class="gmail-ip gmail-iq"><div id="gmail-:27a"><table class="gmail-cf gmail-wS"><tbody><tr><td class="gmail-amq"><img id="gmail-:0_24" name=":0" src="https://plus.google.com/u/0/_/focus/photos/public/AIbEiAIAAABDCK3Mitic7rCiUiILdmNhcmRfcGhvdG8qKGE4MzM3OWQ1ZjJmZGY4MmJjYzIwZmY2YmYyMGQwZDk0NzQ2NTg3MWEwAZ9Fxw-tKAwFrDjeyCEpCYTOo4FL?sz=32" class="gmail-ajn gmail-bofPge"></td><td class="gmail-amr"><br></td></tr></tbody></table></div></div></div></div></div></div>