@@ -10,6 +10,7 @@ module Ormolu.Printer.Meat.Declaration.Signature
13+import BasicTypes (Fixity (..))
13import Control.Monad
14import Control.Monad
15import Ormolu.Printer.Combinators
16import Ormolu.Printer.Combinators
@@ -23,14 +24,13 @@ p_sigDecl = line . p_sigDecl'
23p_sigDecl' :: Sig GhcPs -> R ()
24p_sigDecl' :: Sig GhcPs -> R ()
24p_sigDecl' = \case
25p_sigDecl' = \case
25 TypeSig NoExt names hswc -> p_typeSig names hswc
26 TypeSig NoExt names hswc -> p_typeSig names hswc
26− ClassOpSig NoExt def names hsib -> do
27+ ClassOpSig NoExt def names hsib -> p_classOpSig def names hsib
27− when def (txt "default ")
28+ FixSig NoExt sig -> p_fixSig sig
28− p_typeSig names HsWC {hswc_ext = NoExt, hswc_body = hsib}
29 _ -> notImplemented "certain types of signature declarations"
29 _ -> notImplemented "certain types of signature declarations"
32− :: [Located RdrName]
32+ :: [Located RdrName] -- ^ Names (before @::@)
33− -> LHsSigWcType GhcPs
33+ -> LHsSigWcType GhcPs -- ^ Type
35p_typeSig names HsWC {..} = do
35p_typeSig names HsWC {..} = do
36 spaceSep p_rdrName names
36 spaceSep p_rdrName names
@@ -39,3 +39,27 @@ p_typeSig names HsWC {..} = do
40 located (hsib_body hswc_body) p_hsType
40 located (hsib_body hswc_body) p_hsType
41p_typeSig _ (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs"
41p_typeSig _ (XHsWildCardBndrs NoExt) = notImplemented "XHsWildCardBndrs"
44+ :: Bool -- ^ Whether this is a \"default\" signature
45+ -> [Located RdrName] -- ^ Names (before @::@)
46+ -> HsImplicitBndrs GhcPs (LHsType GhcPs) -- ^ Type
48+p_classOpSig def names hsib = do
49+ when def (txt "default ")
50+ p_typeSig names HsWC {hswc_ext = NoExt, hswc_body = hsib}
56+ FixitySig NoExt names (Fixity _ n dir) -> do
64+ sequence_ (withSep comma p_rdrName names)
65+ XFixitySig NoExt -> notImplemented "XFixitySig"