Skip to content

Commit

Permalink
Move traversable documentation to derived instance (#1472)
Browse files Browse the repository at this point in the history
This should render the documentation in haddock according to this blog:
https://kowainik.github.io/posts/haddock-tips#what-can-be-documented

It does not for me (maybe it will in release?), but at least it's where it belongs.
  • Loading branch information
xsebek authored Aug 26, 2023
1 parent 64fe028 commit 1066377
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/Swarm/Language/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -904,16 +904,25 @@ data Term' ty
SProj (Syntax' ty) Var
| -- | Annotate a term with a type
SAnnotate (Syntax' ty) Polytype
deriving (Eq, Show, Functor, Foldable, Traversable, Data, Generic, FromJSON, ToJSON)

-- The Traversable instance for Term (and for Syntax') is used during
-- typechecking: during intermediate type inference, many of the type
-- annotations placed on AST nodes will have unification variables in
-- them. Once we have finished solving everything we need to do a
-- final traversal over all the types in the AST to substitute away
-- all the unification variables (and generalize, i.e. stick 'forall'
-- on, as appropriate). See the call to 'mapM' in
-- Swarm.Language.Typecheck.runInfer.
deriving
( Eq
, Show
, Functor
, Foldable
, Data
, Generic
, FromJSON
, ToJSON
, -- | The Traversable instance for Term (and for Syntax') is used during
-- typechecking: during intermediate type inference, many of the type
-- annotations placed on AST nodes will have unification variables in
-- them. Once we have finished solving everything we need to do a
-- final traversal over all the types in the AST to substitute away
-- all the unification variables (and generalize, i.e. stick 'forall'
-- on, as appropriate). See the call to 'mapM' in
-- Swarm.Language.Typecheck.runInfer.
Traversable
)

type Term = Term' ()

Expand Down

0 comments on commit 1066377

Please sign in to comment.