fork download
  1. main = do -- your code goes here
  2. print $isFlat [Node 1, Node 2, Node 3]
  3. print $isFlat [Node 1, Node 2, Branch [Node 3, Node 4, Node 5], Node 6]
  4.  
  5. data Tree a = Node a | Branch [Tree a]
  6.  
  7. isFlat :: [Tree a] -> Bool
  8. isFlat = all isNode where
  9. isNode (Node _) = True
  10. isNode _ = False
Success #stdin #stdout 0s 6260KB
stdin
Standard input is empty
stdout
True
False