diff options
author | David Knothe <dknothe314@me.com> | 2023-01-25 12:06:13 +0100 |
---|---|---|
committer | David Knothe <dknothe314@me.com> | 2023-01-25 12:06:13 +0100 |
commit | d3fe8581d40fbc55adab30b87c1f7e437063a7db (patch) | |
tree | e2563ed5eff813f544e55cc2763f6ae2448744ce /utils/check-exact/ExactPrint.hs | |
parent | 85b990c3823c0a8db841a3329da752f072ef761e (diff) | |
download | haskell-wip/or-pats-build-works.tar.gz |
Add EPAswip/or-pats-build-works
Diffstat (limited to 'utils/check-exact/ExactPrint.hs')
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index df7fdfda1e..a3332f5f19 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -63,6 +63,7 @@ import Data.Functor.Const import qualified Data.Set as Set import Data.Typeable import Data.List ( partition, sort, sortBy) +import qualified Data.List.NonEmpty as NE import Data.Maybe ( isJust, mapMaybe ) import Data.Void @@ -4548,6 +4549,7 @@ instance ExactPrint (Pat GhcPs) where getAnnotationEntry (NPat an _ _ _) = fromAnn an getAnnotationEntry (NPlusKPat an _ _ _ _ _) = fromAnn an getAnnotationEntry (SigPat an _ _) = fromAnn an + getAnnotationEntry (OrPat an _) = fromAnn an setAnnotationAnchor a@(WildPat _) _ _s = a setAnnotationAnchor a@(VarPat _ _) _ _s = a @@ -4565,6 +4567,7 @@ instance ExactPrint (Pat GhcPs) where setAnnotationAnchor (NPat an a b c) anc cs = (NPat (setAnchorEpa an anc cs) a b c) setAnnotationAnchor (NPlusKPat an a b c d e) anc cs = (NPlusKPat (setAnchorEpa an anc cs) a b c d e) setAnnotationAnchor (SigPat an a b) anc cs = (SigPat (setAnchorEpa an anc cs) a b) + setAnnotationAnchor (OrPat an a) anc cs = (OrPat (setAnchorEpa an anc cs) a) exact (WildPat w) = do anchor <- getAnchorU @@ -4654,6 +4657,12 @@ instance ExactPrint (Pat GhcPs) where sig' <- markAnnotated sig return (SigPat an0 pat' sig') + exact (OrPat an pats) = do + an0 <- markEpAnnL an lidl AnnOne + an1 <- markEpAnnL an0 lidl AnnOf + pats' <- markAnnotated (NE.toList pats) + return (OrPat an1 (NE.fromList pats')) + -- --------------------------------------------------------------------- instance ExactPrint (HsPatSigType GhcPs) where |