mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +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,
|
||||
};
|
||||
use roc_parse::ast::{
|
||||
AbilityImpls, AssignedField, Collection, Expr, ExtractSpaces, ImplementsAbilities,
|
||||
ImplementsAbility, ImplementsClause, Tag, TypeAnnotation, TypeHeader,
|
||||
AbilityImpls, AssignedField, Collection, Expr, ExtractSpaces, FunctionArrow,
|
||||
ImplementsAbilities, ImplementsAbility, ImplementsClause, Tag, TypeAnnotation, TypeHeader,
|
||||
};
|
||||
use roc_parse::ident::UppercaseIdent;
|
||||
use roc_region::all::Loc;
|
||||
|
@ -195,8 +195,7 @@ impl<'a> Formattable for TypeAnnotation<'a> {
|
|||
let self_is_multiline = self.is_multiline();
|
||||
|
||||
match self {
|
||||
Function(args, _arrow, ret) => {
|
||||
// [purity-infrence] TODO: format arrow
|
||||
Function(args, arrow, ret) => {
|
||||
let needs_parens = parens != Parens::NotNeeded;
|
||||
|
||||
buf.indent(indent);
|
||||
|
@ -237,7 +236,11 @@ impl<'a> Formattable for TypeAnnotation<'a> {
|
|||
buf.spaces(1);
|
||||
}
|
||||
|
||||
buf.push_str("->");
|
||||
match arrow {
|
||||
FunctionArrow::Pure => buf.push_str("->"),
|
||||
FunctionArrow::Effectful => buf.push_str("=>"),
|
||||
}
|
||||
|
||||
buf.spaces(1);
|
||||
|
||||
ret.value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue