mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Remove redundant space in aliases
This commit is contained in:
parent
4fed812389
commit
6786acb939
15 changed files with 24 additions and 28 deletions
|
@ -59,13 +59,9 @@ impl<'a> Formattable for Def<'a> {
|
||||||
buf.indent(indent);
|
buf.indent(indent);
|
||||||
buf.push_str(name.value);
|
buf.push_str(name.value);
|
||||||
|
|
||||||
if vars.is_empty() {
|
for var in *vars {
|
||||||
buf.spaces(1);
|
buf.spaces(1);
|
||||||
} else {
|
fmt_pattern(buf, &var.value, indent, Parens::NotNeeded);
|
||||||
for var in *vars {
|
|
||||||
buf.spaces(1);
|
|
||||||
fmt_pattern(buf, &var.value, indent, Parens::NotNeeded);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.push_str(" :");
|
buf.push_str(" :");
|
||||||
|
|
|
@ -2725,7 +2725,7 @@ mod test_fmt {
|
||||||
fn multiline_tag_union_annotation_beginning_on_same_line() {
|
fn multiline_tag_union_annotation_beginning_on_same_line() {
|
||||||
expr_formats_same(indoc!(
|
expr_formats_same(indoc!(
|
||||||
r#"
|
r#"
|
||||||
Expr : [
|
Expr : [
|
||||||
Add Expr Expr,
|
Add Expr Expr,
|
||||||
Mul Expr Expr,
|
Mul Expr Expr,
|
||||||
Val I64,
|
Val I64,
|
||||||
|
|
|
@ -2,7 +2,7 @@ interface Base64.Encode
|
||||||
exposes [ toBytes ]
|
exposes [ toBytes ]
|
||||||
imports [ Bytes.Encode.{ Encoder } ]
|
imports [ Bytes.Encode.{ Encoder } ]
|
||||||
|
|
||||||
InvalidChar : U8
|
InvalidChar : U8
|
||||||
|
|
||||||
# State : [ None, One U8, Two U8, Three U8 ]
|
# State : [ None, One U8, Two U8, Three U8 ]
|
||||||
toBytes : Str -> List U8
|
toBytes : Str -> List U8
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
interface Bytes.Decode exposes [ Decoder, decode, map, map2, u8, loop, Step, succeed, DecodeProblem, after, map3 ] imports []
|
interface Bytes.Decode exposes [ Decoder, decode, map, map2, u8, loop, Step, succeed, DecodeProblem, after, map3 ] imports []
|
||||||
|
|
||||||
State : { bytes : List U8, cursor : Nat }
|
State : { bytes : List U8, cursor : Nat }
|
||||||
|
|
||||||
DecodeProblem : [ OutOfBytes ]
|
DecodeProblem : [ OutOfBytes ]
|
||||||
|
|
||||||
Decoder a : [ @Decoder (State -> [ Good State a, Bad DecodeProblem ]) ]
|
Decoder a : [ @Decoder (State -> [ Good State a, Bad DecodeProblem ]) ]
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
interface Bytes.Encode exposes [ Encoder, sequence, u8, u16, bytes, empty, encode ] imports []
|
interface Bytes.Encode exposes [ Encoder, sequence, u8, u16, bytes, empty, encode ] imports []
|
||||||
|
|
||||||
Endianness : [ BE, LE ]
|
Endianness : [ BE, LE ]
|
||||||
|
|
||||||
Encoder : [ Signed8 I8, Unsigned8 U8, Signed16 Endianness I16, Unsigned16 Endianness U16, Sequence Nat (List Encoder), Bytes (List U8) ]
|
Encoder : [ Signed8 I8, Unsigned8 U8, Signed16 Endianness I16, Unsigned16 Endianness U16, Sequence Nat (List Encoder), Bytes (List U8) ]
|
||||||
|
|
||||||
u8 : U8 -> Encoder
|
u8 : U8 -> Encoder
|
||||||
u8 = \value -> Unsigned8 value
|
u8 = \value -> Unsigned8 value
|
||||||
|
|
|
@ -19,7 +19,7 @@ main =
|
||||||
|> Str.concat (Num.toStr optimized)
|
|> Str.concat (Num.toStr optimized)
|
||||||
|> Task.putLine
|
|> Task.putLine
|
||||||
|
|
||||||
Expr : [
|
Expr : [
|
||||||
Add Expr Expr,
|
Add Expr Expr,
|
||||||
Mul Expr Expr,
|
Mul Expr Expr,
|
||||||
Val I64,
|
Val I64,
|
||||||
|
|
|
@ -21,7 +21,7 @@ main =
|
||||||
|
|
||||||
|> Task.map (\_ -> {})
|
|> Task.map (\_ -> {})
|
||||||
|
|
||||||
Expr : [ Val I64, Var Str, Add Expr Expr, Mul Expr Expr, Pow Expr Expr, Ln Expr ]
|
Expr : [ Val I64, Var Str, Add Expr Expr, Mul Expr Expr, Pow Expr Expr, Ln Expr ]
|
||||||
|
|
||||||
divmod : I64, I64 -> Result { div : I64, mod : I64 } [ DivByZero ]*
|
divmod : I64, I64 -> Result { div : I64, mod : I64 } [ DivByZero ]*
|
||||||
divmod = \l, r ->
|
divmod = \l, r ->
|
||||||
|
|
|
@ -3,11 +3,11 @@ app "rbtree-ck"
|
||||||
imports [ pf.Task ]
|
imports [ pf.Task ]
|
||||||
provides [ main ] to pf
|
provides [ main ] to pf
|
||||||
|
|
||||||
Color : [ Red, Black ]
|
Color : [ Red, Black ]
|
||||||
|
|
||||||
Tree a b : [ Leaf, Node Color (Tree a b) a b (Tree a b) ]
|
Tree a b : [ Leaf, Node Color (Tree a b) a b (Tree a b) ]
|
||||||
|
|
||||||
Map : Tree I64 Bool
|
Map : Tree I64 Bool
|
||||||
|
|
||||||
ConsList a : [ Nil, Cons a (ConsList a) ]
|
ConsList a : [ Nil, Cons a (ConsList a) ]
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ app "rbtree-del"
|
||||||
imports [ pf.Task ]
|
imports [ pf.Task ]
|
||||||
provides [ main ] to pf
|
provides [ main ] to pf
|
||||||
|
|
||||||
Color : [ Red, Black ]
|
Color : [ Red, Black ]
|
||||||
|
|
||||||
Tree a b : [ Leaf, Node Color (Tree a b) a b (Tree a b) ]
|
Tree a b : [ Leaf, Node Color (Tree a b) a b (Tree a b) ]
|
||||||
|
|
||||||
Map : Tree I64 Bool
|
Map : Tree I64 Bool
|
||||||
|
|
||||||
ConsList a : [ Nil, Cons a (ConsList a) ]
|
ConsList a : [ Nil, Cons a (ConsList a) ]
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ showColor = \color ->
|
||||||
Black ->
|
Black ->
|
||||||
"Black"
|
"Black"
|
||||||
|
|
||||||
NodeColor : [ Red, Black ]
|
NodeColor : [ Red, Black ]
|
||||||
|
|
||||||
RedBlackTree k v : [ Node NodeColor k v (RedBlackTree k v) (RedBlackTree k v), Empty ]
|
RedBlackTree k v : [ Node NodeColor k v (RedBlackTree k v) (RedBlackTree k v), Empty ]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
interface RBTree exposes [ Dict, empty, size, singleton, isEmpty, insert, remove, update, fromList, toList, balance ] imports []
|
interface RBTree exposes [ Dict, empty, size, singleton, isEmpty, insert, remove, update, fromList, toList, balance ] imports []
|
||||||
|
|
||||||
# The color of a node. Leaves are considered Black.
|
# The color of a node. Leaves are considered Black.
|
||||||
NodeColor : [ Red, Black ]
|
NodeColor : [ Red, Black ]
|
||||||
|
|
||||||
Dict k v : [ Node NodeColor k v (Dict k v) (Dict k v), Empty ]
|
Dict k v : [ Node NodeColor k v (Dict k v) (Dict k v), Empty ]
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@ interface Context
|
||||||
Option a : [ Some a, None ]
|
Option a : [ Some a, None ]
|
||||||
|
|
||||||
# The underlying context of the current location within the file
|
# The underlying context of the current location within the file
|
||||||
Data : [ Lambda (List U8), Number I32, Var Variable ]
|
Data : [ Lambda (List U8), Number I32, Var Variable ]
|
||||||
# While loops are special and have their own Scope specific state.
|
# While loops are special and have their own Scope specific state.
|
||||||
WhileState : { cond : List U8, body : List U8, state : [ InCond, InBody ] }
|
WhileState : { cond : List U8, body : List U8, state : [ InCond, InBody ] }
|
||||||
Scope : { data : Option File.Handle, index : Nat, buf : List U8, whileInfo : Option WhileState }
|
Scope : { data : Option File.Handle, index : Nat, buf : List U8, whileInfo : Option WhileState }
|
||||||
State : [ Executing, InComment, InLambda Nat (List U8), InString (List U8), InNumber I32, InSpecialChar, LoadChar ]
|
State : [ Executing, InComment, InLambda Nat (List U8), InString (List U8), InNumber I32, InSpecialChar, LoadChar ]
|
||||||
Context : { scopes : List Scope, stack : List Data, vars : List Data, state : State }
|
Context : { scopes : List Scope, stack : List Data, vars : List Data, state : State }
|
||||||
|
|
||||||
pushStack : Context, Data -> Context
|
pushStack : Context, Data -> Context
|
||||||
pushStack = \ctx, data ->
|
pushStack = \ctx, data ->
|
||||||
|
|
|
@ -16,7 +16,7 @@ app "false"
|
||||||
# In an imperative language, a few of these pieces would be in while loops and it would basically never overflow.
|
# In an imperative language, a few of these pieces would be in while loops and it would basically never overflow.
|
||||||
# This implementation is easy to overflow, either make the input long enough or make a false while loop run long enough.
|
# This implementation is easy to overflow, either make the input long enough or make a false while loop run long enough.
|
||||||
# I assume all of the Task.awaits are the cause of this, but I am not 100% sure.
|
# I assume all of the Task.awaits are the cause of this, but I am not 100% sure.
|
||||||
InterpreterErrors : [ BadUtf8, DivByZero, EmptyStack, InvalidBooleanValue, InvalidChar Str, MaxInputNumber, NoLambdaOnStack, NoNumberOnStack, NoVariableOnStack, NoScope, OutOfBounds, UnexpectedEndOfData ]
|
InterpreterErrors : [ BadUtf8, DivByZero, EmptyStack, InvalidBooleanValue, InvalidChar Str, MaxInputNumber, NoLambdaOnStack, NoNumberOnStack, NoVariableOnStack, NoScope, OutOfBounds, UnexpectedEndOfData ]
|
||||||
|
|
||||||
main : Str -> Task {} []
|
main : Str -> Task {} []
|
||||||
main = \filename ->
|
main = \filename ->
|
||||||
|
|
|
@ -4,7 +4,7 @@ interface Variable
|
||||||
|
|
||||||
# Variables in False can only be single letters. Thus, the valid variables are "a" to "z".
|
# Variables in False can only be single letters. Thus, the valid variables are "a" to "z".
|
||||||
# This opaque type deals with ensure we always have valid variables.
|
# This opaque type deals with ensure we always have valid variables.
|
||||||
Variable : [ @Variable U8 ]
|
Variable : [ @Variable U8 ]
|
||||||
|
|
||||||
totalCount : Nat
|
totalCount : Nat
|
||||||
totalCount =
|
totalCount =
|
||||||
|
|
|
@ -2,7 +2,7 @@ interface File
|
||||||
exposes [ line, Handle, withOpen, chunk ]
|
exposes [ line, Handle, withOpen, chunk ]
|
||||||
imports [ fx.Effect, Task.{ Task } ]
|
imports [ fx.Effect, Task.{ Task } ]
|
||||||
|
|
||||||
Handle : [ @Handle U64 ]
|
Handle : [ @Handle U64 ]
|
||||||
|
|
||||||
line : Handle -> Task.Task Str *
|
line : Handle -> Task.Task Str *
|
||||||
line = \@Handle handle -> Effect.after (Effect.getFileLine handle) Task.succeed
|
line = \@Handle handle -> Effect.after (Effect.getFileLine handle) Task.succeed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue