Skip to content

Commit

Permalink
removed unused importsd
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Mar 15, 2024
1 parent ffbb5c6 commit e87c0a3
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 20 deletions.
1 change: 0 additions & 1 deletion IHP/ApplicationContext.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module IHP.ApplicationContext where

import IHP.Prelude
import Network.Wai.Session (Session)
import IHP.AutoRefresh.Types (AutoRefreshServer)
import IHP.FrameworkConfig (FrameworkConfig)
import IHP.PGListener (PGListener)
Expand Down
2 changes: 0 additions & 2 deletions IHP/Controller/RequestContext.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import ClassyPrelude
import qualified Data.ByteString.Lazy as LBS
import Network.Wai (Request, Response, ResponseReceived)
import Network.Wai.Parse (File, Param)
import qualified Data.Vault.Lazy as Vault
import Network.Wai.Session (Session)
import IHP.FrameworkConfig
import qualified Data.Aeson as Aeson

Expand Down
5 changes: 2 additions & 3 deletions IHP/Controller/Response.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ where
import ClassyPrelude
import Network.HTTP.Types.Header
import qualified IHP.Controller.Context as Context
import IHP.Controller.Context (ControllerContext(ControllerContext))
import qualified Network.Wai
import Network.Wai (Response)
import qualified Control.Exception as Exception

respondAndExit :: (?context::ControllerContext) => Response -> IO ()
respondAndExit :: (?context :: Context.ControllerContext) => Response -> IO ()
respondAndExit response = do
responseWithHeaders <- addResponseHeadersFromContext response
Exception.throwIO (ResponseException responseWithHeaders)
Expand All @@ -35,7 +34,7 @@ addResponseHeaders headers = Network.Wai.mapResponseHeaders (\hs -> headers <> h
-- > addResponseHeadersFromContext response
-- You probabaly want `setHeader`
--
addResponseHeadersFromContext :: (?context :: ControllerContext) => Response -> IO Response
addResponseHeadersFromContext :: (?context :: Context.ControllerContext) => Response -> IO Response
addResponseHeadersFromContext response = do
maybeHeaders <- Context.maybeFromContext @[Header]
let headers = fromMaybe [] maybeHeaders
Expand Down
3 changes: 1 addition & 2 deletions IHP/ControllerSupport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module IHP.ControllerSupport

import ClassyPrelude
import IHP.HaskellSupport
import Network.Wai (Response, Request, ResponseReceived, responseLBS, requestHeaders)
import Network.Wai (Request, ResponseReceived, responseLBS, requestHeaders)
import qualified Network.HTTP.Types as HTTP
import qualified Network.Wai
import IHP.ModelSupport
Expand All @@ -39,7 +39,6 @@ import qualified Data.ByteString.Lazy
import qualified IHP.Controller.RequestContext as RequestContext
import IHP.Controller.RequestContext (RequestContext, Respond)
import qualified Data.CaseInsensitive
import qualified Control.Exception as Exception
import qualified IHP.ErrorController as ErrorController
import qualified Data.Typeable as Typeable
import IHP.FrameworkConfig (FrameworkConfig (..), ConfigProvider(..))
Expand Down
1 change: 0 additions & 1 deletion IHP/EnvVar.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import IHP.Prelude
import Data.String.Interpolate.IsString (i)
import qualified System.Posix.Env.ByteString as Posix
import Network.Socket (PortNumber)
import Data.Word (Word16)
import IHP.Mail.Types
import IHP.Environment

Expand Down
1 change: 0 additions & 1 deletion IHP/IDE/FileWatcher.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import System.Directory (listDirectory, doesDirectoryExist)
import qualified Data.Map as Map
import qualified System.FSNotify as FS
import IHP.IDE.Types
import qualified Data.Time.Clock as Clock
import qualified Data.List as List
import IHP.IDE.LiveReloadNotificationServer (notifyAssetChange)
import qualified Control.Debounce as Debounce
Expand Down
8 changes: 3 additions & 5 deletions IHP/IDE/ToolServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import qualified Network.Wai.Handler.Warp as Warp
import IHP.IDE.Types
import IHP.IDE.PortConfig
import qualified IHP.ControllerSupport as ControllerSupport
import qualified IHP.ErrorController as ErrorController
import IHP.ApplicationContext
import IHP.ModelSupport
import IHP.RouterSupport hiding (get)
import Network.Wai.Session.ClientSession (clientsessionStore)
import qualified Web.ClientSession as ClientSession
import qualified Data.Vault.Lazy as Vault
import Network.Wai.Middleware.MethodOverridePost (methodOverridePost)
import Network.Wai.Session (withSession)
import qualified Network.WebSockets as Websocket
Expand Down Expand Up @@ -49,6 +47,7 @@ import qualified IHP.PGListener as PGListener
import qualified Network.Wai.Application.Static as Static
import qualified WaiAppStatic.Types as Static
import IHP.Controller.NotFound (handleNotFound)
import IHP.Controller.Session (sessionVaultKey)

withToolServer :: (?context :: Context) => IO () -> IO ()
withToolServer inner = withAsyncBound async (\_ -> inner)
Expand All @@ -72,15 +71,14 @@ startToolServer' port isDebugMode = do
Just baseUrl -> Config.option $ Config.BaseUrl baseUrl
Nothing -> pure ()

session <- Vault.newKey
store <- fmap clientsessionStore (ClientSession.getKey "Config/client_session_key.aes")
let sessionMiddleware :: Wai.Middleware = withSession store "SESSION" (frameworkConfig.sessionCookie) session
let sessionMiddleware :: Wai.Middleware = withSession store "SESSION" (frameworkConfig.sessionCookie) sessionVaultKey
let modelContext = notConnectedModelContext undefined
pgListener <- PGListener.init modelContext
autoRefreshServer <- newIORef (AutoRefresh.newAutoRefreshServer pgListener)
staticApp <- initStaticApp

let applicationContext = ApplicationContext { modelContext, session, autoRefreshServer, frameworkConfig, pgListener }
let applicationContext = ApplicationContext { modelContext, autoRefreshServer, frameworkConfig, pgListener }
let toolServerApplication = ToolServerApplication { devServerContext = ?context }
let application :: Wai.Application = \request respond -> do
let ?applicationContext = applicationContext
Expand Down
7 changes: 2 additions & 5 deletions IHP/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ import IHP.Prelude
import qualified Network.Wai.Handler.Warp as Warp
import Network.Wai
import Network.Wai.Middleware.MethodOverridePost (methodOverridePost)
import Network.Wai.Session (withSession, Session)
import Network.Wai.Session (withSession)
import Network.Wai.Session.ClientSession (clientsessionStore)
import qualified Web.ClientSession as ClientSession
import IHP.Controller.Session (sessionVaultKey)
import qualified Data.Vault.Lazy as Vault
import IHP.ApplicationContext
import qualified IHP.ControllerSupport as ControllerSupport
import qualified IHP.Environment as Env
import qualified IHP.PGListener as PGListener

import IHP.FrameworkConfig
import IHP.RouterSupport (frontControllerToWAIApp, FrontController, webSocketApp, webSocketAppWithCustomPath)
import IHP.ErrorController
import IHP.RouterSupport (frontControllerToWAIApp, FrontController)
import qualified IHP.AutoRefresh as AutoRefresh
import qualified IHP.AutoRefresh.Types as AutoRefresh
import IHP.LibDir
Expand Down

0 comments on commit e87c0a3

Please sign in to comment.