mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-26 13:02:50 -06:00
12 lines
283 B
Haskell
12 lines
283 B
Haskell
module GF.Infra.CompactPrint where
|
|
import Data.Char
|
|
|
|
compactPrint = tail . concat . map spaceIf . words
|
|
|
|
spaceIf w = case w of
|
|
_ | keyword w -> "\n" ++ w
|
|
c:cs | isAlpha c || isDigit c -> " " ++ w
|
|
_ -> w
|
|
|
|
keyword w = elem w ["cat","fun","lin","lincat","lindef","oper","param"]
|