```OCaml                                                          Haskell
==========================================================     =========================================================

type term = I | S | K | App of (term * term)                   data Term = I | S | K | App Term Term deriving (Eq, Show)

let skomega = App (App (App (S,I), I), App (App (S,I), I))     skomega = (App (App (App S I) I) (App (App S I) I))

reduce_if_redex :: Term -> Term
let reduce_if_redex (t:term):term = match t with               reduce_if_redex t = case t of
| App(I,a) -> a                                                App I a -> a
| App(App(K,a),b) -> a                                         App (App K a) b -> a
| App(App(App(S,a),b),c) -> App(App(a,c),App(b,c))             App (App (App S a) b) c -> App (App a c) (App b c)
| _ -> t                                                       _ -> t

is_redex :: Term -> Bool
let is_redex (t:term):bool = not (t = reduce_if_redex t)       is_redex t = not (t == reduce_if_redex t)

reduce_try2 :: Term -> Term
let rec reduce_try2 (t : term) : term = match t with           reduce_try2 t = case t of
| I -> I                                                       I -> I
| K -> K                                                       K -> K
| S -> S                                                       S -> S
| App (a, b) ->                                                App a b ->
let t' = App (reduce_try2 a, reduce_try2 b) in                 let t' = App (reduce_try2 a) (reduce_try2 b) in
if (is_redex t') then let t'' = reduce_if_redex t'             if (is_redex t') then reduce_try2 (reduce_if_redex t')
in reduce_try2 t''                                        else t'
else t'
```