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
38f258e0
Commit
38f258e0
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-08-25 21:55:27 by sof]
re-org
parent
c11ba0a5
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/types/Type.lhs
+33
-42
33 additions, 42 deletions
ghc/compiler/types/Type.lhs
with
33 additions
and
42 deletions
ghc/compiler/types/Type.lhs
+
33
−
42
View file @
38f258e0
...
...
@@ -79,14 +79,6 @@ import Util ( thenCmp, zipEqual, assoc,
panic, panic#, assertPanic, pprPanic,
Ord3(..){-instances-}
)
-- ToDo:rm all these
--import {-mumble-}
-- Pretty
--import {-mumble-}
-- PprStyle
--import {-mumble-}
-- PprType --(pprType )
--import PprEnv
\end{code}
Data types
...
...
@@ -160,40 +152,6 @@ The reason is that we then get better (shorter) type signatures in
interfaces. Notably this plays a role in tcTySigs in TcBinds.lhs.
Expand abbreviations
~~~~~~~~~~~~~~~~~~~~
Removes just the top level of any abbreviations.
\begin{code}
expandTy :: Type -> Type -- Restricted to Type due to Dict expansion
expandTy (FunTy t1 t2 u) = AppTy (AppTy (TyConTy mkFunTyCon u) t1) t2
expandTy (SynTy _ _ t) = expandTy t
expandTy (DictTy clas ty u)
= case all_arg_tys of
[] -> voidTy -- Empty dictionary represented by Void
[arg_ty] -> expandTy arg_ty -- just the <whatever> itself
-- The extra expandTy is to make sure that
-- the result isn't still a dict, which it might be
-- if the original guy was a dict with one superdict and
-- no methods!
other -> ASSERT(not (null all_arg_tys))
foldl AppTy (TyConTy (tupleTyCon (length all_arg_tys)) u) all_arg_tys
-- A tuple of 'em
-- Note: length of all_arg_tys can be 0 if the class is
-- CCallable, CReturnable (and anything else
-- *really weird* that the user writes).
where
all_arg_tys = classDictArgTys clas ty
expandTy ty = ty
\end{code}
Simple construction and analysis functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{code}
...
...
@@ -751,6 +709,39 @@ instantiateUsage
instantiateUsage = panic "instantiateUsage: not implemented"
\end{code}
Expand abbreviations
~~~~~~~~~~~~~~~~~~~~
Removes just the top level of any abbreviations.
\begin{code}
expandTy :: Type -> Type -- Restricted to Type due to Dict expansion
expandTy (FunTy t1 t2 u) = AppTy (AppTy (TyConTy mkFunTyCon u) t1) t2
expandTy (SynTy _ _ t) = expandTy t
expandTy (DictTy clas ty u)
= case all_arg_tys of
[] -> voidTy -- Empty dictionary represented by Void
[arg_ty] -> expandTy arg_ty -- just the <whatever> itself
-- The extra expandTy is to make sure that
-- the result isn't still a dict, which it might be
-- if the original guy was a dict with one superdict and
-- no methods!
other -> ASSERT(not (null all_arg_tys))
foldl AppTy (TyConTy (tupleTyCon (length all_arg_tys)) u) all_arg_tys
-- A tuple of 'em
-- Note: length of all_arg_tys can be 0 if the class is
-- CCallable, CReturnable (and anything else
-- *really weird* that the user writes).
where
all_arg_tys = classDictArgTys clas ty
expandTy ty = ty
\end{code}
At present there are no unboxed non-primitive types, so
isUnboxedType is the same as isPrimType.
...
...
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