<div dir="auto">That's because you still have "Just a" values. Try mapMaybe from Data.Maybe instead. <br><br><div data-smartmail="gmail_signature"><br>On mobile; please excuse any tpyos.</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 3 Jan. 2019, 1:29 pm Damien Mattei <<a href="mailto:damien.mattei@gmail.com">damien.mattei@gmail.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:large">i repost because it seems that the first post of the year in haskell cafe ailing list has been lost! i cant't see in the archive of january neither december....</div><div class="gmail_default" style="font-size:large">so here it is again:<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 1, 2019 at 10:25 AM Damien Mattei <<a href="mailto:damien.mattei@gmail.com" target="_blank" rel="noreferrer">damien.mattei@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><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?<br></div></div></div></div></div>
</blockquote></div>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>