1
1
module Example.App where
2
2
3
3
import Prelude
4
+
4
5
import Control.Monad.Reader (ReaderT , asks , runReaderT )
5
6
import Control.Monad.Reader.Class (class MonadAsk )
6
7
import Data.Either (Either (..))
7
8
import Effect (Effect )
8
9
import Effect.Class (class MonadEffect , liftEffect )
9
10
import Effect.Console (log )
10
11
import Node.Process (getEnv )
11
- import Type.Data.Row (RProxy (..))
12
12
import Type.Equality (class TypeEquals , from )
13
+ import Type.Proxy (Proxy (..))
13
14
import TypedEnv (Resolved , Variable , envErrorMessage )
14
15
import TypedEnv (fromEnv ) as TypedEnv
15
16
16
17
type Config f =
17
- ( alertEmail :: f " ALERT_EMAIL" String
18
+ ( alertEmail :: f " ALERT_EMAIL" String
18
19
, alertSubject :: f " ALERT_SUBJECT" String
19
20
)
20
21
@@ -37,7 +38,7 @@ instance monadAskAppM :: TypeEquals e ResolvedConfig => MonadAsk e AppM where
37
38
38
39
main :: Effect Unit
39
40
main = do
40
- eitherConfig <- TypedEnv .fromEnv (RProxy :: RProxy (Config Variable )) <$> getEnv
41
+ eitherConfig <- TypedEnv .fromEnv (Proxy :: Proxy (Config Variable )) <$> getEnv
41
42
case eitherConfig of
42
43
Left error ->
43
44
log $ " ERROR: " <> envErrorMessage error
@@ -48,4 +49,7 @@ sendAlert :: AppM Unit
48
49
sendAlert = do
49
50
email <- asks _.alertEmail
50
51
subject <- asks _.alertSubject
51
- liftEffect $ log (" Sending alert with subject \" " <> subject <> " \" to \" " <> email <> " \" ...done." )
52
+ liftEffect $ log
53
+ ( " Sending alert with subject \" " <> subject <> " \" to \" " <> email <>
54
+ " \" ...done."
55
+ )
0 commit comments