In haskell how would I go about getting and printing out the name of the executing script? Also since I'm here when I use some code to list directory contents and print them out at the console (GHCi) I just get the following result "[]" from my knowledge of other languages i would assume it's because it returns an array but then print should print the array anyway, no?
this is on windows
I think getProgName from System.Environment should do that but you should check how portable it is on windows.
"[]" is the empty list. You can use getDirectoryContents from System.Directory.
Prelude System.Directory> getDirectoryContents "."
["hist","parse.hs","b.hs","d.hs","qsort.hs"]
The System.Environment module is used to access information about the system environment, such as getProgName which returns the name of the executable.
The result [] is an empty list, so it seems you are trying to list the contents of an empty directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With