(flip id)
System.Console.GetOpt のサンプルコードを読んでいたら、訳の分からないところがでてきました。
compilerOpts :: [String] -> IO (Options, [String]) compilerOpts argv = case getOpt Permute options argv of (o,n,[] ) -> return (foldl (flip id) defaultOptions o, n) (_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options)) where header = "Usage: ic [OPTION...] files..."
ここの (flip id) が分からない箇所です。
結論からすると、次のように解釈すればよいようです。
-- 式の変換過程は、次のように考える。 -- f x -- id f x -- (flip id) x f (flip id) :: b -> (b -> c) -> c (flip id) x f = f x