On Sep 2, 2010, at 11:30 AM, michael rice wrote:
In each case, what does the notation
show:: ...
and
undefined:: ...
accomplish? |
They're type annotations. show is a function in "many" types:
Prelude> :t show
show :: (Show a) => a -> String
If you want to see the type of a "specific" show function, you need to find a way to "determine" its type. This is a slightly different function, but it's equivalent in types and semantics:
Prelude> :t \x -> show x
\x -> show x :: (Show a) => a -> String
Now we have a named argument, and we can constraint its type with an annotation:
Prelude> :t \x -> show (x :: Int)
\x -> show (x :: Int) :: Int -> String