title: Why does Haskell let me return an empty list where a list inside a list is expected?
body: <p>I'm really new to Haskell and have been going through the <a href="http://www.haskell.org/haskellwiki/H-99%3a_Ninety-Nine_Haskell_Problems">99 problems translation.</a> This is my solution to number 9:</p>
  
  <pre><code>pack :: (Eq a) =&gt; [a] -&gt; [[a]]
  pack (xs)
      | null xs = []
      | otherwise = 
          let (matched, unmatched) = span (== head xs) xs
          in [matched] ++ pack unmatched
  </code></pre>
  
  <p>I don't get how I'm allowed to do <code>| null xs = []</code> when the type signature says the function returns a <code>[[]]</code>. I've seen other solutions to the same problem do the same thing.   </p>
  
  <p>I mean, I'm not complaining, but is this something specifically allowed? Are there any caveats I have to look out for?  </p>
  
  <p>I'm using the GHCi on a default Windows 7 Haskell Platform 2013.2.0.0 installation, if that helps.</p>