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

  • Home
  • SEARCH
  • 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 7072481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:48:50+00:00 2026-05-28T05:48:50+00:00

I have a Haskell project that regularly uses a lot of language features, and

  • 0

I have a Haskell project that regularly uses a lot of language features, and I want the language extension block for each source file to be the same. Here’s a list,

{-# LANGUAGE Arrows,
             BangPatterns,
             DefaultSignatures,
             DeriveDataTypeable,
             DeriveFunctor,
             EmptyDataDecls,
             FlexibleContexts,
             FlexibleInstances,
             FunctionalDependencies,
             GADTs,
             GeneralizedNewtypeDeriving,
             MultiParamTypeClasses,
             NamedFieldPuns,
             NoImplicitPrelude,
             NoMonomorphismRestriction,
             OverlappingInstances,
             RankNTypes,
             RebindableSyntax,
             ScopedTypeVariables,
             StandaloneDeriving,
             TemplateHaskell,
             TypeFamilies,
             TypeOperators,
             TypeSynonymInstances,
             UndecidableInstances,
             ViewPatterns #-}

Maybe to some it’s bad practice, but I consider language extensions to be part of the “Haskell+” that I usually write code in. And, I want that to be the same across modules. For example, the NoImplicitPrelude changes the language dramatically, and I want it uniform for all modules.

Question: How can I achieve this, without copy-pasting the language block into each file? It gets annoying how I often learn a new language feature, add it to module A, then start working on module B, and realize I have to go copy the language block from module A.

Just FYI the CPP pragma with a #include does not do the trick! Thanks in advance.

  • 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-28T05:48:51+00:00Added an answer on May 28, 2026 at 5:48 am

    Use cabal as your build system, and list the language extensions you want in the Extensions field of the Library or Executable section of your project.cabal file. Then remove the LANGUAGE block from your Haskell source files.

    See the Cabal User Guide, including the third paragraph of the introduction.


    Ghci is where it all falls down. There is talk of adding a cabal ghci command, but in the meantime it’s a bit icky.

    If your project is a library, you can run ghci -package-conf dist/package.conf.inplace.

    If you want to load unexposed modules in ghci, I’d define a “development mode” flag in your project.cabal:

    Flag development
      Description:          Development mode: expose all modules, enable warnings.
      Default:              False
    

    …conditionally expose extra modules in development mode:

    Library
      Exposed-modules:      My.Module, My.Module.Extra
      if flag(development)
        Exposed-modules:    My.Module.Hidden, My.Module.Secret
        GHC-Options:        -Wall
      -- plus your extensions, etc
    

    …and explicitly enable development mode when you run cabal configure:

    $ cabal configure -f development
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working on this Haskell project, and I have a cabal file for
I have a Haskell program that uses Gtk/GtkGLExt and runs fine on Linux (up-to-date
I have a Haskell project and Cabal package-description that allows me to build and
I have a Haskell function that operates on a single file to produce a
I have a haskell file test.hs. In this file I have written a function
I am a Haskell newbie. I have noticed that Haskell does not support record
I'm starting to learn Haskell and I've heard that many Haskell compilers have especially
I have a Haskell file which looks like this: longest::[Integer]->[Integer]->[Integer] max a b =
Is it possible to (ab)use Cabal to have it create a generic Haskell project
I have a problem compiling Haskell programs, that import the Text.Regex.Posix module. I have

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.