I can't use fromInteger or realtoFrac in curry

51 views Asked by At

I'm using an old version of curry and all functions of Haskell works fine so far, but I have problem with realtoFrac and fromInteger

Prelude> :t fromInteger

PAKCS_Main_Exp.curry, line 2.17: Error:
    `fromInteger' is undefined
ERROR occurred during parsing!
Prelude> :t realtoFrac

PAKCS_Main_Exp.curry, line 2.17: Error:
    `realtoFrac' is undefined
ERROR occurred during parsing!

I think that this can happen because is an old version, so, in old versions of curry how can I use realtoFrac or fromInteger?

Thanks in advance and apologies for my bad English

1

There are 1 answers

0
Ziharrk On BEST ANSWER

It depends on which compiler and version you are using. So here is an answer for most of them.

PAKCS 1.x and most old versions of KICS2 did not support type classes. There, a replacement for fromInteger you might be interested in should be in the module Float as i2f.

For newer versions of PAKCS since 2.0, fromInteger available in the Prelude. Since there is only one type for floating point and none for fractions of Integers, realToFrac does not exist.

The function realToFrac is available in the Prelude since version 3.0 of the standard library, which is included in the newest compiler versions.