1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-22 20:31:31 +03:00

Add an 'Imports' module

Now common imports are all available from one module (which should be
reimported in all other modules). `LANGUAGE NoImplicitPrelude` is a default
extension now and so it's not needed either.
This commit is contained in:
Artyom 2017-01-23 13:14:23 +03:00
parent 1667d2162b
commit 2772834c12
No known key found for this signature in database
GPG Key ID: B8E35A33FF522710
11 changed files with 70 additions and 85 deletions

View File

@ -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

View File

@ -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 #-}

View File

@ -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

View File

@ -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

40
lib/Imports.hs Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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