10 lines
254 B
Haskell
10 lines
254 B
Haskell
|
import Data.List (intercalate)
|
||
|
|
||
|
data Node = List [Node] | Num Int
|
||
|
deriving (Eq)
|
||
|
|
||
|
-- here's a Show instance for Node that recreates the input:
|
||
|
|
||
|
instance Show Node where
|
||
|
show (List x) = "[" ++ intercalate "," (map show x) ++ "]"
|
||
|
show (Num n) = show n
|