[Haskell-cafe] Creating an alias for a function

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Oct 7 09:13:49 EDT 2009

Hello Deniz,

Wednesday, October 7, 2009, 5:03:59 PM, you wrote:

it depends. what i see with ghc 6.6.1:

C:\!\Haskell>runghc test.hs

    Ambiguous type variable `a' in the constraint:
      `Enum a' arising from use of `fromEnum' at test.hs:1:6-13
    Possible cause: the monomorphism restriction applied to the following:
      ord :: a -> Int (bound at test.hs:1:0)
    Probable fix: give these definition(s) an explicit type signature
                  or use -fno-monomorphism-restriction

C:\!\Haskell>ghc --make test.hs
[1 of 1] Compiling Main             ( test.hs, test.o )
Linking test.exe ...


ord = fromEnum
main = print (ord 'a')

> 2009/10/7 michael rice <nowgate at yahoo.com>
>> Actually I used it to fake the Pascal ord(x) function:
>> ord = fromEnum
>> Problem?
>> Michael

> If the monomorphism restriction applies, the compiler (assuming you're
> using GHC) will tell you about it.

> --
> Deniz Dogan

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list