lukexi / halive

Live recompiler for Haskell
BSD 2-Clause "Simplified" License
263 stars 18 forks source link

`default-extensions` from cabal file is not taken #26

Open kayhide opened 7 years ago

kayhide commented 7 years ago

With a new stack project, this code works fine with halive.

Lib.hs

{-# LANGUAGE TupleSections #-}
module Lib
    ( someFunc
    ) where

someFunc :: IO ()
someFunc = print $ (3,) 4

But when moving the language pragma from the source file to cabal settings like:

library
  hs-source-dirs:      src
  exposed-modules:     Lib
  ...
  default-extensions:  TupleSections

Despite stack build success, halive fails to compile saying:

************************* Compilation Errors, Waiting...      *************************

src/Lib.hs:6:20: error: Illegal tuple section: use TupleSections

Is there any way to make this work? Maybe, a way of providing default extensions to halive?

I have tried this with the head of master of this repository (a1ddda47b348c212ffbcb63881eb0fc2779cb828).

Thanks.

schell commented 7 years ago

Tricky! Nice find.

On May 12, 2017, at 2:02 AM, kayhide notifications@github.com wrote:

With a new stack project, this code works fine with halive.

Lib.hs

{-# LANGUAGE TupleSections #-} module Lib ( someFunc ) where

someFunc :: IO () someFunc = print $ (3,) 4 But when moving the language pragma from the source file to cabal settings like:

library hs-source-dirs: src exposed-modules: Lib ... default-extensions: TupleSections Despite stack build success, halive fails to compile saying:

Compilation Errors, Waiting...

src/Lib.hs:6:20: error: Illegal tuple section: use TupleSections Is there any way to make this work? Maybe, a way of providing default extensions to halive?

I have tried this with the head of master of this repository (a1ddda4 https://github.com/lukexi/halive/commit/a1ddda47b348c212ffbcb63881eb0fc2779cb828).

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lukexi/halive/issues/26, or mute the thread https://github.com/notifications/unsubscribe-auth/AABhbtGyWOWgJ-xnKfpf2-YkkNZ-osJ4ks5r5CASgaJpZM4NZBYF.

saschaheylik commented 3 years ago

I implemented a solution allowing you to set project-wide GHC extensions in a configuration file in my fork.