|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|
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...