Chaitin's construction/Combinatory logic

From HaskellWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Combinatory logic term modules

CL

 module CL (CL, k, s, apply) where

 import Tree (Tree (Leaf, Branch))
 import BaseSymbol (BaseSymbol, kay, ess)

 type CL = Tree BaseSymbol 

 k, s :: CL
 k = Leaf kay
 s = Leaf ess

 apply :: CL -> CL -> CL
 apply = Branch

CL extension

 module CLExt ((>>@)) where

 import CL (CL, apply)
 import Control.Monad (Monad, liftM2)

 (>>@) :: Monad m => m CL -> m CL -> m CL
 (>>@) = liftM2 apply

Base symbol

 module BaseSymbol (BaseSymbol, kay, ess) where

 data BaseSymbol = K | S

 kay, ess :: BaseSymbol
 kay = K
 ess = S