[Haskell-cafe] Very freaky

Bernie Pope bjpop at csse.unimelb.edu.au
Tue Jul 10 21:13:37 EDT 2007


On 11/07/2007, at 9:02 AM, Brandon S. Allbery KF8NH wrote:

>
> 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).

This reminds me of a little joke that Conor McBride had in a post a  
while ago:

    unJust :: Maybe wmd -> wmd

Cheers,
Bernie.


More information about the Haskell-Cafe mailing list