Skip to content

Commit 3ec1b51

Browse files
committed
Add comment about arrow distillation
1 parent 1a69ee1 commit 3ec1b51

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fathom/src/surface/distillation.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ impl<'interner, 'arena, 'env> Context<'interner, 'arena, 'env> {
369369
)
370370
}
371371
core::Term::Universe(_span) => Term::Universe(()),
372+
373+
// Use arrow sugar if the the input binding is not referenced in the
374+
// output type.
372375
core::Term::FunType(_span, _, input_type, output_type)
373376
if !output_type.binds_rigid_var(LocalVar::last()) =>
374377
{
@@ -384,6 +387,7 @@ impl<'interner, 'arena, 'env> Context<'interner, 'arena, 'env> {
384387
self.scope.to_scope(output_type),
385388
)
386389
}
390+
// Otherwise distill to a function type with an explicit parameter.
387391
core::Term::FunType(_span, input_name, input_type, output_type) => {
388392
let input_type = self.check(input_type);
389393

@@ -398,6 +402,7 @@ impl<'interner, 'arena, 'env> Context<'interner, 'arena, 'env> {
398402
self.scope.to_scope(output_type),
399403
)
400404
}
405+
401406
core::Term::FunLit(_span, input_name, output_expr) => {
402407
let input_name = self.push_rigid(*input_name);
403408
let output_expr = self.synth(output_expr);

0 commit comments

Comments
 (0)