From fa7489a9cbffcbedb156d7ad875d0156cce386bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Czajka?= <62751+lukaszcz@users.noreply.github.com> Date: Tue, 22 Aug 2023 15:26:45 +0200 Subject: [PATCH] Minor comment updates (#2303) --- src/Juvix/Compiler/Core/Language.hs | 9 +++------ .../Compiler/Core/Transformation/ComputeTypeInfo.hs | 12 +++++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Juvix/Compiler/Core/Language.hs b/src/Juvix/Compiler/Core/Language.hs index ea40411902..fb65ceb229 100644 --- a/src/Juvix/Compiler/Core/Language.hs +++ b/src/Juvix/Compiler/Core/Language.hs @@ -65,10 +65,8 @@ type Bottom = Bottom' Info Node {---------------------------------------------------------------------------------} --- | `Node` is the type of nodes in the program tree. The nodes themselves --- contain only runtime-relevant information. Runtime-irrelevant annotations --- (including all type information) are stored in the infos associated with each --- node. +-- | `Node` is the type of nodes in the program tree. Extra +-- annotations are stored in the infos associated with each node. data Node = NVar {-# UNPACK #-} !Var | NIdt {-# UNPACK #-} !Ident @@ -97,7 +95,6 @@ data Node -- Other things we might need in the future: -- - laziness annotations (converting these to closure/thunk creation should be -- done further down the pipeline) --- - neutral nodes (for evaluating open terms) -- A node (term) is closed if it has no free variables, i.e., no de Bruijn -- indices pointing outside the term. @@ -111,7 +108,7 @@ data Node -- doesn't matter much outside the evaluator. See also: -- Juvix.Compiler.Core.Language.Value. --- All nodes in an environment must be values. +-- | All nodes in an environment must be values. type Env = [Node] instance HasAtomicity Node where diff --git a/src/Juvix/Compiler/Core/Transformation/ComputeTypeInfo.hs b/src/Juvix/Compiler/Core/Transformation/ComputeTypeInfo.hs index 23c802b91c..768903e77a 100644 --- a/src/Juvix/Compiler/Core/Transformation/ComputeTypeInfo.hs +++ b/src/Juvix/Compiler/Core/Transformation/ComputeTypeInfo.hs @@ -8,13 +8,15 @@ import Juvix.Compiler.Core.Transformation.Base computeNodeType :: InfoTable -> Node -> Type computeNodeType tab = Info.getNodeType . computeNodeTypeInfo tab --- | Computes the TypeInfo for each subnode. +-- | Computes the TypeInfo for each subnode of a well-typed node. -- -- Assumptions: --- 1. All binders and identifiers are decorated with correct full type information. --- 2. All cases have at least one branch. --- 3. No `Match` nodes. --- 4. All inductives and function types are in universe 0. +-- 1. The node is well-typed. +-- 2. All binders and identifiers are decorated with correct full type +-- information. +-- 3. All cases have at least one branch. +-- 4. No `Match` nodes. +-- 5. All inductives and function types are in universe 0. computeNodeTypeInfo :: InfoTable -> Node -> Node computeNodeTypeInfo tab = umapL go where