Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with getArgs in old Haskell code

Tags:

haskell

I am having trouble with compiling a Haskell program that was written some years ago for an earlier version of the Glasgow Haskell Compiler.

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

import Monad
import List
import IO
import System

I replaced the first three, after looking at the library documentation, with:

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

But the last one is giving me trouble. If I run the compiler with these three lines instead of the previous four, I get an error message relating to getArgs

cnf1.hs:657:13: Not in scope: `getArgs'

I have found getArgs in the library docs but it seems that it is not available by default, and I have to somehow (how??) use the legacy haskell98-2.0.0.1

How do I persuade the compiler to look in the haskell98 place for getArgs, or what is the currently accepted way of doing the same thing as getArgs.

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

like image 446
user2446884 Avatar asked Jun 03 '13 07:06

user2446884


1 Answers

getArgs has been moved to System.Environment. Import that, and you should be fine.

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

like image 74
hammar Avatar answered Sep 28 '22 01:09

hammar