@@ -48,13 +48,13 @@ literals = mkPattern' match'
48 match (BooleanLiteral _ True) = return $ emit "true"
48 match (BooleanLiteral _ True) = return $ emit "true"
49 match (BooleanLiteral _ False) = return $ emit "false"
49 match (BooleanLiteral _ False) = return $ emit "false"
50 match (ArrayLiteral _ xs) = mconcat <$> sequence
50 match (ArrayLiteral _ xs) = mconcat <$> sequence
51− [ return $ emit "array_t{"
51+ [ return . emit $ arrayType <> "{"
52 , intercalate (emit ", ") <$> forM xs prettyPrintCpp'
52 , intercalate (emit ", ") <$> forM xs prettyPrintCpp'
53 , return $ emit "}"
53 , return $ emit "}"
55 -- match (ObjectLiteral _ []) = return $ emit "std::initializer_list<std::pair<const string, boxed>>{}"
55 -- match (ObjectLiteral _ []) = return $ emit "std::initializer_list<std::pair<const string, boxed>>{}"
56 match (ObjectLiteral _ ps) = mconcat <$> sequence
56 match (ObjectLiteral _ ps) = mconcat <$> sequence
57− [ return $ emit "dict_t{\n"
57+ [ return . emit $ dictType <> "{\n"
58 , withIndent $ do
58 , withIndent $ do
59 cpps <- forM ps $ \(key, value) -> do
59 cpps <- forM ps $ \(key, value) -> do
60 value' <- prettyPrintCpp' value
60 value' <- prettyPrintCpp' value
@@ -384,9 +384,9 @@ prettyPrintCpp1 = maybe (internalError "Incomplete pattern") runPlainString . fl
385stringLiteral :: PSString -> Text
385stringLiteral :: PSString -> Text
386stringLiteral pss | Just s <- decodeString pss =
386stringLiteral pss | Just s <- decodeString pss =
387− if T.all isAscii s
387+ (if T.all isAscii s
389− else ("u8") <> stringLiteral' s
389+ else ("u8")) <> stringLiteral' s
391 stringLiteral' :: Text -> Text
391 stringLiteral' :: Text -> Text
392 stringLiteral' s = "\"" <> T.concatMap encodeChar s <> "\""
392 stringLiteral' s = "\"" <> T.concatMap encodeChar s <> "\""
@@ -481,6 +481,9 @@ implFooterSource mn foreigns =
481dictType :: Text
481dictType :: Text
482dictType = "dict_t"
482dictType = "dict_t"
485+arrayType = "array_t"
484int :: Text
487int :: Text
485int = "int"
488int = "int"