Print two strings side-by-side for easy comparison

Mark Eibes
2022-09-05T15:19:22Z

PrintSideBySide.purs

| module Main where
|
| import Prelude
| import Data.Array (intercalate, zip)
| import Data.Foldable (fold)
| import Data.String.Utils (lines, padEnd)
| import Effect.Console (log)
| import Data.Tuple.Nested ((/\))
| import TryPureScript (render, code, text, p)
|
| printSideBySide :: String -> String -> String
| printSideBySide s1 s2 =
| (( lines s1 `zip` lines s2
| <#> \(l1 /\ l2) → padEnd 80 l1 <> l2
| ) # intercalate "\n")
|
| main = render $ p $ code $ text (printSideBySide "heinz" "dembo")