Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Haskell '.hs' file compile problems...

hello world haskell

  • Please log in to reply
3 replies to this topic

#1 abderrahim

abderrahim

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 58 posts
  • Location:algeria
  • Programming Language:C, Java, PHP, Perl, Pascal, Assembly, Haskell
  • Learning:C, Java, PHP, JavaScript, PL/SQL, Assembly, Haskell

Posted 10 February 2012 - 05:25 AM

Hi everybody,
Everytime I want to compile a Haskell .hs file with Ghci, it fails as shown in the picture.
please I need help, I'm a newbie!!
Capture.PNG
aaa another thing may be in relationn, here is the source code of the file
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
 
main :: IO ()
main = do 
  (progname, _) <- getArgsAndInitialize
  createWindow "Hello World"
  displayCallback $= flush
  mainLoop

  • 0

#2 Sysop_fb

Sysop_fb

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 151 posts
  • Location:Missouri

Posted 17 February 2012 - 05:45 AM

ghc is a command line utility to compile haskell source code

ghci is the haskell interpreter


jason@db-box:~/haskell$ cat cc.hs
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT

main :: IO ()
main = do
(progname, _) <- getArgsAndInitialize
createWindow "Hello World"
displayCallback $= flush
mainLoop
jason@db-box:~/haskell$ ghc --make cc.hs
[1 of 1] Compiling Main ( cc.hs, cc.o )
Linking cc ...


If instead of compiling the code you want to run it through the inerpreter then just load it up into ghci

jason@db-box:~/haskell$ ghci
GHCi, version 6.12.1: The Glasgow Haskell Compiler :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load cc.hs
Ok, modules loaded: Main.
Prelude Main>


  • 0
"The best optimizer is between your ears" - Michael Abrash
Saying you can optimize a program is like saying you understand how a program works on every level of every facet on a specific machines configuration.

#3 abderrahim

abderrahim

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 58 posts
  • Location:algeria
  • Programming Language:C, Java, PHP, Perl, Pascal, Assembly, Haskell
  • Learning:C, Java, PHP, JavaScript, PL/SQL, Assembly, Haskell

Posted 24 February 2012 - 01:09 AM

ok, thank you,
there is another issue i'm dealing with, after compiling and running the .exe file, I end up with a dll missing file called "glut32".
So Thanks in advance....
  • 0

#4 Sysop_fb

Sysop_fb

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 151 posts
  • Location:Missouri

Posted 29 February 2012 - 07:00 AM

Might need to install the haskell glut binding. It seems like you're using windows?
I don't know how to do it on windows on linux I just use cabal but I found this from hackage
Less Sugar/More Meat » Blog Archive » freeglut + Windows + HOpenGL + HGLUT
  • 0
"The best optimizer is between your ears" - Michael Abrash
Saying you can optimize a program is like saying you understand how a program works on every level of every facet on a specific machines configuration.





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download