Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
GitLab is currently being migrated to new hosting. This process should be finished by 17:00 EDT 29 March 2025.
You are on a read-only GitLab instance.
Show more breadcrumbs
Gesh
GHC
Commits
ec6f40d9
Commit
ec6f40d9
authored
27 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-02-02 13:31:19 by simonm]
remove old section about module recursion.
parent
70592f1b
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/docs/users_guide/debugging.vsgml
+0
-48
0 additions, 48 deletions
ghc/docs/users_guide/debugging.vsgml
with
0 additions
and
48 deletions
ghc/docs/users_guide/debugging.vsgml
+
0
−
48
View file @
ec6f40d9
...
...
@@ -322,51 +322,3 @@ flags in your module, the OPTIONS will get put into the generated .hc
file).
%----------------------------------------------------------------------
<sect2>How to compile mutually recursive modules
<p>
<nidx>module system, recursion</nidx>
Currently, the compiler does not have proper support for dealing with
mutually recursive modules:
<tscreen><verb>
module A where
import B
newtype A = A Int
f :: B -> A
f (B x) = A x
--------
module B where
import A
data B = B !Int
g :: A -> B
g (A x) = B x
</verb></tscreen>
When compiling either module A and B, the compiler will try (in vain)
to look for the interface file of the other. So, to get mutually
recursive modules off the ground, you need to hand write an interface
file for A or B, so as to break the loop. For the example at hand, the
boot interface file for A would like the following:
<tscreen><verb>
_interface_ A 1
_exports_
A A(A) f;
_declarations_
1 newtype A = A PrelBase.Int ;
1 f _:_ B.B -> A.A ;;
</verb></tscreen>
To make sure you get the syntax right, tailoring an existing interface
file is a Good Idea.
<bf>Note:</bf> This is all a temporary solution, a version of the
compiler that handles mutually recursive properly without the manual
construction of interface file, is in the works.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment