Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:28:21+00:00 2026-05-28T06:28:21+00:00

I created some files from a project in Unix, they are a lot and

  • 0

I created some files from a project in Unix, they are a lot and if I want to execute it in another pc or folder I need to copy all files to there. They are all connected in import.
How can I make an executable haskell program?

I have per example:

main.hs - main where all the program executes; using,besides haskell, unix shell.
ex1.hs - basically types of data, some functions.
ex2.lhs - same as ex1.lhs but is literate with LaTeX
pic.jpg - picture to use on the pdflatex
package.sty - package needed to use some functions

How do I proceed and compile all of these?
I tried using ghc but always giving errors:

>ghc -o MAIN main.hs ex1.hs ex2.lhs pic.jpg package.sty

Failed to load interface for 'ex1.hs'
And is in the line which has import ex1.hs

Curious is if I trade import ex1.hs to import ex2.lhs line will give error on ex2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:28:22+00:00Added an answer on May 28, 2026 at 6:28 am
    1. Haskell module names must begin with an upper case letter, so start by renaming ex1.hs and ex2.hs to Ex1.hs and Ex2.hs. They should also start with module Ex1 where, otherwise the module name will default to Main, and GHC will be very confused when the module names don’t match the file names.

    2. Import statements should refer to the module name, not the file name, so change them in main.hs to correspond to the module names.

      import Ex1
      import Ex2
      
    3. Now compile with ghc --make main.hs, and it should find the other modules automatically. It will search for modules with both .hs and .lhs extensions, and correctly treat the latter like literate Haskell files.

    For larger projects, you should look into using Cabal, the build system used by most Haskell libraries and programs. It will help with managing dependencies and compiler options, sort of like a Makefile.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to automatically add files to an Xcode project that is created from
My current Xcode project uses some files that I originally created in another Xcode
I have some jpg files i want to create gif animated from them. i
I created a new cordova project on XCODE, I have some files that I
I created a python project in IDE Anjuta, added some python files and the
I want to create some files at WEB-INF/upload and upload is a folder which
I have a big project here where I created some build files which I
In my application I have a rather large object created from some XML files.
I had removed some files from my iOS project a while back and thought
I have created a new iPhone project in Xcode 4 and added some files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.