Implement rendering of ‘SigPat’s

This commit is contained in:
Mitchell Rosen 2019-06-10 01:08:26 -04:00 committed by Mark Karpov
parent fab9f15ad6
commit 4b1d31e4ea
4 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1,7 @@
f = do
x :: a <- g
f = do
(x, y)
:: (a, b) <-
g

View File

@ -0,0 +1,7 @@
f = do
x :: a <- g
f = do
(x, y)
:: (a, b)
<- g

View File

@ -7,6 +7,7 @@
module Ormolu.Printer.Meat.Declaration.Signature module Ormolu.Printer.Meat.Declaration.Signature
( p_sigDecl ( p_sigDecl
, p_sigDecl' , p_sigDecl'
, p_typeAscription
) )
where where
@ -34,13 +35,19 @@ p_typeSig
:: [Located RdrName] -- ^ Names (before @::@) :: [Located RdrName] -- ^ Names (before @::@)
-> LHsSigWcType GhcPs -- ^ Type -> LHsSigWcType GhcPs -- ^ Type
-> R () -> R ()
p_typeSig names HsWC {..} = do p_typeSig names hswc = do
spaceSep p_rdrName names spaceSep p_rdrName names
p_typeAscription hswc
p_typeAscription
:: LHsSigWcType GhcPs
-> R ()
p_typeAscription HsWC {..} = do
breakpoint breakpoint
inci $ do inci $ do
txt ":: " txt ":: "
located (hsib_body hswc_body) p_hsType located (hsib_body hswc_body) p_hsType
p_typeSig _ (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs" p_typeAscription (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs"
p_classOpSig p_classOpSig
:: Bool -- ^ Whether this is a \"default\" signature :: Bool -- ^ Whether this is a \"default\" signature

View File

@ -487,7 +487,9 @@ p_pat = \case
LitPat NoExt p -> atom p LitPat NoExt p -> atom p
NPat NoExt v _ _ -> located v (atom . ol_val) NPat NoExt v _ _ -> located v (atom . ol_val)
NPlusKPat {} -> notImplemented "NPlusKPat" NPlusKPat {} -> notImplemented "NPlusKPat"
SigPat {} -> notImplemented "SigPat" SigPat hswc pat -> do
located pat p_pat
p_typeAscription hswc
CoPat {} -> notImplemented "CoPat" CoPat {} -> notImplemented "CoPat"
XPat NoExt -> notImplemented "XPat" XPat NoExt -> notImplemented "XPat"