
12 Sep
2007
12 Sep
'07
5:39 p.m.
On 9/12/07, PR Stanley
The same should apply to head and tail. head or tail of [] should be Disagree, strongly. Its not even possible for head, What's the logic behind this?
You don't need anything sophisticated for this. What possible total function could have signature [a] -> a? If you provide an argument of [] it has to conjure up a value of type a from somewhere. Where could it possibly get such a value for every single type a? For example, define
data Void -- the type with no elements (using -fglasgow-exts)
x = [] :: [Void] is a perfectly good list but head x has to be of type Void which has no elements. -- Dan