1

When attempting to load Haskell file test.hs into terminal. I get this response:

<interactive>:5:1: error: Variable not in scope: test :: b0 -> c

<interactive>:5:6: error: Variable not in scope: hs :: a -> b0

This is the code from test.hs:

double x = x + x

quadruple x = double (double x)

How do I get the file to load in terminal?

openai says look for documentation or may need to import module?

1
  • Can you also share the GHC command you're running? Commented Dec 20, 2022 at 4:10

1 Answer 1

3

That's what happens if you type test.hs at the GHCi prompt. You meant to type :l test.hs instead.

Sign up to request clarification or add additional context in comments.

3 Comments

<no location info>: error: can't find file: test.hs Failed, no modules loaded. That is the response I get when I type in what you suggested
@JonathanOsman Is your test.hs file in the same directory that you're in when you ran ghci? If you specify an absolute path to it instead, does that work any better?
Yes, it has to do with the directory I believe. Nobody else mentioned this yet except you. I moved it to the directory it was searching and received this [1 of 1] Compiling Main ( test.hs, interpreted ) Ok, one module loaded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.