Problem with getArgs in old Haskell codec

I am having trouble compiling the Haskell program, which was written several years ago for an earlier version of the Glasgow Haskell compiler.

It had the following four lines, which the current compiler complains about.

import Monad import List import IO import System 

I replaced the first three by looking at the library documentation with

 import Control.Monad import Data.List import System.IO 

But the latter is causing me problems. If I run the compiler with these three lines instead of the previous four, I get an error message related to getArgs

cnf1.hs: 657: 13: Out of scope: `getArgs'

I found getArgs in library documents, but it seems to be unavailable by default, and I need to use the deprecated haskell98-2.0.0.1 somehow (how?)

How to convince the compiler to look at haskell98 for getArgs, or what is currently accepted in a way to do the same as getArgs.

FWIW, I'm a rank amateur in Haskell. I am much more at home with C and C ++.

+6
source share
1 answer

getArgs moved to System.Environment . Import it and you should be fine.

By the way, you can use Hoogle to find where the functions are located.

+16
source

Source: https://habr.com/ru/post/946384/


All Articles