Yoni Melki
Yoni Melki

Reputation: 316

how to load a module that contains whitespace in ghci

I want to load the module C:\Users\ymelk\OneDrive\Desktop\Computer Science\Works\Assignments\Functional Programming with Haskell\ex1 straight from GHCi but when i put

:l C:\Users\ymelk\OneDrive\Desktop\Computer Science\Works\Assignments\Functional Programming with Haskell\ex1 

ghci says target C:\Users\ymelk\OneDrive\Desktop\Computer' is not a module name or a source file

I suppose that this is because I have whitespaces. one of the solution is to write the name of my documents like camelCase norm but this is too long (many documents)

Is there a way to load a module including whitespaces ?

Upvotes: 2

Views: 365

Answers (1)

willeM_ Van Onsem
willeM_ Van Onsem

Reputation: 477881

You can wrap it in quotes ("), like:

Prelude> :l "foo bar.hs"

You will need to escape the backslashes, so:

Prelude> :l "C:\\Users\\ymelk\\OneDrive\\Desktop\\Computer Science\\Works\\Assignments\\Functional Programming with Haskell\\ex1"

That being said, filenames with spaces are often not a good idea, especially since a shell often sees spaces as an argument separator.

Upvotes: 4

Related Questions