[commit: ghc] wip/T12618: Add DataCon.dataConRepFullArity (ab1f38d)
git at git.haskell.org
git at git.haskell.org
Sun Oct 2 03:04:33 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T12618
Link : http://ghc.haskell.org/trac/ghc/changeset/ab1f38d4749024bf90d6b5c891bf36ce94605fca/ghc
>---------------------------------------------------------------
commit ab1f38d4749024bf90d6b5c891bf36ce94605fca
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Fri Sep 30 20:48:33 2016 -0400
Add DataCon.dataConRepFullArity
which is the number of arguments expected by the data constructor
worker, including type argument, and hence the list of an (uncompressed)
argument list in ConApp.
>---------------------------------------------------------------
ab1f38d4749024bf90d6b5c891bf36ce94605fca
compiler/basicTypes/DataCon.hs | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/compiler/basicTypes/DataCon.hs b/compiler/basicTypes/DataCon.hs
index 6fda33a..47b05c9 100644
--- a/compiler/basicTypes/DataCon.hs
+++ b/compiler/basicTypes/DataCon.hs
@@ -39,7 +39,7 @@ module DataCon (
dataConInstOrigArgTys, dataConRepArgTys,
dataConFieldLabels, dataConFieldType,
dataConSrcBangs,
- dataConSourceArity, dataConRepArity,
+ dataConSourceArity, dataConRepArity, dataConRepFullArity,
dataConIsInfix,
dataConWorkId, dataConWrapId, dataConWrapId_maybe,
dataConImplicitTyThings,
@@ -385,8 +385,10 @@ data DataCon
-- Cached; see Note [DataCon arities]
-- INVARIANT: dcRepArity == length dataConRepArgTys
-- INVARIANT: dcSourceArity == length dcOrigArgTys
- dcRepArity :: Arity,
- dcSourceArity :: Arity,
+ -- INVARIANT: dcRepFullArity == length univ_tvs + length ex_tvs + dcRepArity
+ dcRepArity :: Arity,
+ dcSourceArity :: Arity,
+ dcRepFullArity :: Arity,
-- Result type of constructor is T t1..tn
dcRepTyCon :: TyCon, -- Result tycon, T
@@ -799,6 +801,7 @@ mkDataCon name declared_infix prom_info
dcRep = rep,
dcSourceArity = length orig_arg_tys,
dcRepArity = length rep_arg_tys,
+ dcRepFullArity = length univ_tvs + length ex_tvs + dcRepArity con,
dcPromoted = promoted }
-- The 'arg_stricts' passed to mkDataCon are simply those for the
@@ -995,6 +998,11 @@ dataConSourceArity (MkData { dcSourceArity = arity }) = arity
dataConRepArity :: DataCon -> Arity
dataConRepArity (MkData { dcRepArity = arity }) = arity
+-- | Gives the number of arguments expected in ConApp: the universal type
+-- variables, the existential type variables, the value arguments
+dataConRepFullArity :: DataCon -> Arity
+dataConRepFullArity (MkData { dcRepFullArity = arity }) = arity
+
-- | Return whether there are any argument types for this 'DataCon's original source type
-- See Note [DataCon arities]
isNullarySrcDataCon :: DataCon -> Bool
More information about the ghc-commits
mailing list