We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5576348 commit c520bbcCopy full SHA for c520bbc
MonadsAndEffects/3.3/logFirstAndRetSecond.hs
@@ -0,0 +1,15 @@
1
+module LogFirstAndRetSecond where
2
+
3
4
+import Control.Monad.Trans.Writer
5
+import Control.Monad.Trans.Reader
6
+import Control.Monad.Trans (lift)
7
+import Data.Char (toUpper)
8
9
10
+logFirstAndRetSecond :: WriterT String (Reader [String]) String
11
+logFirstAndRetSecond = do
12
+ e2 <- lift $ asks (map toUpper . head . tail)
13
+ e1 <- lift $ asks head
14
+ tell e1
15
+ return e2
0 commit comments