Skip to content

Commit

Permalink
Strictness improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Jan 4, 2021
1 parent d9bd3b4 commit 8431564
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions IHP/ApplicationContext.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import IHP.FrameworkConfig (FrameworkConfig)

data ApplicationContext = ApplicationContext
{ modelContext :: !ModelContext
, session :: Vault.Key (Session IO String String)
, autoRefreshServer :: IORef AutoRefreshServer
, frameworkConfig :: FrameworkConfig
, session :: !(Vault.Key (Session IO String String))
, autoRefreshServer :: !(IORef AutoRefreshServer)
, frameworkConfig :: !FrameworkConfig
}
16 changes: 8 additions & 8 deletions IHP/AutoRefresh/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ import IHP.Controller.RequestContext
import Control.Concurrent.MVar (MVar)
import Data.Set (Set)

data AutoRefreshState = AutoRefreshDisabled | AutoRefreshEnabled { sessionId :: UUID }
data AutoRefreshState = AutoRefreshDisabled | AutoRefreshEnabled { sessionId :: !UUID }
data AutoRefreshSession = AutoRefreshSession
{ id :: UUID
{ id :: !UUID
-- | A callback to rerun an action within a given request context
, renderView :: RequestContext -> IO ()
, renderView :: !(RequestContext -> IO ())
-- | MVar that is filled whenever some table changed
, event :: MVar ()
, event :: !(MVar ())
-- | All tables this auto refresh session watches
, tables :: Set ByteString
, tables :: !(Set ByteString)
-- | The last rendered html of this action. Initially this is the result of the initial page rendering
, lastResponse :: LByteString
, lastResponse :: !LByteString
-- | Keep track of the last ping to this session to close it after too much time has passed without anything happening
, lastPing :: UTCTime
, lastPing :: !UTCTime
}

data AutoRefreshServer = AutoRefreshServer { sessions :: [AutoRefreshSession], subscribedTables :: Set ByteString }
data AutoRefreshServer = AutoRefreshServer { sessions :: ![AutoRefreshSession], subscribedTables :: !(Set ByteString) }

newAutoRefreshServer :: AutoRefreshServer
newAutoRefreshServer = AutoRefreshServer { sessions = [], subscribedTables = mempty }
4 changes: 2 additions & 2 deletions IHP/FlashMessages/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ module IHP.FlashMessages.Types
import IHP.Prelude

data FlashMessage
= SuccessFlashMessage Text
| ErrorFlashMessage Text
= SuccessFlashMessage !Text
| ErrorFlashMessage !Text
6 changes: 3 additions & 3 deletions IHP/Router/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import IHP.Prelude
-- When opening @/ShowProject?projectId=ab55d579-80cd-4608-9a8f-c76dea6c2332@ everything is fine.
-- But when opening @/ShowProject?projectId=not-an-uuid@ this exception will be thrown.
data InvalidActionArgumentException = InvalidActionArgumentException
{ expectedType :: ByteString
, value :: ByteString
, field :: ByteString
{ expectedType :: !ByteString
, value :: !ByteString
, field :: !ByteString
} deriving (Eq, Show)

instance Exception InvalidActionArgumentException

0 comments on commit 8431564

Please sign in to comment.