From 0e39675d6828d7e5fec0ff6135718aed40ebd66a Mon Sep 17 00:00:00 2001 From: Chadtech Date: Sun, 2 May 2021 14:31:17 -0400 Subject: [PATCH] Add Usv type to Str exports, and reformat Str interface generally --- compiler/builtins/docs/Str.roc | 44 +++++++++++++++++++++++++++++++--- compiler/builtins/src/std.rs | 1 + compiler/module/src/symbol.rs | 1 + 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/compiler/builtins/docs/Str.roc b/compiler/builtins/docs/Str.roc index f596eab552..4e4e294387 100644 --- a/compiler/builtins/docs/Str.roc +++ b/compiler/builtins/docs/Str.roc @@ -1,8 +1,46 @@ interface Str - exposes [ Str, decimal, split, isEmpty, startsWith, endsWith, contains, anyGraphemes, allGraphemes, join, joinWith, padGraphemesStart, padGraphemesEnd, graphemes, reverseGraphemes, isCaseInsensitiveEq, isCaseInsensitiveNeq, walkGraphemes, isCapitalized, isAllUppercase, isAllLowercase, toUtf8, toUtf16, toUtf32, trim, walkUtf8, walkUtf16, walkUtf32, walkRevUtf8, walkRevUtf16, walkRevUtf32 ] - imports [] -## # Types + exposes + [ + Str, + Usv, + decimal, + split, + isEmpty, + startsWith, + endsWith, + contains, + anyGraphemes, + allGraphemes, + join, + joinWith, + padGraphemesStart, + padGraphemesEnd, + graphemes, + reverseGraphemes, + isCaseInsensitiveEq, + isCaseInsensitiveNeq, + walkGraphemes, + isCapitalized, + isAllUppercase, + isAllLowercase, + toUtf8, + toUtf16, + toUtf32, + trim, + walkUtf8, + walkUtf16, + walkUtf32, + walkRevUtf8, + walkRevUtf16, + walkRevUtf32 + ] + imports + [ + Bytes.{ Bytes } + ] +## # Types +## ## Dealing with text is a deep topic, so by design, Roc's `Str` module sticks ## to the basics. ## diff --git a/compiler/builtins/src/std.rs b/compiler/builtins/src/std.rs index 480b0d2231..ed8c6e877d 100644 --- a/compiler/builtins/src/std.rs +++ b/compiler/builtins/src/std.rs @@ -48,6 +48,7 @@ pub fn standard_stdlib() -> StdLib { Symbol::SET_SET, Symbol::DICT_DICT, Symbol::STR_STR, + Symbol::STR_USV, ] .into_iter() .collect(), diff --git a/compiler/module/src/symbol.rs b/compiler/module/src/symbol.rs index 8a77a55e94..321baa5766 100644 --- a/compiler/module/src/symbol.rs +++ b/compiler/module/src/symbol.rs @@ -889,6 +889,7 @@ define_builtins! { 13 STR_UT8_PROBLEM: "Utf8Problem" // the Utf8Problem type alias 14 STR_UT8_BYTE_PROBLEM: "Utf8ByteProblem" // the Utf8ByteProblem type alias 15 STR_TO_BYTES: "toBytes" + 16 STR_USV: "Usv" imported // the Str.Usv type alias } 4 LIST: "List" => { 0 LIST_LIST: "List" imported // the List.List type alias