[Haskell-cafe] On to applicative

michael rice nowgate at yahoo.com
Thu Sep 2 19:20:09 EDT 2010

Hi Alexander,

Prelude FmapFunc> let s = show :: ((->) Int) String
Prelude FmapFunc> :t s
s :: Int -> String

The notation was throwing me, but after staring at it for a while it finally sunk in that show (above) is partially applied.

Thanks, all.


--- On Thu, 9/2/10, Alexander Solla <ajs at 2piix.com> wrote:

From: Alexander Solla <ajs at 2piix.com>
Subject: Re: [Haskell-cafe] On to applicative
Cc: "haskell-cafe Cafe" <haskell-cafe at haskell.org>
Date: Thursday, September 2, 2010, 2:46 PM

On Sep 2, 2010, at 11:30 AM, michael rice wrote:
In each case, what does the notation

show:: ...


undefined:: ...

They're type annotations.  show is a function in "many" types:
Prelude> :t showshow :: (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

-----Inline Attachment Follows-----

Haskell-Cafe mailing list
Haskell-Cafe at haskell.org

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

More information about the Haskell-Cafe mailing list