mirror of
https://github.com/aelve/guide.git
synced 2024-12-23 04:42:24 +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:
parent
1667d2162b
commit
2772834c12
@ -54,6 +54,8 @@ library
|
|||||||
JS
|
JS
|
||||||
View
|
View
|
||||||
SafeCopy
|
SafeCopy
|
||||||
|
other-modules:
|
||||||
|
Imports
|
||||||
build-depends: Spock
|
build-depends: Spock
|
||||||
, Spock-lucid == 0.3.*
|
, Spock-lucid == 0.3.*
|
||||||
, acid-state == 0.14.*
|
, acid-state == 0.14.*
|
||||||
@ -129,6 +131,7 @@ library
|
|||||||
, DeriveFunctor
|
, DeriveFunctor
|
||||||
, DeriveTraversable
|
, DeriveTraversable
|
||||||
, DeriveGeneric
|
, DeriveGeneric
|
||||||
|
, NoImplicitPrelude
|
||||||
|
|
||||||
test-suite tests
|
test-suite tests
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
|
17
lib/Cache.hs
17
lib/Cache.hs
@ -1,8 +1,3 @@
|
|||||||
{-# LANGUAGE
|
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
|
||||||
|
|
||||||
|
|
||||||
module Cache
|
module Cache
|
||||||
(
|
(
|
||||||
CacheKey(..),
|
CacheKey(..),
|
||||||
@ -13,17 +8,11 @@ module Cache
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude hiding (Category)
|
import Imports
|
||||||
-- Lenses
|
|
||||||
import Lens.Micro.Platform hiding ((&))
|
|
||||||
-- Monads and monad transformers
|
|
||||||
import Control.Monad.IO.Class
|
|
||||||
-- ByteString
|
|
||||||
import qualified Data.ByteString.Lazy as BSL
|
|
||||||
-- Concurrent map
|
-- Concurrent map
|
||||||
import qualified STMContainers.Map as STMMap
|
import qualified STMContainers.Map as STMMap
|
||||||
import qualified Focus
|
import qualified Focus
|
||||||
import Data.Hashable
|
|
||||||
-- Lucid
|
-- Lucid
|
||||||
import Lucid.Base
|
import Lucid.Base
|
||||||
|
|
||||||
@ -34,7 +23,7 @@ import Utils
|
|||||||
|
|
||||||
-- Left = someone started rendering but haven't finished yet
|
-- Left = someone started rendering but haven't finished yet
|
||||||
-- Right = result of the render
|
-- Right = result of the render
|
||||||
type Cache = STMMap.Map CacheKey (Either Unique BSL.ByteString)
|
type Cache = STMMap.Map CacheKey (Either Unique LByteString)
|
||||||
|
|
||||||
cache :: Cache
|
cache :: Cache
|
||||||
{-# NOINLINE cache #-}
|
{-# NOINLINE cache #-}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{-# LANGUAGE
|
{-# LANGUAGE
|
||||||
OverloadedStrings,
|
OverloadedStrings
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -14,17 +13,14 @@ module Config
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude
|
import Imports hiding ((.=))
|
||||||
-- Text
|
|
||||||
import Data.Text.All (Text)
|
|
||||||
-- JSON
|
-- JSON
|
||||||
import Data.Aeson as Aeson
|
import Data.Aeson as Aeson
|
||||||
import Data.Aeson.Encode.Pretty as Aeson hiding (Config)
|
import Data.Aeson.Encode.Pretty as Aeson hiding (Config)
|
||||||
-- ByteString
|
-- ByteString
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.ByteString.Lazy as BSL
|
import qualified Data.ByteString.Lazy as BSL
|
||||||
-- Files
|
|
||||||
import System.Directory
|
|
||||||
-- Default
|
-- Default
|
||||||
import Data.Default
|
import Data.Default
|
||||||
|
|
||||||
|
15
lib/Guide.hs
15
lib/Guide.hs
@ -3,8 +3,7 @@ OverloadedStrings,
|
|||||||
ScopedTypeVariables,
|
ScopedTypeVariables,
|
||||||
TypeFamilies,
|
TypeFamilies,
|
||||||
DataKinds,
|
DataKinds,
|
||||||
FlexibleContexts,
|
FlexibleContexts
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -16,21 +15,15 @@ module Guide
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude hiding (Category)
|
import Imports
|
||||||
|
|
||||||
-- Monads and monad transformers
|
-- Monads and monad transformers
|
||||||
import Control.Monad.State
|
|
||||||
import Control.Monad.Reader
|
|
||||||
import Control.Monad.Morph
|
import Control.Monad.Morph
|
||||||
-- Lenses
|
|
||||||
import Lens.Micro.Platform hiding ((&))
|
|
||||||
-- Containers
|
-- Containers
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
-- Text
|
-- Text
|
||||||
import Data.Text.All (Text)
|
|
||||||
import qualified Data.Text.All as T
|
import qualified Data.Text.All as T
|
||||||
import qualified Data.Text.Lazy.All as TL
|
import qualified Data.Text.Lazy.All as TL
|
||||||
-- Paths
|
|
||||||
import System.FilePath ((</>))
|
|
||||||
-- Network
|
-- Network
|
||||||
import Data.IP (IP)
|
import Data.IP (IP)
|
||||||
-- Web
|
-- Web
|
||||||
@ -57,8 +50,6 @@ import qualified System.Metrics.Gauge as EKG.Gauge
|
|||||||
import Data.Acid as Acid
|
import Data.Acid as Acid
|
||||||
-- Time
|
-- Time
|
||||||
import Data.Time
|
import Data.Time
|
||||||
-- Deepseq
|
|
||||||
import Control.DeepSeq
|
|
||||||
-- IO
|
-- IO
|
||||||
import System.IO
|
import System.IO
|
||||||
import qualified SlaveThread as Slave
|
import qualified SlaveThread as Slave
|
||||||
|
40
lib/Imports.hs
Normal file
40
lib/Imports.hs
Normal 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
|
@ -3,8 +3,7 @@ FlexibleInstances,
|
|||||||
GeneralizedNewtypeDeriving,
|
GeneralizedNewtypeDeriving,
|
||||||
OverloadedStrings,
|
OverloadedStrings,
|
||||||
QuasiQuotes,
|
QuasiQuotes,
|
||||||
BangPatterns,
|
BangPatterns
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -14,10 +13,10 @@ NoImplicitPrelude
|
|||||||
module JS where
|
module JS where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude
|
import Imports
|
||||||
|
|
||||||
-- Text
|
-- Text
|
||||||
import qualified Data.Text.All as T
|
import qualified Data.Text.All as T
|
||||||
import Data.Text.All (Text)
|
|
||||||
-- Interpolation
|
-- Interpolation
|
||||||
import NeatInterpolation
|
import NeatInterpolation
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
{-# LANGUAGE
|
{-# LANGUAGE
|
||||||
OverloadedStrings,
|
OverloadedStrings,
|
||||||
FlexibleInstances,
|
FlexibleInstances,
|
||||||
FlexibleContexts,
|
FlexibleContexts
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -33,18 +32,13 @@ module Markdown
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude hiding (Space)
|
import Imports
|
||||||
-- Lenses
|
|
||||||
import Lens.Micro.Platform hiding ((&))
|
|
||||||
-- Monad transformers and monads
|
|
||||||
import Control.Monad.State
|
|
||||||
-- Text
|
-- Text
|
||||||
import qualified Data.Text.All as T
|
import qualified Data.Text.All as T
|
||||||
import Data.Text.All (Text)
|
|
||||||
-- ByteString
|
-- ByteString
|
||||||
import qualified Data.ByteString.Lazy as BSL
|
import qualified Data.ByteString.Lazy as BSL
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import Data.ByteString (ByteString)
|
|
||||||
-- Parsing
|
-- Parsing
|
||||||
import Text.Megaparsec hiding (State)
|
import Text.Megaparsec hiding (State)
|
||||||
import Text.Megaparsec.Text
|
import Text.Megaparsec.Text
|
||||||
@ -56,7 +50,6 @@ import Text.HTML.SanitizeXSS
|
|||||||
-- Containers
|
-- Containers
|
||||||
import Data.Tree
|
import Data.Tree
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import Data.Set (Set)
|
|
||||||
-- Markdown
|
-- Markdown
|
||||||
import CMark hiding (Node)
|
import CMark hiding (Node)
|
||||||
import qualified CMark as MD
|
import qualified CMark as MD
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{-# LANGUAGE
|
{-# LANGUAGE
|
||||||
OverloadedStrings,
|
OverloadedStrings
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -11,12 +10,10 @@ module Merge
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude
|
import Imports
|
||||||
-- Lenses
|
|
||||||
import Lens.Micro.Platform hiding ((&))
|
|
||||||
-- Text
|
-- Text
|
||||||
import qualified Data.Text.All as T
|
import qualified Data.Text.All as T
|
||||||
import Data.Text.All (Text)
|
|
||||||
import Data.List.Split
|
import Data.List.Split
|
||||||
-- Vector
|
-- Vector
|
||||||
import qualified Data.Vector as V
|
import qualified Data.Vector as V
|
||||||
|
15
lib/Types.hs
15
lib/Types.hs
@ -3,8 +3,7 @@ QuasiQuotes,
|
|||||||
FlexibleContexts,
|
FlexibleContexts,
|
||||||
FlexibleInstances,
|
FlexibleInstances,
|
||||||
TypeFamilies,
|
TypeFamilies,
|
||||||
OverloadedStrings,
|
OverloadedStrings
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -126,20 +125,12 @@ module Types
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude hiding (Category)
|
import Imports
|
||||||
-- Monads and monad transformers
|
|
||||||
import Control.Monad.State
|
|
||||||
import Control.Monad.Reader
|
|
||||||
-- Lenses
|
|
||||||
import Lens.Micro.Platform hiding ((&))
|
|
||||||
-- Containers
|
-- Containers
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Map (Map)
|
|
||||||
-- Lists
|
|
||||||
import Data.List.Index
|
|
||||||
-- Text
|
-- Text
|
||||||
import qualified Data.Text.All as T
|
import qualified Data.Text.All as T
|
||||||
import Data.Text.All (Text)
|
|
||||||
-- JSON
|
-- JSON
|
||||||
import qualified Data.Aeson as A
|
import qualified Data.Aeson as A
|
||||||
import qualified Data.Aeson.Types as A
|
import qualified Data.Aeson.Types as A
|
||||||
|
13
lib/Utils.hs
13
lib/Utils.hs
@ -5,8 +5,7 @@ OverloadedStrings,
|
|||||||
GeneralizedNewtypeDeriving,
|
GeneralizedNewtypeDeriving,
|
||||||
FlexibleContexts,
|
FlexibleContexts,
|
||||||
FlexibleInstances,
|
FlexibleInstances,
|
||||||
TypeFamilies,
|
TypeFamilies
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -67,26 +66,20 @@ module Utils
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude
|
import Imports
|
||||||
|
|
||||||
-- Lists
|
-- Lists
|
||||||
import Data.List.Extra (stripSuffix)
|
import Data.List.Extra (stripSuffix)
|
||||||
-- Monads
|
-- Monads
|
||||||
import Control.Monad.Extra
|
import Control.Monad.Extra
|
||||||
-- Lenses
|
|
||||||
import Lens.Micro.Platform hiding ((&))
|
|
||||||
-- Monads and monad transformers
|
-- Monads and monad transformers
|
||||||
import Control.Monad.Trans
|
|
||||||
import Control.Monad.Catch
|
import Control.Monad.Catch
|
||||||
-- Containers
|
-- Containers
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Data.Map (Map)
|
|
||||||
-- Hashable (needed for Uid)
|
|
||||||
import Data.Hashable
|
|
||||||
-- Randomness
|
-- Randomness
|
||||||
import System.Random
|
import System.Random
|
||||||
-- Text
|
-- Text
|
||||||
import Data.Text.All (Text)
|
|
||||||
import qualified Data.Text.All as T
|
import qualified Data.Text.All as T
|
||||||
-- JSON
|
-- JSON
|
||||||
import qualified Data.Aeson as A
|
import qualified Data.Aeson as A
|
||||||
|
13
lib/View.hs
13
lib/View.hs
@ -1,8 +1,7 @@
|
|||||||
{-# LANGUAGE
|
{-# LANGUAGE
|
||||||
QuasiQuotes,
|
QuasiQuotes,
|
||||||
OverloadedStrings,
|
OverloadedStrings,
|
||||||
FlexibleContexts,
|
FlexibleContexts
|
||||||
NoImplicitPrelude
|
|
||||||
#-}
|
#-}
|
||||||
|
|
||||||
|
|
||||||
@ -46,12 +45,8 @@ module View
|
|||||||
where
|
where
|
||||||
|
|
||||||
|
|
||||||
import BasePrelude hiding (Category)
|
import Imports
|
||||||
-- Lenses
|
|
||||||
import Lens.Micro.Platform hiding ((&))
|
|
||||||
-- Monads and monad transformers
|
|
||||||
import Control.Monad.IO.Class
|
|
||||||
import Control.Monad.Reader
|
|
||||||
-- Lists
|
-- Lists
|
||||||
import Data.List.Split
|
import Data.List.Split
|
||||||
-- Containers
|
-- Containers
|
||||||
@ -60,12 +55,10 @@ import Data.Tree
|
|||||||
-- Text
|
-- Text
|
||||||
import qualified Data.Text.All as T
|
import qualified Data.Text.All as T
|
||||||
import qualified Data.Text.Lazy.All as TL
|
import qualified Data.Text.Lazy.All as TL
|
||||||
import Data.Text.All (Text)
|
|
||||||
import NeatInterpolation
|
import NeatInterpolation
|
||||||
-- Web
|
-- Web
|
||||||
import Lucid hiding (for_)
|
import Lucid hiding (for_)
|
||||||
-- Files
|
-- Files
|
||||||
import System.FilePath
|
|
||||||
import qualified System.FilePath.Find as F
|
import qualified System.FilePath.Find as F
|
||||||
-- Network
|
-- Network
|
||||||
import Data.IP
|
import Data.IP
|
||||||
|
Loading…
Reference in New Issue
Block a user