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
Show more breadcrumbs
Gesh
GHC
Commits
6288438b
Commit
6288438b
authored
25 years ago
by
Simon Peyton Jones
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1999-06-28 16:32:00 by simonpj]
Propagate changes for tcSimplifyToDicts
parent
46ebcd57
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ghc/compiler/typecheck/TcRules.lhs
+2
-2
2 additions, 2 deletions
ghc/compiler/typecheck/TcRules.lhs
ghc/compiler/typecheck/TcSimplify.lhs
+22
-4
22 additions, 4 deletions
ghc/compiler/typecheck/TcSimplify.lhs
with
24 additions
and
6 deletions
ghc/compiler/typecheck/TcRules.lhs
+
2
−
2
View file @
6288438b
...
...
@@ -13,7 +13,7 @@ import HsCore ( UfRuleBody(..) )
import RnHsSyn ( RenamedHsDecl )
import TcHsSyn ( TypecheckedRuleDecl, mkHsLet )
import TcMonad
import TcSimplify ( tcSimplify
RuleLh
s, tcSimplifyAndCheck )
import TcSimplify ( tcSimplify
ToDict
s, tcSimplifyAndCheck )
import TcType ( zonkTcTypes, newTyVarTy_OpenKind )
import TcIfaceSig ( tcCoreExpr, tcCoreLamBndrs, tcVar )
import TcMonoType ( tcHsType, tcHsTyVar, checkSigTyVars )
...
...
@@ -66,7 +66,7 @@ tcRule (RuleDecl name sig_tvs vars lhs rhs src_loc)
) `thenTc` \ (ids, lhs', rhs', lhs_lie, rhs_lie) ->
-- Check that LHS has no overloading at all
tcSimplify
RuleLh
s lhs_lie `thenTc` \ (lhs_dicts, lhs_binds) ->
tcSimplify
ToDict
s lhs_lie `thenTc` \ (lhs_dicts, lhs_binds) ->
checkSigTyVars sig_tyvars `thenTc_`
-- Gather the template variables and tyvars
...
...
This diff is collapsed.
Click to expand it.
ghc/compiler/typecheck/TcSimplify.lhs
+
22
−
4
View file @
6288438b
...
...
@@ -116,7 +116,7 @@ and hence the default mechanism would resolve the "a".
\begin{code}
module TcSimplify (
tcSimplify, tcSimplifyAndCheck, tcSimplify
RuleLh
s,
tcSimplify, tcSimplifyAndCheck, tcSimplify
ToDict
s,
tcSimplifyTop, tcSimplifyThetas, tcSimplifyCheckThetas,
bindInstsOfLocalFuns
) where
...
...
@@ -293,10 +293,27 @@ On the LHS of transformation rules we only simplify methods and constants,
getting dictionaries. We want to keep all of them unsimplified, to serve
as the available stuff for the RHS of the rule.
The same thing is used for specialise pragmas. Consider
f :: Num a => a -> a
{-# SPECIALISE f :: Int -> Int #-}
f = ...
The type checker generates a binding like:
f_spec = (f :: Int -> Int)
and we want to end up with
f_spec = _inline_me_ (f Int dNumInt)
But that means that we must simplify the Method for f to (f Int dNumInt)!
So tcSimplifyToDicts squeezes out all Methods.
\begin{code}
tcSimplify
RuleLh
s :: LIE -> TcM s (LIE, TcDictBinds)
tcSimplify
RuleLh
s wanted_lie
= reduceContext (text "tcSimpl
RuleLh
s") try_me [] wanteds `thenTc` \ (binds, frees, irreds) ->
tcSimplify
ToDict
s :: LIE -> TcM s (LIE, TcDictBinds)
tcSimplify
ToDict
s wanted_lie
= reduceContext (text "tcSimpl
ifyToDict
s") try_me [] wanteds `thenTc` \ (binds, frees, irreds) ->
ASSERT( null frees )
returnTc (mkLIE irreds, binds)
where
...
...
@@ -308,6 +325,7 @@ tcSimplifyRuleLhs wanted_lie
\end{code}
%************************************************************************
%* *
\subsection{Data types for the reduction mechanism}
...
...
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