packages feed

lambda-cube-0.1.0.0: src/LambdaCube/Common/PrettyPrinter.hs

{-# LANGUAGE OverloadedStrings #-}
module LambdaCube.Common.PrettyPrinter where

import           Data.Text (Text)
import qualified Data.Text as Text

wrapIfSpaced :: Bool -> [Text] -> Text
wrapIfSpaced b = wrapIf b . spaced

wrap :: Text -> Text
wrap t = "(" <> t <> ")"

wrapIf :: Bool -> Text -> Text
wrapIf True  = wrap
wrapIf False = id

spaced :: [Text] -> Text
spaced = Text.intercalate " "