Last active
September 5, 2022 15:45
-
-
Save i-am-the-slime/6ffc303b31f7941b01064c8f53188a55 to your computer and use it in GitHub Desktop.
Print two strings side-by-side for easy comparison
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment