Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : type-holes-branch
http://hackage.haskell.org/trac/ghc/changeset/03fb6039c4e57c9cf92bcb8f0c0682c49c9f0897 >--------------------------------------------------------------- commit 03fb6039c4e57c9cf92bcb8f0c0682c49c9f0897 Author: Thijs Alkemade <[email protected]> Date: Wed Jul 11 15:52:43 2012 +0200 Add a flag to turn (unnamed) holes on. This is now -XHoles or {-# LANGUAGE Holes #-}. Named holes should probably be completely removed or disabled in the parser. >--------------------------------------------------------------- compiler/main/DynFlags.hs | 4 +++- compiler/rename/RnExpr.lhs | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index c04b474..4ae66e6 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -461,6 +461,7 @@ data ExtensionFlag | Opt_NondecreasingIndentation | Opt_RelaxedLayout | Opt_TraditionalRecordSyntax + | Opt_Holes deriving (Eq, Enum, Show) -- | Contains not only a collection of 'DynFlag's but also a plethora of @@ -2058,7 +2059,8 @@ xFlags = [ ( "OverlappingInstances", Opt_OverlappingInstances, nop ), ( "UndecidableInstances", Opt_UndecidableInstances, nop ), ( "IncoherentInstances", Opt_IncoherentInstances, nop ), - ( "PackageImports", Opt_PackageImports, nop ) + ( "PackageImports", Opt_PackageImports, nop ), + ( "Holes", Opt_Holes, nop ) ] defaultFlags :: [DynFlag] diff --git a/compiler/rename/RnExpr.lhs b/compiler/rename/RnExpr.lhs index e7cc03b..d1719f2 100644 --- a/compiler/rename/RnExpr.lhs +++ b/compiler/rename/RnExpr.lhs @@ -305,9 +305,12 @@ Since all the symbols are reservedops we can simply reject them. We return a (bogus) EWildPat in each case. \begin{code} -rnExpr e@EWildPat = do { srcspan <- getSrcSpanM - ; name' <- rnHoleName srcspan Nothing - ; return (HsHole name', emptyFVs) +rnExpr e@EWildPat = do { holes <- xoptM Opt_Holes + ; if holes then do { srcspan <- getSrcSpanM + ; name' <- rnHoleName srcspan Nothing + ; return (HsHole name', emptyFVs) + } + else patSynErr e } -- rnExpr e@EWildPat = patSynErr e rnExpr e@(EAsPat {}) = patSynErr e _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
