ghc

Cabal rebuild all with enable-shared flag

女生的网名这么多〃 提交于 2019-12-04 06:15:48
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? 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 distro might also provide shared versions for those (otherwise, you'd have to do it manually). Also, it would

Haskell environment hosed post reinstall

北慕城南 提交于 2019-12-04 05:28:52
问题 I've recently reinstalled my Haskell environment as I thought I had hosed it beyond recovery after updating my Mac OS X to Mavericks. Now every time I run cabal install cabal-install , I get the following error. Resolving dependencies... Configuring cabal-install-1.18.0.3... /var/folders/4l/qbdvy5xj4q53skv0zn0lhw940000gp/T/8247.c:1:12: warning: control reaches end of non-void function [-Wreturn-type] int foo() {} ^ 1 warning generated. Building cabal-install-1.18.0.3... Preprocessing

Dynamic Compilation in Haskell GHC API Error

拥有回忆 提交于 2019-12-04 05:05:10
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 <- findModule (mkModuleName "Test") Nothing setContext [] [m] value <- compileExpr ("Test.print") do

How do I uninstall older versions of GHC?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 04:57:34
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. 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 can proceed from there... 来源: https://stackoverflow.com/questions/37034915/how-do-i-uninstall-older-versions

Warning on specialisations when compiling Haskell Code with ghc

可紊 提交于 2019-12-04 04:54:02
I get the following error when trying to compile $ ghc --make -O2 -Wall -fforce-recomp [1 of 1] Compiling Main ( isPrimeSmart.hs, isPrimeSmart.o ) SpecConstr Function `$wa{v s2we} [lid]' has two call patterns, but the limit is 1 Use -fspec-constr-count=n to set the bound Use -dppr-debug to see specialisations Linking isPrimeSmart ... My code is: {-# OPTIONS_GHC -O2 -optc-O2 #-} import qualified Data.ByteString.Lazy.Char8 as StrL -- StrL is STRing Library import Data.List -- read in a file. First line tells how many cases. Each case is on a separate -- line with the lower an upper bounds

Even more generalized newtype deriving

雨燕双飞 提交于 2019-12-04 03:58:36
Newtypes are often used to change the behavior of certain types when used in certain class contexts. For example, one would use the Data.Monoid.All wrapper to change the behavior of Bool when used as a Monoid . I'm currently writing such a newtype wrapper that would apply to a large range of different types. The wrapper is supposed to change the behavior of one specific class instance. It might look like this: newtype Wrapper a = Wrapper a instance Special a => Special (Wrapper a) where -- ... However, adding this wrapper will often change the usability of the wrapped type. For example, if I

Temporal correlations when employing System.Random (not present when employing System.Random.TF)

我是研究僧i 提交于 2019-12-04 03:27:52
问题 This question concerns the origins of temporal correlations one observes with System.Random when one generates successive randoms from successive seeds (where one discards the same number of generators for each seed). In Using mkStdGen from System.Random to generate random booleans Answer 1 and Using mkStdGen from System.Random to generate random booleans Answer 2 it was suggested (based on the reddit article referenced theirin) that the first few generators should be discarded in order to

Why is an explicit type NOT required for basic Prelude arithmetic?

a 夏天 提交于 2019-12-04 03:19:29
问题 I was answering a question and wrote some code to get the job done. isPrime :: Int -> Bool isPrime n = primeCheck n $ floor $ sqrt $ (fromIntegral n :: Double) I assumed that the explicit type signature would be required, as explained in my answer. Then I checked it in both GHC and GHCi and discovered that I did not need the explicit type for the conversion despite floor and sqrt being polymorphic. I know GHCi does does some type defaulting, but I'm not aware of any in GHC. Obviously both

ghc 7.4.1 not producing stub.o files

跟風遠走 提交于 2019-12-04 03:17:11
问题 I'm running the default installation of Haskell platform on Ubuntu and when I run this example http://www.haskell.org/haskellwiki/Calling_Haskell_from_C "ghc -c -O Safe.hs" is not producing the Safe_stub.o file. I have checked this on a separate installation of Ubuntu on a friends box and on both 32 bit and 64 bit Ubuntu installs. Can somebody confirm if this is specific to ghc-7.4.1 or Ubuntu installs only? Thanks! 回答1: It's a ghc-7.4 ( ghc >= 7.2 actually) thing. That doesn't need and

Can GHC link binaries against a libc implementation such as uclibc (used in OpenWrt by default)?

拈花ヽ惹草 提交于 2019-12-04 02:59:46
I am using Debian/MIPS+QEMU to build MIPS ports of PortFusion (a TCP tunneling solution). The resulting binaries are linked against GNU libc. Thus, they cannot be just copied over and used on vanilla OpenWrt which ships with uclibc instead of eglibc (which seems binary-compatible with GNU libc). Is there a way to link Haskell/GHC binaries on Debian/MIPS against uclibc instead of eglibc ? Can OpenWrt's using uclibc be really the reason why PortFusion binaries copied over from Debian fail to run with -ash: binary not found or can this message be due to something entirely else? See https://github