diff --git a/guide.cabal b/guide.cabal index 17a5958..23a241e 100644 --- a/guide.cabal +++ b/guide.cabal @@ -54,6 +54,8 @@ library JS View SafeCopy + other-modules: + Imports build-depends: Spock , Spock-lucid == 0.3.* , acid-state == 0.14.* @@ -129,6 +131,7 @@ library , DeriveFunctor , DeriveTraversable , DeriveGeneric + , NoImplicitPrelude test-suite tests main-is: Main.hs diff --git a/lib/Cache.hs b/lib/Cache.hs index 45bb522..5c4ea8f 100644 --- a/lib/Cache.hs +++ b/lib/Cache.hs @@ -1,8 +1,3 @@ -{-# LANGUAGE -NoImplicitPrelude - #-} - - module Cache ( CacheKey(..), @@ -13,17 +8,11 @@ module Cache where -import BasePrelude hiding (Category) --- Lenses -import Lens.Micro.Platform hiding ((&)) --- Monads and monad transformers -import Control.Monad.IO.Class --- ByteString -import qualified Data.ByteString.Lazy as BSL +import Imports + -- Concurrent map import qualified STMContainers.Map as STMMap import qualified Focus -import Data.Hashable -- Lucid import Lucid.Base @@ -34,7 +23,7 @@ import Utils -- Left = someone started rendering but haven't finished yet -- Right = result of the render -type Cache = STMMap.Map CacheKey (Either Unique BSL.ByteString) +type Cache = STMMap.Map CacheKey (Either Unique LByteString) cache :: Cache {-# NOINLINE cache #-} diff --git a/lib/Config.hs b/lib/Config.hs index 89c2d8b..51a5ff0 100644 --- a/lib/Config.hs +++ b/lib/Config.hs @@ -1,6 +1,5 @@ {-# LANGUAGE -OverloadedStrings, -NoImplicitPrelude +OverloadedStrings #-} @@ -14,17 +13,14 @@ module Config where -import BasePrelude --- Text -import Data.Text.All (Text) +import Imports hiding ((.=)) + -- JSON import Data.Aeson as Aeson import Data.Aeson.Encode.Pretty as Aeson hiding (Config) -- ByteString import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL --- Files -import System.Directory -- Default import Data.Default diff --git a/lib/Guide.hs b/lib/Guide.hs index bf7f6ee..70d177c 100644 --- a/lib/Guide.hs +++ b/lib/Guide.hs @@ -3,8 +3,7 @@ OverloadedStrings, ScopedTypeVariables, TypeFamilies, DataKinds, -FlexibleContexts, -NoImplicitPrelude +FlexibleContexts #-} @@ -16,21 +15,15 @@ module Guide where -import BasePrelude hiding (Category) +import Imports + -- Monads and monad transformers -import Control.Monad.State -import Control.Monad.Reader import Control.Monad.Morph --- Lenses -import Lens.Micro.Platform hiding ((&)) -- Containers import qualified Data.Map as M -- Text -import Data.Text.All (Text) import qualified Data.Text.All as T import qualified Data.Text.Lazy.All as TL --- Paths -import System.FilePath (()) -- Network import Data.IP (IP) -- Web @@ -57,8 +50,6 @@ import qualified System.Metrics.Gauge as EKG.Gauge import Data.Acid as Acid -- Time import Data.Time --- Deepseq -import Control.DeepSeq -- IO import System.IO import qualified SlaveThread as Slave diff --git a/lib/Imports.hs b/lib/Imports.hs new file mode 100644 index 0000000..1b66e0c --- /dev/null +++ b/lib/Imports.hs @@ -0,0 +1,40 @@ +{-# LANGUAGE +NoImplicitPrelude + #-} + + +-- | Imports used in the whole codebase. +module Imports +( + module X, + LByteString +) +where + + +import BasePrelude as X hiding (Category, GeneralCategory, lazy) +-- Lists +import Data.List.Index as X +-- Lenses +import Lens.Micro.Platform as X hiding ((&)) +-- Monads and monad transformers +import Control.Monad.IO.Class as X +import Control.Monad.State as X +import Control.Monad.Reader as X +-- Common types +import Data.Text.All as X (Text, LText) +import Data.ByteString as X (ByteString) +import Data.Map as X (Map) +import Data.Set as X (Set) +-- Files +import System.Directory as X +import System.FilePath as X +-- Deepseq +import Control.DeepSeq as X +-- Hashable +import Data.Hashable as X +-- Lazy bytestring +import qualified Data.ByteString.Lazy as BSL + + +type LByteString = BSL.ByteString diff --git a/lib/JS.hs b/lib/JS.hs index 874c3bc..2e92f39 100644 --- a/lib/JS.hs +++ b/lib/JS.hs @@ -3,8 +3,7 @@ FlexibleInstances, GeneralizedNewtypeDeriving, OverloadedStrings, QuasiQuotes, -BangPatterns, -NoImplicitPrelude +BangPatterns #-} @@ -14,10 +13,10 @@ NoImplicitPrelude module JS where -import BasePrelude +import Imports + -- Text import qualified Data.Text.All as T -import Data.Text.All (Text) -- Interpolation import NeatInterpolation diff --git a/lib/Markdown.hs b/lib/Markdown.hs index 62f508d..44396f2 100644 --- a/lib/Markdown.hs +++ b/lib/Markdown.hs @@ -1,8 +1,7 @@ {-# LANGUAGE OverloadedStrings, FlexibleInstances, -FlexibleContexts, -NoImplicitPrelude +FlexibleContexts #-} @@ -33,18 +32,13 @@ module Markdown where -import BasePrelude hiding (Space) --- Lenses -import Lens.Micro.Platform hiding ((&)) --- Monad transformers and monads -import Control.Monad.State +import Imports + -- Text import qualified Data.Text.All as T -import Data.Text.All (Text) -- ByteString import qualified Data.ByteString.Lazy as BSL import qualified Data.ByteString as BS -import Data.ByteString (ByteString) -- Parsing import Text.Megaparsec hiding (State) import Text.Megaparsec.Text @@ -56,7 +50,6 @@ import Text.HTML.SanitizeXSS -- Containers import Data.Tree import qualified Data.Set as S -import Data.Set (Set) -- Markdown import CMark hiding (Node) import qualified CMark as MD diff --git a/lib/Merge.hs b/lib/Merge.hs index e6931cd..8a6b879 100644 --- a/lib/Merge.hs +++ b/lib/Merge.hs @@ -1,6 +1,5 @@ {-# LANGUAGE -OverloadedStrings, -NoImplicitPrelude +OverloadedStrings #-} @@ -11,12 +10,10 @@ module Merge where -import BasePrelude --- Lenses -import Lens.Micro.Platform hiding ((&)) +import Imports + -- Text import qualified Data.Text.All as T -import Data.Text.All (Text) import Data.List.Split -- Vector import qualified Data.Vector as V diff --git a/lib/Types.hs b/lib/Types.hs index be39574..7317026 100644 --- a/lib/Types.hs +++ b/lib/Types.hs @@ -3,8 +3,7 @@ QuasiQuotes, FlexibleContexts, FlexibleInstances, TypeFamilies, -OverloadedStrings, -NoImplicitPrelude +OverloadedStrings #-} @@ -126,20 +125,12 @@ module Types where -import BasePrelude hiding (Category) --- Monads and monad transformers -import Control.Monad.State -import Control.Monad.Reader --- Lenses -import Lens.Micro.Platform hiding ((&)) +import Imports + -- Containers import qualified Data.Map as M -import Data.Map (Map) --- Lists -import Data.List.Index -- Text import qualified Data.Text.All as T -import Data.Text.All (Text) -- JSON import qualified Data.Aeson as A import qualified Data.Aeson.Types as A diff --git a/lib/Utils.hs b/lib/Utils.hs index 014a9ea..8d9f03b 100644 --- a/lib/Utils.hs +++ b/lib/Utils.hs @@ -5,8 +5,7 @@ OverloadedStrings, GeneralizedNewtypeDeriving, FlexibleContexts, FlexibleInstances, -TypeFamilies, -NoImplicitPrelude +TypeFamilies #-} @@ -67,26 +66,20 @@ module Utils where -import BasePrelude +import Imports + -- Lists import Data.List.Extra (stripSuffix) -- Monads import Control.Monad.Extra --- Lenses -import Lens.Micro.Platform hiding ((&)) -- Monads and monad transformers -import Control.Monad.Trans import Control.Monad.Catch -- Containers import qualified Data.Set as S import qualified Data.Map as M -import Data.Map (Map) --- Hashable (needed for Uid) -import Data.Hashable -- Randomness import System.Random -- Text -import Data.Text.All (Text) import qualified Data.Text.All as T -- JSON import qualified Data.Aeson as A diff --git a/lib/View.hs b/lib/View.hs index b1dd793..aff08fb 100644 --- a/lib/View.hs +++ b/lib/View.hs @@ -1,8 +1,7 @@ {-# LANGUAGE QuasiQuotes, OverloadedStrings, -FlexibleContexts, -NoImplicitPrelude +FlexibleContexts #-} @@ -46,12 +45,8 @@ module View where -import BasePrelude hiding (Category) --- Lenses -import Lens.Micro.Platform hiding ((&)) --- Monads and monad transformers -import Control.Monad.IO.Class -import Control.Monad.Reader +import Imports + -- Lists import Data.List.Split -- Containers @@ -60,12 +55,10 @@ import Data.Tree -- Text import qualified Data.Text.All as T import qualified Data.Text.Lazy.All as TL -import Data.Text.All (Text) import NeatInterpolation -- Web import Lucid hiding (for_) -- Files -import System.FilePath import qualified System.FilePath.Find as F -- Network import Data.IP