on master help sign in
[#70] Format Pattern Synonym Signatures
cd8302aRupert Horlick
data/examples/declaration/signature/pattern/multiline-out.hsnew file+5
@@ -0,0 +1,5 @@
1+{-# LANGUAGE PatternSynonyms #-}
2+pattern Arrow
3+ :: Type
4+ -> Type
5+ -> Type
data/examples/declaration/signature/pattern/multiline.hsnew file+3
@@ -0,0 +1,3 @@
1+{-# LANGUAGE PatternSynonyms #-}
2+pattern Arrow :: Type
3+ -> Type -> Type
data/examples/declaration/signature/pattern/single-line-out.hsnew file+2
@@ -0,0 +1,2 @@
1+{-# LANGUAGE PatternSynonyms #-}
2+pattern Arrow :: Type -> Type -> Type
data/examples/declaration/signature/pattern/single-line.hsnew file+3
@@ -0,0 +1,3 @@
1+{-# LANGUAGE PatternSynonyms #-}
2+
3+pattern Arrow :: Type -> Type -> Type
src/Ormolu/Printer/Meat/Declaration/Signature.hs+9
@@ -25,6 +25,7 @@ p_sigDecl = line . p_sigDecl'
25p_sigDecl' :: Sig GhcPs -> R ()
25p_sigDecl' :: Sig GhcPs -> R ()
26p_sigDecl' = \case
26p_sigDecl' = \case
27 TypeSig NoExt names hswc -> p_typeSig names hswc
27 TypeSig NoExt names hswc -> p_typeSig names hswc
28+ PatSynSig NoExt names hsib -> p_patSynSig names hsib
28 ClassOpSig NoExt def names hsib -> p_classOpSig def names hsib
29 ClassOpSig NoExt def names hsib -> p_classOpSig def names hsib
29 FixSig NoExt sig -> p_fixSig sig
30 FixSig NoExt sig -> p_fixSig sig
30 InlineSig NoExt name inlinePragma -> p_inlineSig name inlinePragma
31 InlineSig NoExt name inlinePragma -> p_inlineSig name inlinePragma
@@ -56,6 +57,14 @@ p_typeAscription HsWC {..} = do
56 located (hsib_body hswc_body) p_hsType
57 located (hsib_body hswc_body) p_hsType
57p_typeAscription (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs"
58p_typeAscription (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs"
58
59
60+p_patSynSig
61+ :: [Located RdrName]
62+ -> HsImplicitBndrs GhcPs (LHsType GhcPs)
63+ -> R ()
64+p_patSynSig names hsib = do
65+ txt "pattern "
66+ p_typeSig names HsWC {hswc_ext = NoExt, hswc_body = hsib}
67+
59p_classOpSig
68p_classOpSig
60 :: Bool -- ^ Whether this is a \"default\" signature
69 :: Bool -- ^ Whether this is a \"default\" signature
61 -> [Located RdrName] -- ^ Names (before @::@)
70 -> [Located RdrName] -- ^ Names (before @::@)