diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-03-19 17:47:55 -0400 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2019-07-09 11:52:45 -0400 |
commit | 6a03d77b9a9915e4b37fe1ea6688c135e7b00654 (patch) | |
tree | 4154abaa768adbfadc4eb17db620c3ed08b82c5f /compiler/simplStg | |
parent | 5af815f2e43e9f1b5ca9ec0803f9fccabb49e2fe (diff) | |
download | haskell-6a03d77b9a9915e4b37fe1ea6688c135e7b00654.tar.gz |
Use an empty data type in TTG extension constructors (#15247)
To avoid having to `panic` any time a TTG extension constructor is
consumed, this MR introduces an uninhabited 'NoExtCon' type and uses
that in every extension constructor's type family instance where it
is appropriate. This also introduces a 'noExtCon' function which
eliminates a 'NoExtCon', much like 'Data.Void.absurd' eliminates
a 'Void'.
I also renamed the existing `NoExt` type to `NoExtField` to better
distinguish it from `NoExtCon`. Unsurprisingly, there is a lot of
code churn resulting from this.
Bumps the Haddock submodule. Fixes #15247.
Diffstat (limited to 'compiler/simplStg')
-rw-r--r-- | compiler/simplStg/StgLiftLams/Transformation.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/simplStg/StgLiftLams/Transformation.hs b/compiler/simplStg/StgLiftLams/Transformation.hs index 7b37bac91e..bef39a1856 100644 --- a/compiler/simplStg/StgLiftLams/Transformation.hs +++ b/compiler/simplStg/StgLiftLams/Transformation.hs @@ -107,12 +107,12 @@ liftRhs mb_former_fvs rhs@(StgRhsCon ccs con args) liftRhs Nothing (StgRhsClosure _ ccs upd infos body) = do -- This RHS wasn't lifted. withSubstBndrs (map binderInfoBndr infos) $ \bndrs' -> - StgRhsClosure noExtSilent ccs upd bndrs' <$> liftExpr body + StgRhsClosure noExtFieldSilent ccs upd bndrs' <$> liftExpr body liftRhs (Just former_fvs) (StgRhsClosure _ ccs upd infos body) = do -- This RHS was lifted. Insert extra binders for @former_fvs@. withSubstBndrs (map binderInfoBndr infos) $ \bndrs' -> do let bndrs'' = dVarSetElems former_fvs ++ bndrs' - StgRhsClosure noExtSilent ccs upd bndrs'' <$> liftExpr body + StgRhsClosure noExtFieldSilent ccs upd bndrs'' <$> liftExpr body liftArgs :: InStgArg -> LiftM OutStgArg liftArgs a@(StgLitArg _) = pure a @@ -142,13 +142,13 @@ liftExpr (StgLet scope bind body) body' <- liftExpr body case mb_bind' of Nothing -> pure body' -- withLiftedBindPairs decided to lift it and already added floats - Just bind' -> pure (StgLet noExtSilent bind' body') + Just bind' -> pure (StgLet noExtFieldSilent bind' body') liftExpr (StgLetNoEscape scope bind body) = withLiftedBind NotTopLevel bind scope $ \mb_bind' -> do body' <- liftExpr body case mb_bind' of Nothing -> pprPanic "stgLiftLams" (text "Should never decide to lift LNEs") - Just bind' -> pure (StgLetNoEscape noExtSilent bind' body') + Just bind' -> pure (StgLetNoEscape noExtFieldSilent bind' body') liftAlt :: LlStgAlt -> LiftM OutStgAlt liftAlt (con, infos, rhs) = withSubstBndrs (map binderInfoBndr infos) $ \bndrs' -> |