Sorry, I corrected the original post to make it runable. I looked at compiled JS code and I think it is a problem with logShow. It has it’s own custom formatting for arrays.
Thank you for the prompt reply. I was able to get desired output with log as you suggested. Here is the solution using joinWith helper function to convert Array String -> String
module Main
( formatLinks
, main
)
where
import Prelude
import Data.String (joinWith)
import Effect (Effect)
import Effect.Console (log)
formatLinks :: Array String -> Array String
formatLinks ss =
map (\s -> "<a"
<> " src=\"" <> s <> "\""
<> "</a>") ss
main :: Effect Unit
main = do
formatLinks ["link1", "link2"]
# joinWith "\n"
# log
yes that is a nice solution - I’d personally do formatLink instead and use map with it - and I would throw in fold (here from the 'purescript-arrays` package) to make the concat a bit nicer:
import Data.Array (fold)
import Data.String.Common (joinWith)
import Effect (Effect)
import Effect.Console (log)
formatLink :: String → String
formatLink s =
fold [ "<a src=\"", s, "\">" ]
main :: Effect Unit
main = do
log $ joinWith ", " $ map formatLink $ [ "link1", "link2" ]