Hi,
Thanks for the clarification.

This is clearly depravity.

I am confused, in what sense this is depravity?

Damodar

On Sun, Nov 18, 2012 at 7:27 AM, Albert Y. C. Lai <trebla@vex.net> wrote:
On 12-11-17 02:19 AM, damodar kulkarni wrote:
Let's see tthis:
Prelude> :t 3 "a"
3 "a" :: (Num ([Char] -> t)) => t

No complaint from GHC; but now see this:

Prelude> :t  "a" 3

<interactive>:1:0:
     Couldn't match expected type `t1 -> t'
            against inferred type `[Char]'
     In the expression: "a" 3

Why does it not fail for  (:t 3 "a") but does fail for (:t  "a" 3)?

3 is polymorphic, "a" is monomorphic (exactly [Char]).

To make "a" polymorphic, turn on OverloadedStrings:

:set -XOverloadedStrings
:type "a"

"a" :: Data.String.IsString a => a

:type "a" 3

"a" 3 :: (Num a, Data.String.IsString (a -> t)) => t

Success!

This is clearly depravity.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe