2

I would like to add an extra switch "-XDeriveDataTypeable" to the compiler.

Otherwise, I would like to able to compile Typeable.

Where can i do that in Leksah?

Aftershock
  • 5,205
  • 4
  • 51
  • 64
  • 2
    if -1 is supposed to be feedback, | do not know what it is about.. It is prerty useless in itself. – Aftershock Apr 29 '14 at 11:20
  • I haven't used Leksah, but I would expect the pragma to work? Doesn't adding ```{-# LANGUAGE DeriveDataTypeable #-}``` on the first line of your .hs file work? – iamnat Apr 29 '14 at 11:27
  • 2
    I disagree with the downvotes; I'm guessing people who voted to close don't know that "-X something-or-other" **is** sufficient information to diagnose the problem because they don't know what `-X` means; the classic "I don't understand therefore this is unclear" logical error. – AndrewC Apr 29 '14 at 11:28

1 Answers1

5

Generally

Here's a editor/ide-agnostic solution to your problem:

For language extensions, you can add this at the top of the source as a compiler pragma, which I prefer anyway:

{-# LANGUAGE DeriveDataTypeable #-}

instead of -XDeriveDataTypeable on the command line

You can pass other command line options to GHC, like this:

{-# OPTIONS_GHC -fno-warn-name-shadowing #-}

In Leksah

Leksah uses cabal for build configuration, so there's no special Leksah magic, that's all standard, but you can use the package editor as a GUI to edit the cabal file.

2/3 of the way down is the Extensions section where you can specify what language extensions you want.

package editor

AndrewC
  • 32,300
  • 7
  • 79
  • 115
  • SO there is no place within GUI to add extra flags? – Aftershock Apr 29 '14 at 12:57
  • @Aftershock Yes there is. In the package editor (screenshot above) click extensions and add the DeriveDataTypeable extension there. I'm not sure whether you need to put `-XDeriveDataTypeable` or just `DeriveDataTypeable` - try both. For other compiler flags, go in package flags [screenshot here](http://code.haskell.org/leksah/leksah/doc/screenshots2/screenshot_package_flags.png) - the example shows `-prof` and `-auto-all`. – AndrewC Apr 29 '14 at 15:48
  • @Aftershock I still prefer putting it in the source code, because it's more self-contained and other folk with your `.hs` file get the right compiler flags for free. – AndrewC Apr 29 '14 at 15:49
  • That is good, I asked because I thought it would be good to know how it works anyway – Aftershock Apr 29 '14 at 15:56