Re: [Haskell-cafe] Newbie question on Haskell type
--- Cale Gibbard <cgibbard@gmail.com wrote:
As an example of this sort of thing, I know that there are only 4 values of type a -> Bool (without the class context). They are the constant functions (\x -> True), (\x -> False), and two kinds of failure (\x -> _|_), and _|_, where _|_ is pronounced "bottom" and represents something along the lines of nontermination (aborting the program also counts).
Not exactly. There are also (\x -> seq x True) and (\x -> seq x False), neither of which is equivalent to any of the four functions above. Regards, Janis Voigtlaender.
Right, forgot about seq there, but the point still holds that there are a very limited number of functions of that type, and in particular, the functions can't decide what to do based on the type parameter 'a'. - Cale On 14 Oct 2005 05:49:27 -0000, voigt.16734551@bloglines.com <voigt.16734551@bloglines.com> wrote:
--- Cale Gibbard <cgibbard@gmail.com wrote:
As an example of this sort of thing, I know that there are only 4 values of type a -> Bool (without the class context). They are the constant functions (\x -> True), (\x -> False), and two kinds of failure (\x -> _|_), and _|_, where _|_ is pronounced "bottom" and represents something along the lines of nontermination (aborting the program also counts).
Not exactly. There are also (\x -> seq x True) and (\x -> seq x False), neither of which is equivalent to any of the four functions above.
Regards,
Janis Voigtlaender.
On Fri, Oct 14, 2005 at 03:17:12AM -0400, Cale Gibbard wrote:
Right, forgot about seq there, but the point still holds that there are a very limited number of functions of that type, and in particular, the functions can't decide what to do based on the type parameter 'a'.
actually, without 'seq' _|_ and \_ -> _|_ are indistinguishable. so you only have 3 functions without seq, and 6 with it. John -- John Meacham - ⑆repetae.net⑆john⑈
participants (3)
-
Cale Gibbard -
John Meacham -
voigt.16734551@bloglines.com