diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-01-18 15:38:09 +0000 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2021-01-28 22:17:43 +0100 |
commit | afee3b2965ca43d069f6b4a7fb2b7d33d75c446f (patch) | |
tree | b939ac5ff5b320ddfc0e2de0bb285e95d6392b51 /compiler/GHC/Core/ConLike.hs | |
parent | 0249974e7622e35927060da21f9231cb1e6357b9 (diff) | |
download | haskell-wip/T19074a.tar.gz |
Make PatSyn immutablewip/T19074a
Provoked by #19074, this patch makes GHC.Core.PatSyn.PatSyn
immutable, by recording only the *Name* of the matcher and
builder rather than (as currently) the *Id*.
See Note [Keep Ids out of PatSyn] in GHC.Core.PatSyn.
Updates haddock submodule.
Diffstat (limited to 'compiler/GHC/Core/ConLike.hs')
-rw-r--r-- | compiler/GHC/Core/ConLike.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/GHC/Core/ConLike.hs b/compiler/GHC/Core/ConLike.hs index efe29f608f..bbdab332a7 100644 --- a/compiler/GHC/Core/ConLike.hs +++ b/compiler/GHC/Core/ConLike.hs @@ -16,13 +16,13 @@ module GHC.Core.ConLike ( , conLikeExTyCoVars , conLikeName , conLikeStupidTheta - , conLikeWrapId_maybe , conLikeImplBangs , conLikeFullSig , conLikeResTy , conLikeFieldType , conLikesWithFields , conLikeIsInfix + , conLikeHasBuilder ) where #include "HsVersions.h" @@ -41,6 +41,7 @@ import GHC.Types.Var import GHC.Core.Type(mkTyConApp) import GHC.Core.Multiplicity +import Data.Maybe( isJust ) import qualified Data.Data as Data {- @@ -144,12 +145,11 @@ conLikeStupidTheta :: ConLike -> ThetaType conLikeStupidTheta (RealDataCon data_con) = dataConStupidTheta data_con conLikeStupidTheta (PatSynCon {}) = [] --- | Returns the `Id` of the wrapper. This is also known as the builder in --- some contexts. The value is Nothing only in the case of unidirectional --- pattern synonyms. -conLikeWrapId_maybe :: ConLike -> Maybe Id -conLikeWrapId_maybe (RealDataCon data_con) = Just $ dataConWrapId data_con -conLikeWrapId_maybe (PatSynCon pat_syn) = fst <$> patSynBuilder pat_syn +-- | 'conLikeHasBuilder' returns True except for +-- uni-directional pattern synonyms, which have no builder +conLikeHasBuilder :: ConLike -> Bool +conLikeHasBuilder (RealDataCon {}) = True +conLikeHasBuilder (PatSynCon pat_syn) = isJust (patSynBuilder pat_syn) -- | Returns the strictness information for each constructor conLikeImplBangs :: ConLike -> [HsImplBang] |