-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,13 @@ | ||
{- | | ||
Copyright: (c) 2020 Kowainik | ||
SPDX-License-Identifier: MPL-2.0 | ||
Maintainer: Kowainik <[email protected]> | ||
Compatibility module for GHC types and functions. Reexports all | ||
required API to work with the GHC API. | ||
-} | ||
|
||
module Stan.Ghc.Compat | ||
( -- * Modules | ||
Module | ||
, ModuleName | ||
, moduleNameString | ||
, moduleName | ||
, moduleStableString | ||
, moduleUnitId | ||
|
||
-- * Names | ||
, Name | ||
, isExternalName | ||
, isSymOcc | ||
, nameModule | ||
, nameOccName | ||
, nameStableString | ||
, occNameString | ||
|
||
-- * Source locations | ||
, RealSrcSpan | ||
, srcSpanEndCol | ||
, srcSpanStartCol | ||
, srcSpanStartLine | ||
, srcSpanEndLine | ||
, srcSpanFile | ||
|
||
-- * Other common types (for debugging and not only) | ||
, ArgFlag (..) | ||
, AvailInfo (..) | ||
, FastString | ||
, FieldLbl (..) | ||
, IfaceTyCon (..) | ||
, IfaceTyConInfo (..) | ||
, IfaceTyConSort (..) | ||
, IfaceTyLit (..) | ||
, PromotionFlag (..) | ||
, TupleSort (..) | ||
) where | ||
|
||
import Avail (AvailInfo (..)) | ||
import BasicTypes (PromotionFlag (..), TupleSort (..)) | ||
import FastString (FastString) | ||
import FieldLabel (FieldLbl (..)) | ||
import IfaceType (IfaceTyCon (..), IfaceTyConInfo (..), IfaceTyConSort (..), IfaceTyLit (..)) | ||
import Module (Module, ModuleName, moduleName, moduleNameString, moduleStableString, moduleUnitId) | ||
import Name (Name, isExternalName, nameModule, nameOccName, nameStableString) | ||
import OccName (isSymOcc, occNameString) | ||
import SrcLoc (RealSrcSpan, srcSpanEndCol, srcSpanEndLine, srcSpanFile, srcSpanStartCol, | ||
srcSpanStartLine) | ||
import Var (ArgFlag (..)) | ||
{-# LANGUAGE CPP #-} | ||
|
||
module Stan.Ghc.Compat (module Compat) where | ||
|
||
#if __GLASGOW_HASKELL__ <= 810 | ||
import Stan.Ghc.Compat810 as Compat | ||
#elif __GLASGOW_HASKELL__ == 900 | ||
import Stan.Ghc.Compat900 as Compat | ||
#elif __GLASGOW_HASKELL__ == 902 | ||
import Stan.Ghc.Compat902 as Compat | ||
#elif __GLASGOW_HASKELL__ == 904 | ||
import Stan.Ghc.Compat902 as Compat | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{-# LANGUAGE CPP #-} | ||
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.4.7
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.2.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.4.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.0.2
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.4.4
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.4.6
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.4.2
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.4.5
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / ubuntu-latest / ghc 9.0.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.4.2
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.4.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.0.2
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.0.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.0.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.2.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.0.2
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.4.7
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.4.6
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.4.5
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.4.4
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.2.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.4.7
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.4.1
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / windows-latest / ghc 9.4.2
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.4.5
Check warning on line 1 in src/Stan/Ghc/Compat810.hs GitHub Actions / macOS-latest / ghc 9.4.6
|
||
|
||
{- | | ||
Copyright: (c) 2020 Kowainik | ||
SPDX-License-Identifier: MPL-2.0 | ||
Maintainer: Kowainik <[email protected]> | ||
Compatibility module for GHC types and functions. Reexports all | ||
required API to work with the GHC API. | ||
-} | ||
|
||
module Stan.Ghc.Compat810 | ||
#if __GLASGOW_HASKELL__ <= 810 | ||
( -- * Modules | ||
Module | ||
, ModuleName | ||
, moduleNameString | ||
, moduleName | ||
, moduleStableString | ||
, moduleUnitId | ||
|
||
-- * Names | ||
, Name | ||
, isExternalName | ||
, isSymOcc | ||
, nameModule | ||
, nameOccName | ||
, nameStableString | ||
, occNameString | ||
|
||
-- * Source locations | ||
, RealSrcSpan | ||
, srcSpanEndCol | ||
, srcSpanStartCol | ||
, srcSpanStartLine | ||
, srcSpanEndLine | ||
, srcSpanFile | ||
, mkRealSrcLoc | ||
, mkRealSrcSpan | ||
|
||
-- * Other common types (for debugging and not only) | ||
, ArgFlag (..) | ||
, AvailInfo (..) | ||
, FastString | ||
, mkFastString | ||
, FieldLbl (..) | ||
, IfaceTyCon (..) | ||
, IfaceTyConInfo (..) | ||
, IfaceTyConSort (..) | ||
, IfaceTyLit (..) | ||
, PromotionFlag (..) | ||
, TupleSort (..) | ||
, showTUnitId | ||
) where | ||
|
||
import Avail (AvailInfo (..)) | ||
import BasicTypes (PromotionFlag (..), TupleSort (..)) | ||
import FastString (FastString, mkFastString) | ||
import FieldLabel (FieldLbl (..)) | ||
import IfaceType (IfaceTyCon (..), IfaceTyConInfo (..), IfaceTyConSort (..), IfaceTyLit (..)) | ||
import Module (Module, ModuleName, moduleName, moduleNameString, moduleStableString, moduleUnitId, | ||
UnitId, unitIdString) | ||
import Name (Name, isExternalName, nameModule, nameOccName, nameStableString) | ||
import OccName (isSymOcc, occNameString) | ||
import SrcLoc (RealSrcSpan, srcSpanEndCol, srcSpanEndLine, srcSpanFile, srcSpanStartCol, | ||
srcSpanStartLine, mkRealSrcLoc, mkRealSrcSpan) | ||
import Var (ArgFlag (..)) | ||
|
||
import qualified Data.Text as T | ||
|
||
showTUnitId :: UnitId -> Text | ||
showTUnitId = T.pack . unitIdString | ||
#else | ||
where | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
{- | | ||
Copyright: (c) 2020 Kowainik | ||
SPDX-License-Identifier: MPL-2.0 | ||
Maintainer: Kowainik <[email protected]> | ||
Compatibility module for GHC types and functions. Reexports all | ||
required API to work with the GHC API. | ||
-} | ||
|
||
module Stan.Ghc.Compat900 | ||
#if __GLASGOW_HASKELL__ == 900 | ||
( -- * Modules | ||
Module | ||
, ModuleName | ||
, moduleNameString | ||
, moduleName | ||
, moduleStableString | ||
, moduleUnitId | ||
|
||
-- * Names | ||
, Name | ||
, isExternalName | ||
, isSymOcc | ||
, nameModule | ||
, nameOccName | ||
, nameStableString | ||
, occNameString | ||
|
||
-- * Source locations | ||
, RealSrcSpan | ||
, srcSpanEndCol | ||
, srcSpanStartCol | ||
, srcSpanStartLine | ||
, srcSpanEndLine | ||
, srcSpanFile | ||
, mkRealSrcLoc | ||
, mkRealSrcSpan | ||
|
||
-- * Other common types (for debugging and not only) | ||
, ArgFlag (..) | ||
, AvailInfo (..) | ||
, FastString | ||
, mkFastString | ||
, FieldLbl (..) | ||
, IfaceTyCon (..) | ||
, IfaceTyConInfo (..) | ||
, IfaceTyConSort (..) | ||
, IfaceTyLit (..) | ||
, PromotionFlag (..) | ||
, TupleSort (..) | ||
, showTUnitId | ||
) where | ||
|
||
import GHC.Types.Avail (AvailInfo (..)) | ||
import GHC.Types.Basic (PromotionFlag (..), TupleSort (..)) | ||
import GHC.Data.FastString (FastString, mkFastString) | ||
import GHC.Types.FieldLabel (FieldLbl (..)) | ||
import GHC.Iface.Type (IfaceTyCon (..), IfaceTyConInfo (..), IfaceTyConSort (..), IfaceTyLit (..)) | ||
import GHC.Unit.Types (Module, moduleName) | ||
import GHC.Unit.Module (moduleStableString) | ||
import GHC.Unit (moduleUnit, toUnitId, UnitId, unitIdString) | ||
import GHC.Unit.Module.Name (ModuleName, moduleNameString) | ||
import GHC.Types.Name (Name, isExternalName, nameModule, nameOccName, nameStableString) | ||
import GHC.Types.Name.Occurrence (isSymOcc, occNameString) | ||
import GHC.Types.SrcLoc (RealSrcSpan, srcSpanEndCol, srcSpanEndLine, srcSpanFile, srcSpanStartCol, | ||
srcSpanStartLine, mkRealSrcSpan, mkRealSrcLoc) | ||
import GHC.Types.Var (ArgFlag (..)) | ||
|
||
import qualified Data.Text as T | ||
|
||
moduleUnitId :: Module -> UnitId | ||
moduleUnitId = toUnitId . moduleUnit | ||
|
||
showTUnitId :: UnitId -> Text | ||
showTUnitId = T.pack . unitIdString | ||
#else | ||
() where | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
module Stan.Ghc.Compat902 | ||
#if __GLASGOW_HASKELL__ == 902 || __GLASGOW_HASKELL__ == 904 | ||
( -- * Modules | ||
Module | ||
, ModuleName | ||
, moduleNameString | ||
, moduleName | ||
, moduleStableString | ||
, moduleUnitId | ||
|
||
-- * Names | ||
, Name | ||
, isExternalName | ||
, isSymOcc | ||
, nameModule | ||
, nameOccName | ||
, nameStableString | ||
, occNameString | ||
|
||
-- * Source locations | ||
, RealSrcSpan | ||
, srcSpanEndCol | ||
, srcSpanStartCol | ||
, srcSpanStartLine | ||
, srcSpanEndLine | ||
, srcSpanFile | ||
, mkRealSrcLoc | ||
, mkRealSrcSpan | ||
|
||
-- * Other common types (for debugging and not only) | ||
, ArgFlag (..) | ||
, AvailInfo (..) | ||
, FastString | ||
, mkFastString | ||
, FieldLbl | ||
, FieldLabel (..) | ||
, IfaceTyCon (..) | ||
, IfaceTyConInfo (..) | ||
, IfaceTyConSort (..) | ||
, IfaceTyLit (..) | ||
, PromotionFlag (..) | ||
, TupleSort (..) | ||
, showTUnitId | ||
) where | ||
|
||
import GHC.Types.Avail (AvailInfo (..)) | ||
import GHC.Types.Basic (PromotionFlag (..), TupleSort (..)) | ||
import GHC.Data.FastString (FastString, mkFastString) | ||
import GHC.Types.FieldLabel (FieldLabel (..)) | ||
import GHC.Iface.Type (IfaceTyCon (..), IfaceTyConInfo (..), IfaceTyConSort (..), IfaceTyLit (..)) | ||
import GHC.Unit.Types (Module, moduleName) | ||
import GHC.Unit.Module (moduleStableString) | ||
import GHC.Unit (moduleUnit, toUnitId, UnitId, unitIdString) | ||
import GHC.Unit.Module.Name (ModuleName, moduleNameString) | ||
import GHC.Types.Name (Name, isExternalName, nameModule, nameOccName, nameStableString) | ||
import GHC.Types.Name.Occurrence (isSymOcc, occNameString) | ||
import GHC.Types.SrcLoc (RealSrcSpan, srcSpanEndCol, srcSpanEndLine, srcSpanFile, srcSpanStartCol, | ||
srcSpanStartLine, mkRealSrcSpan, mkRealSrcLoc) | ||
import GHC.Types.Var (ArgFlag (..)) | ||
|
||
import qualified Data.Text as T | ||
|
||
moduleUnitId :: Module -> UnitId | ||
moduleUnitId = toUnitId . moduleUnit | ||
|
||
showTUnitId :: UnitId -> Text | ||
showTUnitId = T.pack . unitIdString | ||
|
||
type FieldLbl = FieldLabel | ||
#else | ||
() where | ||
#endif |