Using Zeus with Haskell

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2485
Joined: Fri Aug 13, 2004 5:10 pm

Using Zeus with Haskell

Post by jussij »

1. Go to the following download page an select from the various versions of Haskell available: https://downloads.haskell.org/ghc/

In this example the 8.8.4 version was selected and the ghc-8.8.4-x86_64-unknown-mingw32.tar.xz package was downloaded.

2. Unzip the contents of that package into this folder location.

Code: Select all

c:\ghc-8.8.4\
NOTE: An alternative folder location can also be used. In addition if that folder location contains white space some extra care will be needed as the folder location will need to be wrapped in quotes. As such it is best to start with a folder location that does not contain white space.

3. Add the following folder location to the PATH making sure to include the extra bin folder as shown:

Code: Select all

c:\ghc-8.8.4\bin\
More details about the PATH can be found here: http://www.zeusedit.com/phpBB3/viewtopic.php?f=5&t=6176

4. Start the Zeus IDE and check the PATH has been correctly configure by using the Tools, DOS Command Line menu to run the following command:

Code: Select all

ghc -V
Running that command should result in the following output:

Code: Select all

The Glorious Glasgow Haskell Compilation System, version 8.8.4
If instead the following output is produced re-check the PATH settings as this output indicates the PATH setting is wrong:
'ghc' is not recognized as an internal or external command, operable program or batch file.
5. Using the Options, Document Types menu edit the Haskell Document Type and in the Compiler section enter in the following compiler command:

Code: Select all

ghc.exe -o $fb "$fn"
6. In the Macros section of the Haskell Document Type add the following macro:

Code: Select all

Menu Text: Execute '$fb.exe'
Macro Name: $zud\zScript\run_exec.lua
Arguments: $fdd$fb.exe
7. Create a new test.hs file in the c:\temp folder using the following code:

Code: Select all

main :: IO ()
main = putStrLn "Haskell - Hello World!"
8. With the test.hs file as the active document use the Zeus Compiler, Compile menu to run the Haskell compiler.

This should result in the following output:
[1 of 1] Compiling Main ( C:\temp\hw.hs, C:\temp\hw.o )
Linking hw.exe ...
9. With the test.hs file as the active window, use the Macros, Execute 'test.exe' menu to run the executable file which should result in the following output:
Haskell - Hello World!
IMPORTANT NOTE:
When running the compile an error similar to the following might be produced:
In file included from C:/Utilities/Perl/c/i686-w64-mingw32/include/stddef.h:7:0,
from C:/Utilities/Perl/c/lib/gcc/i686-w64-mingw32/4.9.2/include/stddef.h:1,
from c:\Haskell\include/stdio.h:69,
from C:\Users\Jussi\AppData\Local\Temp\cob83248_0.c:8:
C:/Utilities/Perl/c/i686-w64-mingw32/include/crtdefs.h:123:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
__MINGW_EXTENSION typedef __int64 __time64_t;
^
C:/Utilities/Perl/c/i686-w64-mingw32/include/crtdefs.h:138:9: error: unknown type name '__time64_t'
This can happen when an older version of the GCC compiler is installed on the machine.

Reading the error it is clear the Haskell compiler has picked up the stddef.h file from this location:
C:\Utilities\Perl\c\i686-w64-mingw32\include\stddef.h
However it should have found the the Haskell installation version of that file found here:
C:\ghc-8.8.4\mingw\lib\gcc\x86_64-w64-mingw32\7.2.0\include\stddef.h
Cheers Jussi
Post Reply