mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
Merge pull request #5638 from wontem/fix_has_spaces_ident
Make `has` have 4 identation spaces
This commit is contained in:
commit
85b2d92fdc
7 changed files with 102 additions and 102 deletions
|
|
@ -101,14 +101,14 @@ Dict k v := {
|
|||
data : List (k, v),
|
||||
size : Nat,
|
||||
} | k has Hash & Eq
|
||||
has [
|
||||
Eq {
|
||||
isEq,
|
||||
},
|
||||
Hash {
|
||||
hash: hashDict,
|
||||
},
|
||||
]
|
||||
has [
|
||||
Eq {
|
||||
isEq,
|
||||
},
|
||||
Hash {
|
||||
hash: hashDict,
|
||||
},
|
||||
]
|
||||
|
||||
isEq : Dict k v, Dict k v -> Bool | k has Hash & Eq, v has Eq
|
||||
isEq = \xs, ys ->
|
||||
|
|
@ -1011,16 +1011,16 @@ expect
|
|||
# TODO: Add a builtin to distinguish big endian systems and change loading orders.
|
||||
# TODO: Switch out Wymum on systems with slow 128bit multiplication.
|
||||
LowLevelHasher := { originalSeed : U64, state : U64 } has [
|
||||
Hasher {
|
||||
addBytes,
|
||||
addU8,
|
||||
addU16,
|
||||
addU32,
|
||||
addU64,
|
||||
addU128,
|
||||
complete,
|
||||
},
|
||||
]
|
||||
Hasher {
|
||||
addBytes,
|
||||
addU8,
|
||||
addU16,
|
||||
addU32,
|
||||
addU64,
|
||||
addU128,
|
||||
complete,
|
||||
},
|
||||
]
|
||||
|
||||
# unsafe primitive that does not perform a bounds check
|
||||
# TODO hide behind an InternalList.roc module
|
||||
|
|
|
|||
|
|
@ -30,14 +30,14 @@ interface Set
|
|||
## Provides a [set](https://en.wikipedia.org/wiki/Set_(abstract_data_type))
|
||||
## type which stores a collection of unique values, without any ordering
|
||||
Set k := Dict.Dict k {} | k has Hash & Eq
|
||||
has [
|
||||
Eq {
|
||||
isEq,
|
||||
},
|
||||
Hash {
|
||||
hash: hashSet,
|
||||
},
|
||||
]
|
||||
has [
|
||||
Eq {
|
||||
isEq,
|
||||
},
|
||||
Hash {
|
||||
hash: hashSet,
|
||||
},
|
||||
]
|
||||
|
||||
isEq : Set k, Set k -> Bool | k has Hash & Eq
|
||||
isEq = \xs, ys ->
|
||||
|
|
|
|||
|
|
@ -44,49 +44,49 @@ interface TotallyNotJson
|
|||
## An opaque type with the `EncoderFormatting` and
|
||||
## `DecoderFormatting` abilities.
|
||||
Json := { fieldNameMapping : FieldNameMapping }
|
||||
has [
|
||||
EncoderFormatting {
|
||||
u8: encodeU8,
|
||||
u16: encodeU16,
|
||||
u32: encodeU32,
|
||||
u64: encodeU64,
|
||||
u128: encodeU128,
|
||||
i8: encodeI8,
|
||||
i16: encodeI16,
|
||||
i32: encodeI32,
|
||||
i64: encodeI64,
|
||||
i128: encodeI128,
|
||||
f32: encodeF32,
|
||||
f64: encodeF64,
|
||||
dec: encodeDec,
|
||||
bool: encodeBool,
|
||||
string: encodeString,
|
||||
list: encodeList,
|
||||
record: encodeRecord,
|
||||
tuple: encodeTuple,
|
||||
tag: encodeTag,
|
||||
},
|
||||
DecoderFormatting {
|
||||
u8: decodeU8,
|
||||
u16: decodeU16,
|
||||
u32: decodeU32,
|
||||
u64: decodeU64,
|
||||
u128: decodeU128,
|
||||
i8: decodeI8,
|
||||
i16: decodeI16,
|
||||
i32: decodeI32,
|
||||
i64: decodeI64,
|
||||
i128: decodeI128,
|
||||
f32: decodeF32,
|
||||
f64: decodeF64,
|
||||
dec: decodeDec,
|
||||
bool: decodeBool,
|
||||
string: decodeString,
|
||||
list: decodeList,
|
||||
record: decodeRecord,
|
||||
tuple: decodeTuple,
|
||||
},
|
||||
]
|
||||
has [
|
||||
EncoderFormatting {
|
||||
u8: encodeU8,
|
||||
u16: encodeU16,
|
||||
u32: encodeU32,
|
||||
u64: encodeU64,
|
||||
u128: encodeU128,
|
||||
i8: encodeI8,
|
||||
i16: encodeI16,
|
||||
i32: encodeI32,
|
||||
i64: encodeI64,
|
||||
i128: encodeI128,
|
||||
f32: encodeF32,
|
||||
f64: encodeF64,
|
||||
dec: encodeDec,
|
||||
bool: encodeBool,
|
||||
string: encodeString,
|
||||
list: encodeList,
|
||||
record: encodeRecord,
|
||||
tuple: encodeTuple,
|
||||
tag: encodeTag,
|
||||
},
|
||||
DecoderFormatting {
|
||||
u8: decodeU8,
|
||||
u16: decodeU16,
|
||||
u32: decodeU32,
|
||||
u64: decodeU64,
|
||||
u128: decodeU128,
|
||||
i8: decodeI8,
|
||||
i16: decodeI16,
|
||||
i32: decodeI32,
|
||||
i64: decodeI64,
|
||||
i128: decodeI128,
|
||||
f32: decodeF32,
|
||||
f64: decodeF64,
|
||||
dec: decodeDec,
|
||||
bool: decodeBool,
|
||||
string: decodeString,
|
||||
list: decodeList,
|
||||
record: decodeRecord,
|
||||
tuple: decodeTuple,
|
||||
},
|
||||
]
|
||||
|
||||
## Returns a JSON `Encoder` and `Decoder`
|
||||
json = @Json { fieldNameMapping: Default }
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ impl<'a> Formattable for TypeDef<'a> {
|
|||
buf,
|
||||
Parens::NotNeeded,
|
||||
Newlines::from_bool(make_multiline),
|
||||
indent + 1 + INDENT,
|
||||
indent + INDENT,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
A := U8 has [Eq, Hash]
|
||||
|
||||
A := a | a has Other
|
||||
has [Eq, Hash]
|
||||
has [Eq, Hash]
|
||||
|
||||
A := a | a has Other
|
||||
has [Eq, Hash]
|
||||
has [Eq, Hash]
|
||||
|
||||
A := U8 has [Eq { eq }, Hash { hash }]
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ A := U8 has [Hash, Eq { eq, eq1 }]
|
|||
A := U8 has []
|
||||
|
||||
A := a | a has Other
|
||||
has [Eq { eq }, Hash { hash }]
|
||||
has [Eq { eq }, Hash { hash }]
|
||||
|
||||
A := U8 has [Eq {}]
|
||||
|
||||
|
|
|
|||
|
|
@ -5447,7 +5447,7 @@ mod test_fmt {
|
|||
indoc!(
|
||||
r#"
|
||||
A := U8
|
||||
has [Eq, Hash]
|
||||
has [Eq, Hash]
|
||||
|
||||
0
|
||||
"#
|
||||
|
|
@ -5465,7 +5465,7 @@ mod test_fmt {
|
|||
indoc!(
|
||||
r#"
|
||||
A := a | a has Hash
|
||||
has [Eq, Hash]
|
||||
has [Eq, Hash]
|
||||
|
||||
0
|
||||
"#
|
||||
|
|
@ -5555,11 +5555,11 @@ mod test_fmt {
|
|||
r#"
|
||||
A := U8 has [Eq { eq, eq1 }]
|
||||
A := U8 has [
|
||||
Eq {
|
||||
eq,
|
||||
eq1,
|
||||
},
|
||||
]
|
||||
Eq {
|
||||
eq,
|
||||
eq1,
|
||||
},
|
||||
]
|
||||
|
||||
0
|
||||
"#
|
||||
|
|
@ -5569,7 +5569,7 @@ mod test_fmt {
|
|||
expr_formats_same(indoc!(
|
||||
r#"
|
||||
A := a | a has Other
|
||||
has [Eq { eq }, Hash { hash }]
|
||||
has [Eq { eq }, Hash { hash }]
|
||||
|
||||
0
|
||||
"#
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
interface EnvDecoding exposes [EnvFormat, format] imports []
|
||||
|
||||
EnvFormat := {} has [
|
||||
DecoderFormatting {
|
||||
u8: envU8,
|
||||
u16: envU16,
|
||||
u32: envU32,
|
||||
u64: envU64,
|
||||
u128: envU128,
|
||||
i8: envI8,
|
||||
i16: envI16,
|
||||
i32: envI32,
|
||||
i64: envI64,
|
||||
i128: envI128,
|
||||
f32: envF32,
|
||||
f64: envF64,
|
||||
dec: envDec,
|
||||
bool: envBool,
|
||||
string: envString,
|
||||
list: envList,
|
||||
record: envRecord,
|
||||
tuple: envTuple,
|
||||
},
|
||||
]
|
||||
DecoderFormatting {
|
||||
u8: envU8,
|
||||
u16: envU16,
|
||||
u32: envU32,
|
||||
u64: envU64,
|
||||
u128: envU128,
|
||||
i8: envI8,
|
||||
i16: envI16,
|
||||
i32: envI32,
|
||||
i64: envI64,
|
||||
i128: envI128,
|
||||
f32: envF32,
|
||||
f64: envF64,
|
||||
dec: envDec,
|
||||
bool: envBool,
|
||||
string: envString,
|
||||
list: envList,
|
||||
record: envRecord,
|
||||
tuple: envTuple,
|
||||
},
|
||||
]
|
||||
|
||||
format : {} -> EnvFormat
|
||||
format = \{} -> @EnvFormat {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue