module Seminal.Enumerator.Signatures (enumerateChangeInSignature) where
import Seminal.Compiler.API 
import Seminal.Enumerator.Enumerator (Enumerator)
import Seminal.Enumerator.Types(enumerateChangeInType)
import Seminal.Change ((<&&>), forceRewrite)
import Data.Functor ((<&>))

enumerateChangeInSignature :: Enumerator (Sig GhcPs)
enumerateChangeInSignature :: Enumerator (Sig GhcPs)
enumerateChangeInSignature Sig GhcPs
sig SrcSpan
_ = case Sig GhcPs
sig of
    (TypeSig XTypeSig GhcPs
xtypesig [LIdP GhcPs]
ids (HsWC XHsWC GhcPs (LHsSigType GhcPs)
xwc (L SrcSpanAnnA
lbody (HsSig XHsSig GhcPs
xsig HsOuterSigTyVarBndrs GhcPs
bndrs (L SrcSpanAnnA
ltype HsType GhcPs
typ))))) -> Enumerator (HsType GhcPs)
enumerateChangeInType HsType GhcPs
typ (SrcSpanAnnA -> SrcSpan
forall a. SrcSpanAnn' a -> SrcSpan
locA SrcSpanAnnA
ltype)
        [Change (HsType GhcPs)]
-> (HsType GhcPs -> Sig GhcPs) -> [Change (Sig GhcPs)]
forall a b. [Change a] -> (a -> b) -> [Change b]
<&&> (XTypeSig GhcPs
-> [LIdP GhcPs]
-> HsWildCardBndrs GhcPs (LHsSigType GhcPs)
-> Sig GhcPs
forall pass.
XTypeSig pass -> [LIdP pass] -> LHsSigWcType pass -> Sig pass
TypeSig XTypeSig GhcPs
xtypesig [LIdP GhcPs]
ids(HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
 -> Sig GhcPs)
-> (HsType GhcPs
    -> HsWildCardBndrs
         GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs)))
-> HsType GhcPs
-> Sig GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XHsWC GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> GenLocated SrcSpanAnnA (HsSigType GhcPs)
-> HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
forall pass thing.
XHsWC pass thing -> thing -> HsWildCardBndrs pass thing
HsWC XHsWC GhcPs (LHsSigType GhcPs)
XHsWC GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
xwc (GenLocated SrcSpanAnnA (HsSigType GhcPs)
 -> HsWildCardBndrs
      GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs)))
-> (HsType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> HsType GhcPs
-> HsWildCardBndrs GhcPs (GenLocated SrcSpanAnnA (HsSigType GhcPs))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SrcSpanAnnA
-> HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
lbody (HsSigType GhcPs -> GenLocated SrcSpanAnnA (HsSigType GhcPs))
-> (HsType GhcPs -> HsSigType GhcPs)
-> HsType GhcPs
-> GenLocated SrcSpanAnnA (HsSigType GhcPs)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XHsSig GhcPs
-> HsOuterSigTyVarBndrs GhcPs -> LHsType GhcPs -> HsSigType GhcPs
forall pass.
XHsSig pass
-> HsOuterSigTyVarBndrs pass -> LHsType pass -> HsSigType pass
HsSig XHsSig GhcPs
xsig HsOuterSigTyVarBndrs GhcPs
bndrs (GenLocated SrcSpanAnnA (HsType GhcPs) -> HsSigType GhcPs)
-> (HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs))
-> HsType GhcPs
-> HsSigType GhcPs
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SrcSpanAnnA
-> HsType GhcPs -> GenLocated SrcSpanAnnA (HsType GhcPs)
forall l e. l -> e -> GenLocated l e
L SrcSpanAnnA
ltype)
        [Change (Sig GhcPs)]
-> (Change (Sig GhcPs) -> Change (Sig GhcPs))
-> [Change (Sig GhcPs)]
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> Change (Sig GhcPs) -> Change (Sig GhcPs)
forall node. Outputable node => Change node -> Change node
forceRewrite
    Sig GhcPs
_ -> []