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.

Michael


--- On Thu, 9/2/10, Alexander Solla <[email protected]> wrote:

From: Alexander Solla <[email protected]>
Subject: Re: [Haskell-cafe] On to applicative
To: 
Cc: "haskell-cafe Cafe" <[email protected]>
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:: ...

and

undefined:: ...

accomplish?
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
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe



      
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to