[Haskell-cafe] On to applicative

Alexander Solla ajs at 2piix.com
Thu Sep 2 14:46:28 EDT 2010


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100902/8f907b92/attachment.html


More information about the Haskell-Cafe mailing list