Skip to content

Commit 8dc0d12

Browse files
committed
Use OverloadedStrings
1 parent 57555f5 commit 8dc0d12

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

cardano-wasm/src/Cardano/Wasm/Internal/Api/TypeScriptDefs.hs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
13
-- | This module defines a basic AST for generating TypeScript
24
-- declaration files, and basic pretty-printing functionality.
35
--
@@ -31,10 +33,10 @@ printTypeScriptFile tsFile = do
3133
buildMultilineComment :: Int -> [String] -> TLB.Builder
3234
buildMultilineComment indentLevel commentLines =
3335
let indentation = TLB.fromLazyText $ TL.replicate (fromIntegral indentLevel) " "
34-
bodyIndentation = indentation <> TLB.fromString " * "
35-
firstLine = indentation <> TLB.fromString "/**"
36+
bodyIndentation = indentation <> " * "
37+
firstLine = indentation <> "/**"
3638
indentedCommentLines = map (\line -> (bodyIndentation <>) . TLB.fromString $ line <> "\n") commentLines
37-
lastLine = indentation <> TLB.fromString " */"
39+
lastLine = indentation <> " */"
3840
in mconcat [firstLine, "\n", mconcat indentedCommentLines, lastLine]
3941

4042
-- | Represents the top-level structure of a TypeScript declaration file.
@@ -90,14 +92,14 @@ data DeclarationType
9092
-- | Creates a builder for a TypeScript declaration type and content.
9193
buildDeclarationType :: DeclarationType -> TLB.Builder
9294
buildDeclarationType (ExportDec isDefault symbolName) =
93-
TLB.fromString "export "
94-
<> TLB.fromString (if isDefault then "default " else "")
95+
"export "
96+
<> (if isDefault then "default " else "")
9597
<> TLB.fromString symbolName
96-
<> TLB.fromString ";"
98+
<> ";"
9799
buildDeclarationType (FunctionDec header) =
98-
TLB.fromString "declare function " <> buildFunctionHeader header <> TLB.fromString ";"
100+
"declare function " <> buildFunctionHeader header <> ";"
99101
buildDeclarationType (InterfaceDec name properties) =
100-
TLB.fromString "declare interface "
102+
"declare interface "
101103
<> TLB.fromString name
102104
<> " {"
103105
<> mconcat (map (\prop -> "\n" <> buildInterfaceContent prop <> "\n") properties)
@@ -131,7 +133,7 @@ buildFunctionHeader :: FunctionHeader -> TLB.Builder
131133
buildFunctionHeader (FunctionHeader name params returnType) =
132134
TLB.fromString name
133135
<> "("
134-
<> mconcatWith (TLB.fromString ", ") (map buildFunctionParam params)
136+
<> mconcatWith ", " (map buildFunctionParam params)
135137
<> "): "
136138
<> TLB.fromString returnType
137139

@@ -177,7 +179,7 @@ buildInterfaceContentType (InterfaceProperty name pType) =
177179
buildInterfaceContentType (InterfaceMethod name params returnType) =
178180
TLB.fromString name
179181
<> "("
180-
<> mconcatWith (TLB.fromString ", ") (map buildFunctionParam params)
182+
<> mconcatWith ", " (map buildFunctionParam params)
181183
<> "): "
182184
<> TLB.fromString returnType
183185
<> ";"

0 commit comments

Comments
 (0)