mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Format effectful arrows in annotations
This commit is contained in:
parent
ef4eeb5c1a
commit
d692fc7c42
2 changed files with 9 additions and 6 deletions
|
@ -4,8 +4,8 @@ use crate::{
|
||||||
Buf,
|
Buf,
|
||||||
};
|
};
|
||||||
use roc_parse::ast::{
|
use roc_parse::ast::{
|
||||||
AbilityImpls, AssignedField, Collection, Expr, ExtractSpaces, ImplementsAbilities,
|
AbilityImpls, AssignedField, Collection, Expr, ExtractSpaces, FunctionArrow,
|
||||||
ImplementsAbility, ImplementsClause, Tag, TypeAnnotation, TypeHeader,
|
ImplementsAbilities, ImplementsAbility, ImplementsClause, Tag, TypeAnnotation, TypeHeader,
|
||||||
};
|
};
|
||||||
use roc_parse::ident::UppercaseIdent;
|
use roc_parse::ident::UppercaseIdent;
|
||||||
use roc_region::all::Loc;
|
use roc_region::all::Loc;
|
||||||
|
@ -195,8 +195,7 @@ impl<'a> Formattable for TypeAnnotation<'a> {
|
||||||
let self_is_multiline = self.is_multiline();
|
let self_is_multiline = self.is_multiline();
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Function(args, _arrow, ret) => {
|
Function(args, arrow, ret) => {
|
||||||
// [purity-infrence] TODO: format arrow
|
|
||||||
let needs_parens = parens != Parens::NotNeeded;
|
let needs_parens = parens != Parens::NotNeeded;
|
||||||
|
|
||||||
buf.indent(indent);
|
buf.indent(indent);
|
||||||
|
@ -237,7 +236,11 @@ impl<'a> Formattable for TypeAnnotation<'a> {
|
||||||
buf.spaces(1);
|
buf.spaces(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.push_str("->");
|
match arrow {
|
||||||
|
FunctionArrow::Pure => buf.push_str("->"),
|
||||||
|
FunctionArrow::Effectful => buf.push_str("=>"),
|
||||||
|
}
|
||||||
|
|
||||||
buf.spaces(1);
|
buf.spaces(1);
|
||||||
|
|
||||||
ret.value
|
ret.value
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
launchTheNukes : {} -> Result Bool LaunchNukeErr
|
launchTheNukes : {} => Result Bool LaunchNukeErr
|
||||||
launchTheNukes = \{} ->
|
launchTheNukes = \{} ->
|
||||||
crash "todo"
|
crash "todo"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue