-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#27] Introduce Terminating constraint for preventing hanging showMemory #46
Closed
yigitozkavci
wants to merge
12
commits into
kowainik:master
from
yigitozkavci:type-level-unit-termination-validation
Closed
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2753488
[#27] Introduce Terminating constraint for prevent hanging showMemory
yigitozkavci 5a7ed23
[#27] Increase reduction depth from 201 to 500
yigitozkavci 8099c54
Disable GHC reduction check alltogether
yigitozkavci 0b72d16
Disable reduction-depth check in library
yigitozkavci 1b5e0d3
Attempt to disable reduction depth check in tests
yigitozkavci a401d47
Disable reduction depth check for doctests
yigitozkavci 040cda0
Make Cabal tests also pass by giving ghc-option
yigitozkavci 906b4dd
Enable terminating feature only for ghc >=8.4
yigitozkavci 6803e23
Use reduction depth of 250 instead of unlimited
yigitozkavci b6eca88
Rename IsMemory type alias to KnownMem
yigitozkavci c1170f3
Add comments for Terminating type family
yigitozkavci b98c9b6
Improve type errors for non terminating nats
yigitozkavci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I can't find documentation for this. (I'm looking into https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/flags.html )
Could you please explain why this is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to add from my side that adding custom and rare flags (that apparently doesn't have documentation) might be a stopper for merging. This constant might work for natural 7000. But GHC might require a much higher constant for bigger naturals. This can slow down compilation significantly for the
membrain
users or produce difficult errors. The fact that this constant needs to patched to make the library work looks like an undesirable property to me.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, answers inline.
Yes, flag not being documented is in fact a ghc bug: https://gitlab.haskell.org/ghc/ghc/issues/15756
GHC manpage seems to have this documented though:
https://manpages.debian.org/stretch/ghc/haskell-compiler.1.en.html#Language_options
This flag controls how many steps GHC is allowed to take for simplifying a single type expression.
In order to understand whether large Nats are only dividable by 5 or 2, but not by any other number, we need to continuously divide them by 5 and 2 and see if we end up with 1.
This creates a type expression like
(((((7000 Div 5) Div 5) Div 5) Div 5)...
for ghc to simplify and ghc simply has a limit on number of reductions it wants to perform.For Yobibyte, currently the largest unit, this reduction size is exactly
250
, hence the-freduction-depth=250
flag.