ghc

How can I disable Haskell warning in small block?

纵饮孤独 提交于 2019-12-10 01:04:45
问题 I want to disable warning only some block of code. I searched Google but only find file scope or global scope disable method. Using cabal file or pragma {-# OPTIONS_GHC #-} Can I disable warning for specific function? 回答1: No, you can't currently in GHC 8.8.1 The {-# OPTIONS_GHC #-} pragma is file-header only and applies to the whole module. And there are no such pragmas (or other ways) to suppress warnings in specific locations. You can check the full list of pragmas in the Haskell user

Cabal rebuild all with enable-shared flag

家住魔仙堡 提交于 2019-12-09 18:06:24
问题 I am having an issue with building a shared library with ghc and I think I need to rebuild my haskell packages with --enable-shared, is there an easy way to rebuild all of my packages with cabal with the flag --enable-shared? 回答1: If you have a ~/.cabal/world, cabal install --reinstall --enable-shared world could work, but test with the --dry-run flag first. That will, however only take care of cabal-installed packages. If you have packages installed with your distro's package manager, the

How do I uninstall older versions of GHC?

自闭症网瘾萝莉.ら 提交于 2019-12-09 17:30:15
问题 I installed Haskell Platform 7.10.3 on my mac and when it finished it said that it had detected older versions of GHC and to uninstall them, but how do I do that? I'm using a macbook air with OS X 10.11.3. 回答1: You can uninstall prior platforms by running uninstall-hs from the command line. You'll get an output like: -- Versions found on this system 7.10.3 -- To remove a version and all earlier: uninstall-hs thru VERSION -- To remove only a single version: uninstall-hs only VERSION And you

Dynamic Compilation in Haskell GHC API Error

夙愿已清 提交于 2019-12-09 16:55:34
问题 I have been trying to get some basic dynamic code compilation working using the GHC API by following a tutorial found here. This code: import GHC import GHC.Paths import DynFlags import Unsafe.Coerce main :: IO () main = defaultErrorHandler defaultDynFlags $ do func <- runGhc (Just libdir) $ do dflags <- getSessionDynFlags setSessionDynFlags dflags target <- guessTarget "Test.hs" Nothing addTarget target r <- load LoadAllTargets case r of Failed -> error "Compilation failed" Succeeded -> do m

zlib build error with GHC

橙三吉。 提交于 2019-12-09 15:03:06
问题 I'm using a VM with the following configuration: Arch Linux (3.0-ARCH kernel) GHC 7.0.3 cabal-install 0.10.2 Cabal library 1.10.1.0 When I try to build zlib using cabal... $ cabal install zlib I get the following output: Resolving dependencies... Downloading zlib-0.5.3.2... Configuring zlib-0.5.3.2... Preprocessing library zlib-0.5.3.2... Stream.hsc:86:21: error: missing binary operator before token "(" Stream.hsc: In function ‘main’: Stream.hsc:86:21: error: missing binary operator before

GHC version check in code

◇◆丶佛笑我妖孽 提交于 2019-12-09 14:47:37
问题 I'm contributing to Alex, and it obviously depends on a lot of libraries and should compile for a lot of versions. I need to use a function that is only available from GHC 7.6.1 to handle an error better. So I want to use an #if ... to import said function, else, I'll deal with the error differently. I've seen some: #if __GLASGOW_HASKELL__ >= 610 import Control.Exception ( bracketOnError ) #endif So I did: #if __GLASGOW_HASKELL__ >= 761 import Text.Read ( readMaybe ) #endif Thinking that 761

how can I build cabal-install on eeePc 701 / Ubuntu Netbook Remix 1.6 (Lucid)

谁都会走 提交于 2019-12-09 12:56:16
问题 Not a programming question, but the first time I see something like this. UNR 1.6 (based on Ubuntu 10.04) installs the 6.12.1 version of GHC. So, in order to build cabal-install-0.8.2, I have to install the libghc6- packages of parsec, mtl, network and zlib. Then, after launching 'sh ./bootstrap.sh', I get: Checking installed packages for ghc-6.12.1... parsec is already installed and the version is ok. network is already installed and the version is ok. Cabal is already installed and the

What happens to child threads when their parent dies in GHC Haskell?

☆樱花仙子☆ 提交于 2019-12-09 09:12:00
问题 The documentation for forkIO says GHC note: the new thread inherits the masked state of the parent (see mask). The newly created thread has an exception handler that discards the exceptions BlockedIndefinitelyOnMVar, BlockedIndefinitelyOnSTM, and ThreadKilled, and passes all other exceptions to the uncaught exception handler. Why does the child exception handler discard ThreadKilled ? Is there some connection between the two threads after they're created? What exactly happens when the parent

Is GHC's auto-derived `Eq` instance really *O(N)*?

China☆狼群 提交于 2019-12-09 08:43:23
问题 I just noticed while trying to learn to read GHC Core, that the automatically derived Eq instance for enum-style data types such as data EType = ETypeA | ETypeB | ETypeC | ETypeD | ETypeE | ETypeF | ETypeG | ETypeH deriving (Eq) seems to be transformed into a O(N) -like lookup when looking at GHC's core representation: $fEqEType_$c== = \ (a_ahZ :: EType) (b_ai0 :: EType) -> case a_ahZ of _ { ETypeA -> case b_ai0 of _ { ETypeA -> True; ETypeB -> False; ETypeC -> False; ETypeD -> False; ETypeE

Cross-compilation with GHC

别来无恙 提交于 2019-12-09 05:16:34
问题 Is it possible to do cross-compilation with the Glasgow Haskell Compiler for common architectures? If not, is this feature planned to be developed in the near future? 回答1: As of this moment (GHC 7.0) GHC does not support cross-compilation. As of 2013, "support for cross-compilation works reasonably well in GHC 7.8.1". See the status on the CrossCompilation wiki page. Discussion GHC has always supported self-cross-compilation (i.e. you can port GHC to a new architecture). However, GHC as a