Trying to implement SKI combinators in Haskell... Im not sure what ^M
represents but i think it has something to do with the notation of vim while editing a haskell file. Also what is the type notation of the function eliminate
? Thanks
data Exp = Var String | App Exp Exp | Lam String Exp | S | K |I ^M
transform (Lam x y) = (eliminate x y)
eliminate x S = App K S^M
eliminate x K = App K K^M
eliminate x I = App K I^M
eliminate x (Var y)
| x==y = I
| otherwise = (App K (Var y))
eliminate x (Lam y z) = eliminate x (eliminate y z)^M
eliminate x (App y z) = (App (App S (eliminate x y)) (eliminate x z))^M