blank
As of March 2020, School of Haskell has been switched to read-only mode.
Untitled 6 May 2016
data B = Empty | Zero | One | B :+: B instance Show B where show Empty = "" show Zero = "0" show One = "1" show (s1 :+: s2) = (show s1) ++ (show s2) rev :: B -> B rev(Empty) = Empty rev(Zero) = Zero rev(One) = One rev(s1 :+: s2) = rev(s2) :+: rev(s1) main = do let test = Empty :+: Zero :+: Zero :+: One :+: Zero :+: One putStrLn $ "str = " ++ (show test) putStrLn $ "rev(str) = " ++ (show (rev test)) putStrLn $ "rev(rev(str)) = " ++ (show (rev (rev test)))