-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#302] Advice using the SPECIALIZE pragma
Resolves #302
- Loading branch information
Showing
11 changed files
with
219 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{- | | ||
Copyright: (c) 2020 Kowainik | ||
SPDX-License-Identifier: MPL-2.0 | ||
Maintainer: Kowainik <[email protected]> | ||
Contains all 'Inspection's for known performance improvements. | ||
The __preformance__ inspections are in ranges: | ||
* @STAN-0401 .. STAN-0500@ | ||
-} | ||
|
||
module Stan.Inspection.Performance | ||
( -- * Performance inspections | ||
-- *** @SPECIALIZE@ pragma | ||
stan0401 | ||
|
||
-- * All inspections | ||
, performanceInspectionsMap | ||
) where | ||
|
||
import Relude.Extra.Tuple (fmapToFst) | ||
|
||
import Stan.Core.Id (Id (..)) | ||
import Stan.Inspection (Inspection (..), InspectionAnalysis (..), InspectionsMap) | ||
import Stan.Severity (Severity (..)) | ||
|
||
import qualified Stan.Category as Category | ||
|
||
|
||
-- | All performance 'Inspection's map from 'Id's. | ||
performanceInspectionsMap :: InspectionsMap | ||
performanceInspectionsMap = fromList $ fmapToFst inspectionId | ||
[ stan0401 | ||
] | ||
|
||
|
||
-- | 'Inspection' — @SPECIALIZE@ @STAN-0401@. | ||
stan0401 :: Inspection | ||
stan0401 = Inspection | ||
{ inspectionId = Id "STAN-0401" | ||
, inspectionName = "Performance: SPECIALIZE pragma" | ||
, inspectionDescription = "Use {-# SPECIALIZE #-} pragma to improve performance" | ||
, inspectionSolution = [] | ||
, inspectionCategory = Category.antiPattern :| [] | ||
, inspectionSeverity = Performance | ||
, inspectionAnalysis = SpecializePragma | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{-# OPTIONS_GHC -fno-warn-missing-export-lists #-} | ||
|
||
module Target.Performance where | ||
|
||
import Control.Monad.IO.Class (MonadIO) | ||
|
||
|
||
|
||
foo :: (MonadIO m, Functor m) => m () | ||
foo = undefined | ||
|
||
bar :: MonadIO m => Functor m => m () | ||
bar = undefined | ||
{-# SPECIALIZE bar :: IO () #-} |
Oops, something went wrong.