diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-10-29 16:32:37 +0300 |
---|---|---|
committer | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-11-03 16:35:50 +0300 |
commit | bf6f96a61397ba8e48d030395f5c58a999f98499 (patch) | |
tree | b8d092174075ade017337a3feb10e5f987af032a | |
parent | 9f42a6dcebf12a8c3e7c18d8291c0fa95e3c4d86 (diff) | |
download | haskell-bf6f96a61397ba8e48d030395f5c58a999f98499.tar.gz |
Generalize the type of wrapLocSndMA
-rw-r--r-- | compiler/GHC/Tc/Utils/Monad.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Utils/Monad.hs b/compiler/GHC/Tc/Utils/Monad.hs index fc293654ec..69ac0c5b59 100644 --- a/compiler/GHC/Tc/Utils/Monad.hs +++ b/compiler/GHC/Tc/Utils/Monad.hs @@ -950,8 +950,7 @@ wrapLocM fn (L loc a) = setSrcSpan loc $ do { b <- fn a ; return (L loc b) } wrapLocAM :: (a -> TcM b) -> LocatedAn an a -> TcM (Located b) -wrapLocAM fn (L loc a) = setSrcSpanA loc $ do { b <- fn a - ; return (L (locA loc) b) } +wrapLocAM fn a = wrapLocM fn (reLoc a) wrapLocMA :: (a -> TcM b) -> GenLocated (SrcSpanAnn' ann) a -> TcRn (GenLocated (SrcSpanAnn' ann) b) wrapLocMA fn (L loc a) = setSrcSpanA loc $ do { b <- fn a @@ -963,7 +962,12 @@ wrapLocFstM fn (L loc a) = (b,c) <- fn a return (L loc b, c) -wrapLocFstMA :: (a -> TcM (b,c)) -> LocatedAn t a -> TcM (LocatedAn t b, c) +-- Possible instantiations: +-- wrapLocFstMA :: (a -> TcM (b,c)) -> LocatedA a -> TcM (LocatedA b, c) +-- wrapLocFstMA :: (a -> TcM (b,c)) -> LocatedN a -> TcM (LocatedN b, c) +-- wrapLocFstMA :: (a -> TcM (b,c)) -> LocatedAn t a -> TcM (LocatedAn t b, c) +-- and so on. +wrapLocFstMA :: (a -> TcM (b,c)) -> GenLocated (SrcSpanAnn' ann) a -> TcM (GenLocated (SrcSpanAnn' ann) b, c) wrapLocFstMA fn (L loc a) = setSrcSpanA loc $ do (b,c) <- fn a @@ -975,7 +979,12 @@ wrapLocSndM fn (L loc a) = (b,c) <- fn a return (b, L loc c) -wrapLocSndMA :: (a -> TcM (b, c)) -> LocatedA a -> TcM (b, LocatedA c) +-- Possible instantiations: +-- wrapLocSndMA :: (a -> TcM (b, c)) -> LocatedA a -> TcM (b, LocatedA c) +-- wrapLocSndMA :: (a -> TcM (b, c)) -> LocatedN a -> TcM (b, LocatedN c) +-- wrapLocSndMA :: (a -> TcM (b, c)) -> LocatedAn t a -> TcM (b, LocatedAn t c) +-- and so on. +wrapLocSndMA :: (a -> TcM (b, c)) -> GenLocated (SrcSpanAnn' ann) a -> TcM (b, GenLocated (SrcSpanAnn' ann) c) wrapLocSndMA fn (L loc a) = setSrcSpanA loc $ do (b,c) <- fn a |