(moved reply to haskell-cafe) Ashley Yakeley wrote:
| But this gives an error: | | emptyList :: (Ord a) => [a] | emptyList = [] | | isempty :: Bool | isempty = null emptyList Here is another (very similar) case: emptyList :: [a] emptyList = [] showEmptyList :: String showEmptyList = show emptyList Now, you might argue that the type error resulting from this program is too restrictive, since the empty list can always be shown as: "[]". But this is not true for all types, look at the way the empty *string* is shown. I.e. changing the type of `emptyList' in this example changes the behavior of `showEmptyList'. The compiler does not know what type to choose, and thus gives a type error. /Koen. -- Koen Claessen http://www.cs.chalmers.se/~koen phone:+46-31-772 5424 mailto:[EMAIL PROTECTED] ----------------------------------------------------- Chalmers University of Technology, Gothenburg, Sweden _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
