if を関数として実装
{- Haskell -} myIf :: Bool -> a -> a -> a myIf True t e = t myIf False t e = e main = myIf True (putStrLn "then") (putStrLn "else") ---------- 実行結果: then
(* OCaml *) let myIf c t e = match c with true -> t | false -> e let _ = myIf true (print_endline "then") (print_endline "else") ---------- 実行結果: else then