mirror of
https://github.com/ilyakooo0/ormolu.git
synced 2024-10-27 11:41:17 +03:00
Implement rendering of ‘SigPat’s
This commit is contained in:
parent
fab9f15ad6
commit
4b1d31e4ea
@ -0,0 +1,7 @@
|
||||
f = do
|
||||
x :: a <- g
|
||||
|
||||
f = do
|
||||
(x, y)
|
||||
:: (a, b) <-
|
||||
g
|
7
data/examples/declaration/value/function/sig-pattern.hs
Normal file
7
data/examples/declaration/value/function/sig-pattern.hs
Normal file
@ -0,0 +1,7 @@
|
||||
f = do
|
||||
x :: a <- g
|
||||
|
||||
f = do
|
||||
(x, y)
|
||||
:: (a, b)
|
||||
<- g
|
@ -7,6 +7,7 @@
|
||||
module Ormolu.Printer.Meat.Declaration.Signature
|
||||
( p_sigDecl
|
||||
, p_sigDecl'
|
||||
, p_typeAscription
|
||||
)
|
||||
where
|
||||
|
||||
@ -34,13 +35,19 @@ p_typeSig
|
||||
:: [Located RdrName] -- ^ Names (before @::@)
|
||||
-> LHsSigWcType GhcPs -- ^ Type
|
||||
-> R ()
|
||||
p_typeSig names HsWC {..} = do
|
||||
p_typeSig names hswc = do
|
||||
spaceSep p_rdrName names
|
||||
p_typeAscription hswc
|
||||
|
||||
p_typeAscription
|
||||
:: LHsSigWcType GhcPs
|
||||
-> R ()
|
||||
p_typeAscription HsWC {..} = do
|
||||
breakpoint
|
||||
inci $ do
|
||||
txt ":: "
|
||||
located (hsib_body hswc_body) p_hsType
|
||||
p_typeSig _ (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs"
|
||||
p_typeAscription (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs"
|
||||
|
||||
p_classOpSig
|
||||
:: Bool -- ^ Whether this is a \"default\" signature
|
||||
|
@ -487,7 +487,9 @@ p_pat = \case
|
||||
LitPat NoExt p -> atom p
|
||||
NPat NoExt v _ _ -> located v (atom . ol_val)
|
||||
NPlusKPat {} -> notImplemented "NPlusKPat"
|
||||
SigPat {} -> notImplemented "SigPat"
|
||||
SigPat hswc pat -> do
|
||||
located pat p_pat
|
||||
p_typeAscription hswc
|
||||
CoPat {} -> notImplemented "CoPat"
|
||||
XPat NoExt -> notImplemented "XPat"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user