Created
October 13, 2018 19:08
-
-
Save dbp/0c92ca0b4a235cae2f7e26abc14e29fe 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
c :: String -> ((String -> a) -> a) | |
c str = \k -> k str | |
d :: (String -> a) -> Int -> a | |
d = \k -> (\int -> k (show (int::Int))) | |
s :: (String -> a) -> String -> a | |
s = \k -> (\str -> k (str::String)) | |
printf :: ((String -> IO ()) -> a) -> a | |
printf format = format putStrLn | |
(%) :: ((String -> a) -> c) | |
-> ((String -> b) -> a) | |
-> (String -> b) -> c | |
(%) f1 f2 = \k -> f1 (\s1 -> f2 (\s2 -> k (s1 ++ s2))) | |
main = do printf (d % c "foo" % s) 10 "bar" | |
printf (d % c "foo") 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's what I managed to do : https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=159cfda7ced5f44149e58849955071d8.
The individual functions compile but you can't use them because currification and partial application don't really work in Rust...