[Haskell-cafe] Very freaky

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Tue Jul 10 19:02:59 EDT 2007

On Jul 10, 2007, at 15:59 , Andrew Coppin wrote:

> I find myself wondering... A polymorphic type signature such as (a - 
> > b) -> a -> b says "given that a implies b and a is true, b is  
> true". But what does, say, "Maybe x -> x" say?

Actually, because parentheses naturally group to the right in type  
expressions in Haskell, (a -> b) -> a -> b is in fact (a -> b) -> (a - 
 > b), a tautology.  (This should be reasonably obvious.)

Maybe x -> x is a risky proposition, in a number of senses.  :)  It  
asserts that given something that may or may not be true, it is in  
fact guaranteed to be true.  In the Haskell library this is the  
"fromJust" function, which throws an exception if x is *not* true  
(since it clearly can't satisfy the proposition).

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list