Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Przemyslaw Kaminski
haskell-gargantext
Commits
76beb064
Commit
76beb064
authored
Oct 12, 2020
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup noThunks on Env
parent
56f7eea3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
10 deletions
+52
-10
package.yaml
package.yaml
+1
-0
API.hs
src/Gargantext/API.hs
+2
-1
EnvTypes.hs
src/Gargantext/API/Admin/EnvTypes.hs
+14
-2
Types.hs
src/Gargantext/API/Admin/Types.hs
+15
-1
Types.hs
src/Gargantext/API/Ngrams/Types.hs
+12
-5
Server.hs
src/Gargantext/API/Server.hs
+4
-1
Config.hs
src/Gargantext/Prelude/Config.hs
+3
-0
stack.yaml
stack.yaml
+1
-0
No files found.
package.yaml
View file @
76beb064
...
@@ -175,6 +175,7 @@ library:
...
@@ -175,6 +175,7 @@ library:
-
monad-logger
-
monad-logger
-
mtl
-
mtl
-
natural-transformation
-
natural-transformation
-
nothunks
-
opaleye
-
opaleye
-
pandoc
-
pandoc
-
parallel
-
parallel
...
...
src/Gargantext/API.hs
View file @
76beb064
...
@@ -45,6 +45,7 @@ import Network.Wai
...
@@ -45,6 +45,7 @@ import Network.Wai
import
Network.Wai.Handler.Warp
hiding
(
defaultSettings
)
import
Network.Wai.Handler.Warp
hiding
(
defaultSettings
)
import
Network.Wai.Middleware.Cors
import
Network.Wai.Middleware.Cors
import
Network.Wai.Middleware.RequestLogger
import
Network.Wai.Middleware.RequestLogger
import
NoThunks.Class
(
NoThunks
)
import
Servant
import
Servant
import
System.IO
(
FilePath
)
import
System.IO
(
FilePath
)
import
Data.Text.IO
(
putStrLn
)
import
Data.Text.IO
(
putStrLn
)
...
@@ -193,7 +194,7 @@ serverGargAdminAPI = roots
...
@@ -193,7 +194,7 @@ serverGargAdminAPI = roots
--gargMock :: Server GargAPI
--gargMock :: Server GargAPI
--gargMock = mock apiGarg Proxy
--gargMock = mock apiGarg Proxy
---------------------------------------------------------------------
---------------------------------------------------------------------
makeApp
::
EnvC
env
=>
env
->
IO
Application
makeApp
::
(
NoThunks
env
,
EnvC
env
)
=>
env
->
IO
Application
makeApp
env
=
serveWithContext
api
cfg
<$>
server
env
makeApp
env
=
serveWithContext
api
cfg
<$>
server
env
where
where
cfg
::
Servant
.
Context
AuthContext
cfg
::
Servant
.
Context
AuthContext
...
...
src/Gargantext/API/Admin/EnvTypes.hs
View file @
76beb064
-- |
-- |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.API.Admin.EnvTypes
where
module
Gargantext.API.Admin.EnvTypes
where
...
@@ -10,10 +14,12 @@ import Database.PostgreSQL.Simple (Connection)
...
@@ -10,10 +14,12 @@ import Database.PostgreSQL.Simple (Connection)
import
GHC.Generics
(
Generic
)
import
GHC.Generics
(
Generic
)
import
Network.HTTP.Client
(
Manager
)
import
Network.HTTP.Client
(
Manager
)
import
Servant.Client
(
BaseUrl
)
import
Servant.Client
(
BaseUrl
)
import
Servant.Job.Async
(
HasJobEnv
(
..
),
Job
)
import
Servant.Job.Async
(
HasJobEnv
(
..
),
Job
,
JobEnv
)
import
System.Log.FastLogger
import
System.Log.FastLogger
import
qualified
Servant.Job.Core
import
qualified
Servant.Job.Core
import
NoThunks.Class
(
NoThunks
(
..
),
OnlyCheckWhnfNamed
(
..
))
import
Gargantext.API.Admin.Types
import
Gargantext.API.Admin.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Admin.Orchestrator.Types
import
Gargantext.API.Ngrams.Types
(
HasRepoVar
(
..
),
HasRepoSaver
(
..
),
HasRepo
(
..
),
RepoEnv
(
..
))
import
Gargantext.API.Ngrams.Types
(
HasRepoVar
(
..
),
HasRepoSaver
(
..
),
HasRepo
(
..
),
RepoEnv
(
..
))
...
@@ -60,6 +66,12 @@ instance Servant.Job.Core.HasEnv Env (Job JobLog JobLog) where
...
@@ -60,6 +66,12 @@ instance Servant.Job.Core.HasEnv Env (Job JobLog JobLog) where
instance
HasJobEnv
Env
JobLog
JobLog
where
instance
HasJobEnv
Env
JobLog
JobLog
where
job_env
=
env_scrapers
job_env
=
env_scrapers
deriving
via
OnlyCheckWhnfNamed
"LoggerSet"
LoggerSet
instance
NoThunks
LoggerSet
deriving
via
OnlyCheckWhnfNamed
"Manager"
Manager
instance
NoThunks
Manager
deriving
via
OnlyCheckWhnfNamed
"Pool"
(
Pool
a
)
instance
NoThunks
(
Pool
a
)
deriving
via
OnlyCheckWhnfNamed
"JobEnv"
(
JobEnv
a
b
)
instance
NoThunks
(
JobEnv
a
b
)
instance
NoThunks
Env
data
MockEnv
=
MockEnv
data
MockEnv
=
MockEnv
{
_menv_firewall
::
!
FireWall
{
_menv_firewall
::
!
FireWall
}
}
...
...
src/Gargantext/API/Admin/Types.hs
View file @
76beb064
-- |
-- |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.API.Admin.Types
where
module
Gargantext.API.Admin.Types
where
...
@@ -9,6 +13,7 @@ import Control.Monad.Logger
...
@@ -9,6 +13,7 @@ import Control.Monad.Logger
import
Data.ByteString
(
ByteString
)
import
Data.ByteString
(
ByteString
)
import
GHC.Enum
import
GHC.Enum
import
GHC.Generics
(
Generic
)
import
GHC.Generics
(
Generic
)
import
NoThunks.Class
(
NoThunks
(
..
),
OnlyCheckWhnfNamed
(
..
))
import
Servant.Auth.Server
(
JWTSettings
,
CookieSettings
(
..
))
import
Servant.Auth.Server
(
JWTSettings
,
CookieSettings
(
..
))
import
Servant.Client
(
BaseUrl
)
import
Servant.Client
(
BaseUrl
)
...
@@ -21,6 +26,8 @@ data SendEmailType = SendEmailViaAws
...
@@ -21,6 +26,8 @@ data SendEmailType = SendEmailViaAws
|
WriteEmailToFile
|
WriteEmailToFile
deriving
(
Show
,
Read
,
Enum
,
Bounded
,
Generic
)
deriving
(
Show
,
Read
,
Enum
,
Bounded
,
Generic
)
instance
NoThunks
SendEmailType
data
Settings
=
Settings
data
Settings
=
Settings
{
_allowedOrigin
::
!
ByteString
-- allowed origin for CORS
{
_allowedOrigin
::
!
ByteString
-- allowed origin for CORS
,
_allowedHost
::
!
ByteString
-- allowed host for CORS
,
_allowedHost
::
!
ByteString
-- allowed host for CORS
...
@@ -33,9 +40,16 @@ data Settings = Settings
...
@@ -33,9 +40,16 @@ data Settings = Settings
,
_sendLoginEmails
::
!
SendEmailType
,
_sendLoginEmails
::
!
SendEmailType
,
_scrapydUrl
::
!
BaseUrl
,
_scrapydUrl
::
!
BaseUrl
}
}
deriving
(
Generic
)
makeLenses
''
S
ettings
makeLenses
''
S
ettings
deriving
via
OnlyCheckWhnfNamed
"BaseUrl"
BaseUrl
instance
NoThunks
BaseUrl
deriving
via
OnlyCheckWhnfNamed
"CookieSettings"
CookieSettings
instance
NoThunks
CookieSettings
deriving
via
OnlyCheckWhnfNamed
"JWTSettings"
JWTSettings
instance
NoThunks
JWTSettings
deriving
via
OnlyCheckWhnfNamed
"LogLevel"
LogLevel
instance
NoThunks
LogLevel
instance
NoThunks
Settings
class
HasSettings
env
where
class
HasSettings
env
where
settings
::
Getter
env
Settings
settings
::
Getter
env
Settings
...
...
src/Gargantext/API/Ngrams/Types.hs
View file @
76beb064
-- |
-- |
{-# LANGUAGE ConstraintKinds #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE
TemplateHaskell
#-}
{-# LANGUAGE
StandaloneDeriving
#-}
{-# LANGUAGE T
ypeOperators
#-}
{-# LANGUAGE T
emplateHaskell
#-}
{-# LANGUAGE Type
Families
#-}
{-# LANGUAGE Type
Operators
#-}
{-#
OPTIONS -fno-warn-orphans
#-}
{-#
LANGUAGE TypeFamilies
#-}
module
Gargantext.API.Ngrams.Types
where
module
Gargantext.API.Ngrams.Types
where
...
@@ -26,6 +29,7 @@ import qualified Data.Map.Strict as Map
...
@@ -26,6 +29,7 @@ import qualified Data.Map.Strict as Map
import
qualified
Data.Map.Strict.Patch
as
PM
import
qualified
Data.Map.Strict.Patch
as
PM
import
Data.Maybe
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Monoid
import
Data.Monoid
import
NoThunks.Class
(
NoThunks
,
OnlyCheckWhnfNamed
(
..
))
import
Data.Patch.Class
(
Replace
,
replace
,
Action
(
act
),
Group
,
Applicable
(
..
),
Composable
(
..
),
Transformable
(
..
),
import
Data.Patch.Class
(
Replace
,
replace
,
Action
(
act
),
Group
,
Applicable
(
..
),
Composable
(
..
),
Transformable
(
..
),
PairPatch
(
..
),
Patched
,
ConflictResolution
,
ConflictResolutionReplace
,
PairPatch
(
..
),
Patched
,
ConflictResolution
,
ConflictResolutionReplace
,
MaybePatch
(
Mod
),
unMod
,
old
,
new
)
MaybePatch
(
Mod
),
unMod
,
old
,
new
)
...
@@ -683,6 +687,9 @@ data RepoEnv = RepoEnv
...
@@ -683,6 +687,9 @@ data RepoEnv = RepoEnv
makeLenses
''
R
epoEnv
makeLenses
''
R
epoEnv
-- All fields of RepoEnv are strict. MVar has no instance.
deriving
via
OnlyCheckWhnfNamed
"RepoEnv"
RepoEnv
instance
NoThunks
RepoEnv
class
HasRepoVar
env
where
class
HasRepoVar
env
where
repoVar
::
Getter
env
(
MVar
NgramsRepo
)
repoVar
::
Getter
env
(
MVar
NgramsRepo
)
...
...
src/Gargantext/API/Server.hs
View file @
76beb064
...
@@ -16,8 +16,10 @@ module Gargantext.API.Server where
...
@@ -16,8 +16,10 @@ module Gargantext.API.Server where
import
Control.Lens
((
^.
))
import
Control.Lens
((
^.
))
import
Control.Monad.Except
(
withExceptT
)
import
Control.Monad.Except
(
withExceptT
)
import
Control.Monad.Reader
(
runReaderT
)
import
Control.Monad.Reader
(
runReaderT
)
import
Data.Foldable
(
traverse_
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Data.Version
(
showVersion
)
import
Data.Version
(
showVersion
)
import
NoThunks.Class
(
NoThunks
(
..
))
import
Servant
import
Servant
import
Servant.Swagger.UI
(
swaggerSchemaUIServer
)
import
Servant.Swagger.UI
(
swaggerSchemaUIServer
)
import
qualified
Data.ByteString.Lazy.Char8
as
BL8
import
qualified
Data.ByteString.Lazy.Char8
as
BL8
...
@@ -49,8 +51,9 @@ serverGargAPI baseUrl -- orchestrator
...
@@ -49,8 +51,9 @@ serverGargAPI baseUrl -- orchestrator
gargVersion
=
pure
(
cs
$
showVersion
PG
.
version
)
gargVersion
=
pure
(
cs
$
showVersion
PG
.
version
)
-- | Server declarations
-- | Server declarations
server
::
forall
env
.
EnvC
env
=>
env
->
IO
(
Server
API
)
server
::
forall
env
.
(
NoThunks
env
,
EnvC
env
)
=>
env
->
IO
(
Server
API
)
server
env
=
do
server
env
=
do
traverse_
(
printDebug
"Unexpected thunks"
)
=<<
noThunks
[
"env"
]
env
-- orchestrator <- scrapyOrchestrator env
-- orchestrator <- scrapyOrchestrator env
pure
$
swaggerSchemaUIServer
swaggerDoc
pure
$
swaggerSchemaUIServer
swaggerDoc
:<|>
hoistServerWithContext
:<|>
hoistServerWithContext
...
...
src/Gargantext/Prelude/Config.hs
View file @
76beb064
...
@@ -21,6 +21,7 @@ import Gargantext.Prelude
...
@@ -21,6 +21,7 @@ import Gargantext.Prelude
import
Data.Text
(
Text
,
pack
)
import
Data.Text
(
Text
,
pack
)
import
GHC.Generics
(
Generic
)
import
GHC.Generics
(
Generic
)
import
Control.Lens
(
makeLenses
)
import
Control.Lens
(
makeLenses
)
import
NoThunks.Class
(
NoThunks
)
data
GargConfig
=
GargConfig
{
_gc_url
::
!
Text
data
GargConfig
=
GargConfig
{
_gc_url
::
!
Text
...
@@ -44,6 +45,8 @@ data GargConfig = GargConfig { _gc_url :: !Text
...
@@ -44,6 +45,8 @@ data GargConfig = GargConfig { _gc_url :: !Text
makeLenses
''
G
argConfig
makeLenses
''
G
argConfig
instance
NoThunks
GargConfig
readConfig
::
FilePath
->
IO
GargConfig
readConfig
::
FilePath
->
IO
GargConfig
readConfig
fp
=
do
readConfig
fp
=
do
ini
<-
readIniFile
fp
ini
<-
readIniFile
fp
...
...
stack.yaml
View file @
76beb064
...
@@ -84,3 +84,4 @@ extra-deps:
...
@@ -84,3 +84,4 @@ extra-deps:
-
dependent-sum-0.4@sha256:40c705604f52374fb72616e10234635104a626ede737ddde899777b719df120b,1907
-
dependent-sum-0.4@sha256:40c705604f52374fb72616e10234635104a626ede737ddde899777b719df120b,1907
-
xmlbf-xeno-0.2@sha256:39f70fced6052524c290cf595f114661c721452e65fc3e0953a44e7682a6a6b0,950
-
xmlbf-xeno-0.2@sha256:39f70fced6052524c290cf595f114661c721452e65fc3e0953a44e7682a6a6b0,950
-
nothunks-0.1.1.0
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment