[Haskell-cafe] concatenate two Maybe String...

Steven Shaw steven at steshaw.org
Tue Jan 8 00:43:05 UTC 2019


A quick and dirty answer might be:

  fmap (Data.Text.intercalate ".") resBDwords

I'd probably write it:

  Data.Text.intercalate "." <$> resBDwords

but you'd probably want to check your input has exactly two elements. You
could use pattern matching:

  f (Just [a, b]) = Just $ a <> "." <> b
  f _             = Nothing

Then (f resBDwords) gives you what you want I think and avoids head and
tail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20190108/8fb9929c/attachment.html>


More information about the Haskell-Cafe mailing list