module IHP.LoginSupport.Helper.View
( currentUser
, currentUserOrNothing
)
where

import IHP.Prelude
import IHP.Controller.Context
import IHP.LoginSupport.Helper.Controller (CurrentUserRecord)

currentUser :: (?context :: ControllerContext, user ~ CurrentUserRecord, Typeable user) => user
currentUser :: user
currentUser = user -> Maybe user -> user
forall a. a -> Maybe a -> a
fromMaybe (Text -> user
forall a. Text -> a
error Text
"Application.Helper.View.currentUser: Not logged in") Maybe user
forall user.
(?context::ControllerContext, user ~ CurrentUserRecord,
 Typeable user) =>
Maybe user
currentUserOrNothing

currentUserOrNothing :: forall user. (?context :: ControllerContext, user ~ CurrentUserRecord, Typeable user) => Maybe user
currentUserOrNothing :: Maybe user
currentUserOrNothing = (?context::ControllerContext, Typeable (Maybe user)) => Maybe user
forall value.
(?context::ControllerContext, Typeable value) =>
value
fromFrozenContext @(Maybe user)