Freestyle076
Freestyle076

Reputation: 1556

GHCi loading distant files/file traversing

I'm super new with Haskell and GHCi. Fair warning. I'm trying to load a .hs file with the :load command, but the file is saved far from where my GHCi bin folder is, ie

C:\Users\Kyle\Documents\bin

I want to get to this directory so that I can use

:load hw2.hs

to load my module. But I'm struggling to get there. I've tried

:cd 'C:\Users\Kyle\Documents\bin'

with errors returned. What's the proper syntax for changing to this directory? What about if there are spaces in the file path? (C:\Users\Kyle\My Documents\bin)

Also what command can I enter to see my current directory?

Thanks for the help!

Upvotes: 1

Views: 212

Answers (2)

Antal Spector-Zabusky
Antal Spector-Zabusky

Reputation: 36612

Your problem is that you can't use quotes with :cd – you just want

Prelude> :cd C:\Users\Kyle\Documents\bin

or, if you start in C:\Users\Kyle, then just

Prelude> :cd Documents\bin

This is also true for handling paths with spaces;

Prelude> :cd My Documents

will place you into the My Documents subdirectory of the current directory.

Upvotes: 1

Wojtek Surowka
Wojtek Surowka

Reputation: 20993

'C:\Users\Kyle\Documents\bin' I think it should be

'C:\\Users\\Kyle\\Documents\\bin'

or just use forward slashes / instead. It will work for paths with spaces too.

Upvotes: 0

Related Questions