Last active
December 25, 2019 21:54
-
-
Save myme/dd3c9adeab97bf7dc4ac804c82f71a5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char (ord) | |
import Data.Conduit ((.|)) | |
import qualified Data.Conduit as C | |
import qualified Data.Conduit.Combinators as C | |
import qualified Data.ByteString.Char8 as B | |
main = C.runConduit | |
$ C.stdin | |
.| C.concatMap B.words | |
.| C.concatMap transform | |
.| C.unlinesAscii | |
.| C.stdout | |
where transform = map (B.pack . show . ord) . B.unpack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mmyrseth@set:~]$ echo -n "foo\nbar\nbaz" | runghc foo.hs | |
102 | |
111 | |
111 | |
92 | |
110 | |
98 | |
97 | |
114 | |
92 | |
110 | |
98 | |
97 | |
122 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment