mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-31 17:17:26 +00:00
snake_case
-ify all remaining camelCase
names in hiding (#7561)
* Snake-case-ify def names in comments * Snake-case-ify def names in strings * Snake-case-ify ignored function parameters * Snake-case-ify test script names, for consistency * Update CI snapshot to match snake_case * snake case correction --------- Co-authored-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
This commit is contained in:
parent
7154b3483b
commit
68e524e110
45 changed files with 157 additions and 150 deletions
|
@ -362,7 +362,7 @@ where
|
|||
// For now, using solve_trivial to avoid bug with loops.
|
||||
// Note: when disabling this, there was not much of a change in performance.
|
||||
// Notably, NQueens was about 5% slower. False interpreter was 0-5% faster (depending on input).
|
||||
// cFold and derive saw minor gains ~1.5%. rBTreeCk saw a big gain of ~4%.
|
||||
// c_fold and derive saw minor gains ~1.5%. r_b_tree_ck saw a big gain of ~4%.
|
||||
// This feels wrong, morphic should not really be able to slow down code.
|
||||
// Likely, noise or the bug and wrong inplace mutation lead to these perf changes.
|
||||
// When re-enabling this, we should analysis the perf and inplace mutations of a few apps.
|
||||
|
|
|
@ -3,7 +3,7 @@ module [Bool, Eq, true, false, not, is_eq, is_not_eq]
|
|||
## Defines a type that can be compared for total equality.
|
||||
##
|
||||
## Total equality means that all values of the type can be compared to each
|
||||
## other, and two values `a`, `b` are identical if and only if `isEq(a, b)` is
|
||||
## other, and two values `a`, `b` are identical if and only if `is_eq(a, b)` is
|
||||
## `Bool.true`.
|
||||
##
|
||||
## Not all types support total equality. For example, [`F32`](../Num#F32) and [`F64`](../Num#F64) can
|
||||
|
|
|
@ -59,7 +59,7 @@ DecodeError : [TooShort]
|
|||
## such as;
|
||||
## ```roc
|
||||
## expect
|
||||
## input = "\"hello\", " |> Str.toUtf8
|
||||
## input = "\"hello\", " |> Str.to_utf8
|
||||
## actual = Decode.from_bytes_partial(input, Json.json)
|
||||
## expected = Ok("hello")
|
||||
##
|
||||
|
@ -132,7 +132,7 @@ decode_with = |bytes, @Decoder(decode), fmt| decode(bytes, fmt)
|
|||
## Decode a `List U8` utf-8 bytes and return a [DecodeResult](#DecodeResult)
|
||||
## ```roc
|
||||
## expect
|
||||
## input = "\"hello\", " |> Str.toUtf8
|
||||
## input = "\"hello\", " |> Str.to_utf8
|
||||
## actual = Decode.from_bytes_partial(input Json.json)
|
||||
## expected = Ok("hello")
|
||||
##
|
||||
|
@ -146,7 +146,7 @@ from_bytes_partial = |bytes, fmt| decode_with(bytes, decoder, fmt)
|
|||
## remaining returns `Err Leftover (List U8)`.
|
||||
## ```roc
|
||||
## expect
|
||||
## input = "\"hello\", " |> Str.toUtf8
|
||||
## input = "\"hello\", " |> Str.to_utf8
|
||||
## actual = Decode.from_bytes(input, Json.json)
|
||||
## expected = Ok("hello")
|
||||
##
|
||||
|
|
|
@ -193,7 +193,7 @@ import Result exposing [Result]
|
|||
## have the type `Num *` at first, but usually end up taking on
|
||||
## a more specific type based on how they're used.
|
||||
##
|
||||
## For example, in `1 + List.len(myList)`, the `1` has the type `Num *` at first,
|
||||
## For example, in `1 + List.len(my_list)`, the `1` has the type `Num *` at first,
|
||||
## but because `List.len` returns a `U64`, the `1` ends up changing from
|
||||
## `Num *` to the more specific `U64`, and the expression as a whole
|
||||
## ends up having the type `U64`.
|
||||
|
@ -345,16 +345,16 @@ Int range : Num (Integer range)
|
|||
## If you don't specify a type, Roc will default to using [Dec] because it's
|
||||
## the least error-prone overall. For example, suppose you write this:
|
||||
## ```roc
|
||||
## wasItPrecise = 0.1 + 0.2 == 0.3
|
||||
## was_it_precise = 0.1 + 0.2 == 0.3
|
||||
## ```
|
||||
## The value of `wasItPrecise` here will be `Bool.true`, because Roc uses [Dec]
|
||||
## The value of `was_it_precise` here will be `Bool.true`, because Roc uses [Dec]
|
||||
## by default when there are no types specified.
|
||||
##
|
||||
## In contrast, suppose we use `f32` or `f64` for one of these numbers:
|
||||
## ```roc
|
||||
## wasItPrecise = 0.1f64 + 0.2 == 0.3
|
||||
## was_it_precise = 0.1f64 + 0.2 == 0.3
|
||||
## ```
|
||||
## Here, `wasItPrecise` will be `Bool.false` because the entire calculation will have
|
||||
## Here, `was_it_precise` will be `Bool.false` because the entire calculation will have
|
||||
## been done in a base-2 floating point calculation, which causes noticeable
|
||||
## precision loss in this case.
|
||||
##
|
||||
|
@ -726,7 +726,7 @@ abs_diff = |a, b|
|
|||
## Num.neg(0.0)
|
||||
## ```
|
||||
## !! Num.neg is not completely implemented for all types in all contexts, see github.com/roc-lang/roc/issues/6959
|
||||
## You can use `\someNum -> 0 - someNum` as a workaround.
|
||||
## You can use `\some_num -> 0 - some_num` as a workaround.
|
||||
##
|
||||
## This is safe to use with any [Frac], but it can cause overflow when used with certain [Int] values.
|
||||
##
|
||||
|
@ -904,7 +904,7 @@ log_checked = |x|
|
|||
## > access to hardware-accelerated performance, Roc follows these rules exactly.
|
||||
##
|
||||
## To divide an [Int] and a [Frac], first convert the [Int] to a [Frac] using
|
||||
## one of the functions in this module like #toDec.
|
||||
## one of the functions in this module like #to_dec.
|
||||
## ```roc
|
||||
## 5.0 / 7.0
|
||||
##
|
||||
|
@ -1125,7 +1125,7 @@ add_wrap : Int range, Int range -> Int range
|
|||
##
|
||||
## This is the same as [Num.add] except for the saturating behavior if the
|
||||
## addition is to overflow.
|
||||
## For example, if `x : U8` is 200 and `y : U8` is 100, `addSaturated x y` will
|
||||
## For example, if `x : U8` is 200 and `y : U8` is 100, `add_saturated x y` will
|
||||
## yield 255, the maximum value of a `U8`.
|
||||
add_saturated : Num a, Num a -> Num a
|
||||
|
||||
|
|
|
@ -597,8 +597,8 @@ expect (Str.from_utf8_lossy [82, 0xED, 0xA0, 0xBD, 99]) == "R<>c"
|
|||
## expect Str.from_utf16([0xd83d, 0xdc26]) == Ok("🐦")
|
||||
## expect Str.from_utf16([]) == Ok("")
|
||||
## # unpaired surrogates, first and second halves
|
||||
## expect Str.from_utf16([82, 0xd83d, 99]) |> Result.isErr
|
||||
## expect Str.from_utf16([82, 0xdc96, 99]) |> Result.isErr
|
||||
## expect Str.from_utf16([82, 0xd83d, 99]) |> Result.is_err
|
||||
## expect Str.from_utf16([82, 0xdc96, 99]) |> Result.is_err
|
||||
## ```
|
||||
from_utf16 : List U16 -> Result Str [BadUtf16 { problem : Utf8Problem, index : U64 }]
|
||||
from_utf16 = |codeunits|
|
||||
|
@ -700,10 +700,10 @@ expect Str.from_utf16_lossy([82, 0xdc96, 99]) == "R<>c"
|
|||
## expect Str.from_utf32([0xb9a, 0xbbf]) == Ok("சி")
|
||||
## expect Str.from_utf32([0x1f426]) == Ok("🐦")
|
||||
## # unpaired surrogates, first and second halves
|
||||
## expect Str.from_utf32([82, 0xd83d, 99]) |> Result.isErr
|
||||
## expect Str.from_utf32([82, 0xdc96, 99]) |> Result.isErr
|
||||
## expect Str.from_utf32([82, 0xd83d, 99]) |> Result.is_err
|
||||
## expect Str.from_utf32([82, 0xdc96, 99]) |> Result.is_err
|
||||
## # invalid codepoint
|
||||
## expect Str.from_utf32([82, 0x110000, 99]) |> Result.isErr
|
||||
## expect Str.from_utf32([82, 0x110000, 99]) |> Result.is_err
|
||||
## ```
|
||||
|
||||
from_utf32 : List U32 -> Result Str [BadUtf32 { problem : Utf8Problem, index : U64 }]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue