You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
502 B
21 lines
502 B
module PrettyPrinter where |
|
import Data.Maybe |
|
import qualified Data.Set as Set |
|
|
|
{- Stars -} |
|
|
|
addsymbol :: Char -> Maybe Char -> [String] -> String |
|
addsymbol _ after [] = "" |
|
addsymbol sym after (w:ws) = w ++ go ws |
|
where |
|
go [] = "" |
|
go (v:vs) = |
|
case after of |
|
Nothing -> sym : (v ++ go vs) |
|
Just after' -> sym : after' : (v ++ go vs) |
|
|
|
addop :: Char -> [String] -> String |
|
addop op w = addsymbol op Nothing w |
|
|
|
addcomma :: [String] -> String |
|
addcomma = addsymbol ',' (Just ' ')
|
|
|