/
StringUtils.hs
33 lines (27 loc) · 980 Bytes
/
StringUtils.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
----------------------------------------------------------------------------
-- |
-- Module : DART.Util.StringUtils
-- Copyright : (c) Carlos López-Camey, University of Freiburg
-- License : BSD-3
--
-- Maintainer : c.lopez@kmels.net
-- Stability : stable
--
--
-- This module contains combinators for strings, used to pretty print
-----------------------------------------------------------------------------
module DART.Util.StringUtils(separateWithSpaces,
separateWithNewLines) where
--------------------------------------------------------------------------------
-- prelude
import Data.List(intercalate)
space,newLine :: String
space = " "
newLine = "\n"
intercalateWith :: [String] -> String -> String
intercalateWith = flip intercalate
separateWithSpaces :: [String] -> String
separateWithSpaces = intercalate space . filter (not . (==) empty_str)
where
empty_str = ""
separateWithNewLines = intercalate newLine