mirror of
https://github.com/google/ghc-source-gen.git
synced 2024-12-03 07:09:11 +03:00
Remove the deprecated patBind
and bump to 0.2. (#15)
This commit is contained in:
parent
2929534d05
commit
3de930e086
@ -1,11 +1,9 @@
|
|||||||
# Changelog for haskell-syntax
|
# Changelog for haskell-syntax
|
||||||
|
|
||||||
## 0.1.1.0
|
## 0.2
|
||||||
- Improved comments for instances of `HasValBind'.
|
- Improved comments for instances of `HasValBind'.
|
||||||
- Generalized `patBind` to any `HasValBind` so it can be used
|
- Generalized `patBind` to any `HasValBind` so it can be used
|
||||||
with `let'` and `while'`. The old version is still exported
|
with `let'` and `while'`.
|
||||||
from `GHC.SourceGen.Decl`, but deprecated. The new version is
|
|
||||||
exported from `GHC.SourceGen.Binds` and `GHC.SourceGen`.
|
|
||||||
|
|
||||||
## 0.1.0.0
|
## 0.1.0.0
|
||||||
Initial version.
|
Initial version.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# https://developers.google.com/open-source/licenses/bsd
|
# https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
name: ghc-source-gen
|
name: ghc-source-gen
|
||||||
version: 0.1.1.0
|
version: 0.2
|
||||||
github: "google/ghc-source-gen"
|
github: "google/ghc-source-gen"
|
||||||
license: BSD3
|
license: BSD3
|
||||||
author: "Judah Jacobson"
|
author: "Judah Jacobson"
|
||||||
|
@ -32,7 +32,7 @@ module GHC.SourceGen
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import GHC.SourceGen.Binds
|
import GHC.SourceGen.Binds
|
||||||
import GHC.SourceGen.Decl hiding (patBind)
|
import GHC.SourceGen.Decl
|
||||||
import GHC.SourceGen.Expr
|
import GHC.SourceGen.Expr
|
||||||
import GHC.SourceGen.Lit
|
import GHC.SourceGen.Lit
|
||||||
import GHC.SourceGen.Module
|
import GHC.SourceGen.Module
|
||||||
|
@ -11,8 +11,6 @@ module GHC.SourceGen.Decl
|
|||||||
type'
|
type'
|
||||||
, newtype'
|
, newtype'
|
||||||
, data'
|
, data'
|
||||||
-- * Pattern bindings
|
|
||||||
, patBind
|
|
||||||
-- * Data constructors
|
-- * Data constructors
|
||||||
, prefixCon
|
, prefixCon
|
||||||
, infixCon
|
, infixCon
|
||||||
@ -32,7 +30,6 @@ module GHC.SourceGen.Decl
|
|||||||
|
|
||||||
import BasicTypes (LexicalFixity(Prefix))
|
import BasicTypes (LexicalFixity(Prefix))
|
||||||
import Bag (listToBag)
|
import Bag (listToBag)
|
||||||
import HsBinds (HsBindLR(..))
|
|
||||||
import HsDecls
|
import HsDecls
|
||||||
import HsTypes
|
import HsTypes
|
||||||
( ConDeclField(..)
|
( ConDeclField(..)
|
||||||
@ -52,7 +49,6 @@ import PlaceHolder (PlaceHolder(..))
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
import GHC.SourceGen.Binds hiding (patBind)
|
import GHC.SourceGen.Binds hiding (patBind)
|
||||||
import GHC.SourceGen.Binds.Internal (mkGRHSs)
|
|
||||||
import GHC.SourceGen.Lit.Internal (noSourceText)
|
import GHC.SourceGen.Lit.Internal (noSourceText)
|
||||||
import GHC.SourceGen.Name.Internal
|
import GHC.SourceGen.Name.Internal
|
||||||
import GHC.SourceGen.Syntax
|
import GHC.SourceGen.Syntax
|
||||||
@ -317,31 +313,3 @@ renderCon98Decl name details = noExt ConDeclH98 (typeRdrName name)
|
|||||||
Nothing
|
Nothing
|
||||||
details
|
details
|
||||||
Nothing
|
Nothing
|
||||||
|
|
||||||
-- | A pattern binding.
|
|
||||||
--
|
|
||||||
-- > x = y
|
|
||||||
-- > =====
|
|
||||||
-- > patBind (var "x") $ rhs $ var "y"
|
|
||||||
--
|
|
||||||
-- > (x, y) = e
|
|
||||||
-- > =====
|
|
||||||
-- > patBind (tuple [var "x", var "y"]) $ rhs e
|
|
||||||
--
|
|
||||||
-- > (x, y)
|
|
||||||
-- > | test = (1, 2)
|
|
||||||
-- > | otherwise = (2, 3)
|
|
||||||
-- > =====
|
|
||||||
-- > patBind (tuple [var "x", var "y"])
|
|
||||||
-- > $ guardedRhs
|
|
||||||
-- > [ var "test" `guard` tuple [int 1, int 2]
|
|
||||||
-- > , var "otherwise" `guard` [int 2, int 3]
|
|
||||||
-- > ]
|
|
||||||
patBind :: Pat' -> RawGRHSs -> HsDecl'
|
|
||||||
patBind p g =
|
|
||||||
bindB
|
|
||||||
$ withPlaceHolder
|
|
||||||
(withPlaceHolder
|
|
||||||
(noExt PatBind (builtPat p) (mkGRHSs g)))
|
|
||||||
$ ([],[])
|
|
||||||
{-# DEPRECATED patBind "Use GHC.SourceGen.patBind (equivalently: GHC.SourceGen.Binds.patBind)"#-}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user