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 8591235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:28:48+00:00 2026-06-11T23:28:48+00:00

When I use Cabal’s various MIN_VERSION_ macros in a Haskell project, how can I

  • 0

When I use Cabal’s various MIN_VERSION_ macros in a Haskell project, how can I ensure they are all correctly defined when I am not using cabal, e.g. when testing in GHCi?

  • 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-06-11T23:28:50+00:00Added an answer on June 11, 2026 at 11:28 pm

    Nowadays, cabal supports a cabal repl subcommand, which does all the setup for you, so at least for ghci the following is unnecessary. Nevertheless:

    The cabal build command generates the file dist/build/autogen/cabal_macros.h, which contains all the definitions you need. In order to include that file in a ghc invocation, you’ll need the flags -optP-include -optPdist/build/autogen/cabal_macros.h.

    For convenience, you can place the following in a .ghci file in the project directory:

    :set -optP-include -optPdist/build/autogen/cabal_macros.h
    

    so that you don’t have to type out the options every time you want to use ghci.

    Beware, though: the macros will be defined according to the configuration when you last ran cabal build, and will not be updated when you install new packages or use a different GHC version: for that you’d need to re-configure and rebuild the package.

    (Thanks to Simon Hengel on the libraries list for this wisdom: http://www.haskell.org/pipermail/libraries/2012-September/018491.html).

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

Sidebar

Related Questions

Is it possible to (ab)use Cabal to have it create a generic Haskell project
The Haskell wiki states that you should use Cabal as your build system. However,
This is a well-known bug that cabal can not handle proxies in format http://user:password@host:port
Haskell's cabal package manager stores recent package source code in ~/Library/Haskell/repo-cache/*/*.tgz I've found that
When installing Haskell pango on mac ( sudo cabal install pango ), the first
I'm trying to get Cabal to install the haskell-src-meta package, and I'm having difficulty
I've been trying to use a preexisting database in my ASP.NET MVC project. I
Use case: I find a piece of code that I do not understand at
I am rather new to the Haskell world and I would like to use
I was able to use cabal-dev to build some packages that cabal was having

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.