Mercurial > repo
view interps/rhotor/Node.hs @ 5674:91d4a5b788c9
<tswett> echo \'[11,11,11,15,15,23,12],[5,5,5,3,53,45,16,26,00,20,15,16,22,25,45,91,32,11,15,27,06,01,11,01,47,22,30,13,43,21,11,13,29,61,65,17,19,12,28,17,11,01,23,20,16,20,81,18,32,25,58,22.,1985,10.301350435,1555466973690094680980000956080767,13720946704494913791885940266665466978579582015128512190078...\' > wisdom/code
author | HackBot |
---|---|
date | Wed, 24 Jun 2015 14:47:46 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
module Node ( Node(Function,Application,Cons,Symbol,Nil,Break) ) where import Uniqs data Node = Function Node Node Node | Application Node Node | Cons Node Node | Break Node | Symbol Uniqs | Nil instance Eq Node where (==) Nil Nil = True (==) (Cons a1 d1) (Cons a2 d2) = (a1 == a2) && (d1 == d2) (==) (Application a1 d1) (Application a2 d2) = (a1 == a2) && (d1 == d2) (==) (Function a1 d1 c1) (Function a2 d2 c2) = (a1 == a2) && (d1 == d2) && (c1 == c2) (==) (Symbol a) (Symbol b) = a == b (==) a b = False (/=) a b = not (a == b) instance Show Node where show Nil = "Nil" show (Cons a b) = "(Cons " ++ (show a) ++ " " ++ (show b) ++ ")" show (Application a b) = "(Application " ++ (show a) ++ " " ++ (show b) ++ ")" show (Function a b c) = "(Function " ++ (show a) ++ " " ++ (show b) ++ " " ++ (show c) ++ ")" show (Break a) = "**" ++ (show a) show (Symbol a) = "#" ++ (show a)