Hello all,
I’m experimenting with ReaderT
pattern and I defined env like
type Env =
{ message :: String
}
Then I defined application monad like
type AppM m = ReaderT Env m
Example is written in hipertrout and there this is action I’m triing to execute (which should return message)
data Greeting = Greeting String
This is handler which read message from Env
and return it in action
greetingResource :: {"GET" :: ExceptT RoutingError (AppM Aff) Greeting}
greetingResource =
let message = do
env <- ask
pure env.message
in {"GET": Greeting <$> message}
I’m triing to extract retrieving message to separate function, but I failed to figure out the types
getMessage :: ?
getMessage = do
env <- ask
pure env.message
Thank you in advance