Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

GHC's readBin function from Numeric Library is not being recognised by GHCI

I am trying to use the readBin function from the Numeric Library but ghci is telling me that it is not in scope. Other functions like readOct and readHex are working. What could be the problem here?

Here is the error message:

Prelude> import Numeric
Prelude Numeric> :t readBin

<interactive>:1:1: error:
    • Variable not in scope: readBin
    • Perhaps you meant ‘readLn’ (imported from Prelude)
Prelude Numeric> :t readHex
readHex :: (Eq a, Num a) => ReadS a
Prelude Numeric> readHex "deadbeef"
[(3735928559,"")]

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You’re probably using GHC 9.0.2 or older. Those versions didn’t have readBin yet.

(Or more accurately, base-4.15.1.0 and older didn’t have that function yet.)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading