Skip to content

Commit bacab8d

Browse files
committed
fix for all versions of ghc
1 parent ad3c557 commit bacab8d

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

Diff for: shell.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ stdenv.mkDerivation {
88

99
buildInputs = [
1010
ghc
11-
# cabal-install
12-
# haskellPackages.ghcid
11+
cabal-install
12+
haskellPackages.ghcid
1313
haskellPackages.stylish-haskell
1414
];
1515

Diff for: src/CircuitNotation.hs

+21-3
Original file line numberDiff line numberDiff line change
@@ -902,15 +902,33 @@ tagE a = varE noSrcSpan (tagName ?nms) `appE` a
902902
tagTypeCon :: (p ~ GhcPs, ?nms :: ExternalNames) => LHsType GhcPs
903903
tagTypeCon = noLoc (HsTyVar noExt NotPromoted (noLoc (tagTName ?nms)))
904904

905+
sigPat :: (p ~ GhcPs) => SrcSpan -> LHsType GhcPs -> LPat p -> LPat p
906+
sigPat loc ty a = L loc $
907+
#if __GLASGOW_HASKELL__ < 810
908+
SigPat (HsWC noExt (HsIB noExt ty)) a
909+
#elif __GLASGOW_HASKELL__ < 900
910+
SigPat noExt a (HsWC noExt (HsIB noExt ty))
911+
#else
912+
SigPat noExt a (HsPS noExt ty)
913+
#endif
914+
915+
sigE :: (p ~ GhcPs, ?nms :: ExternalNames) => SrcSpan -> LHsType GhcPs -> LHsExpr p -> LHsExpr p
916+
sigE loc ty a = L loc $
917+
#if __GLASGOW_HASKELL__ < 810
918+
ExprWithTySig (HsWC noExt (HsIB noExt ty)) a
919+
#else
920+
ExprWithTySig noExt a (HsWC noExt (HsIB noExt ty))
921+
#endif
922+
905923
tagTypeP :: (p ~ GhcPs, ?nms :: ExternalNames) => Direction -> LHsType GhcPs -> LPat p -> LPat p
906-
tagTypeP dir ty a
907-
= noLoc (SigPat (HsWC noExt (HsIB noExt (tagTypeCon `appTy` ty `appTy` busType))) a)
924+
tagTypeP dir ty
925+
= sigPat noSrcSpan (tagTypeCon `appTy` ty `appTy` busType)
908926
where
909927
busType = conT noSrcSpan (fwdAndBwdTypes ?nms dir) `appTy` ty
910928

911929
tagTypeE :: (p ~ GhcPs, ?nms :: ExternalNames) => Direction -> LHsType GhcPs -> LHsExpr p -> LHsExpr p
912930
tagTypeE dir ty a
913-
= noLoc (ExprWithTySig (HsWC noExt (HsIB noExt (tagTypeCon `appTy` ty `appTy` busType))) a)
931+
= sigE noSrcSpan (tagTypeCon `appTy` ty `appTy` busType) a
914932
where
915933
busType = conT noSrcSpan (fwdAndBwdTypes ?nms dir) `appTy` ty
916934

0 commit comments

Comments
 (0)