ghc

Linking a dynamic library (libjvm.dylib) in Mac OS X (rpath issue)

拟墨画扇 提交于 2019-12-04 02:31:49
I do have an application that requires linkage with libjvm (a library from the JDK needed to do JNI bindings). When I tell the location of libjvm.dylib using -L it successfully compiles and links. However when I run the binary I get: dyld: Library not loaded: @rpath/libjvm.dylib Referenced from: <my home directory>/./mybinary Reason: image not found So far I found out that I can run my binary specifying LD_LIBRARY_PATH like so: LD_LIBRARY_PATH=<path to libfolder installation> ./mybinary But of course I do not want that. Why should I specify the exact location anyway if I have to give it again

What are the differences between inline-c and language-c-inline?

柔情痞子 提交于 2019-12-04 02:24:25
I've been briefly looking into quasi-quotation libraries for Haskell. These libraries allow Haskell to integrate with other languages. For integrating with C, there appears to be two packages with similar functionality: inline-c language-c-inline (which uses language-c-quote ) As I'm looking to build a quasi-quotation library of my own, I'm interested in design choices, API differences, performance etc. The only difference I'm aware of is that language-c-quote supports C and Objective-C, whereas inline-c supports C. How would you distinguish these packages? What are the fundamental differences

How to customize Readline keybindings of GHCi?

半腔热情 提交于 2019-12-04 02:04:30
I know GHCi supports Readline, and keybindings such as ^W and ^U work as expected. I do wonder whether ghci support customization of keybindings the way Bash deals with inputrc. What is your GHC version? GHCi stopped using readline and started using libedit around 6.10 and haskeline around 6.12. libedit can be configured in ~/.editrc ; similarly, Haskeline has ~/.haskeline . For example, I have # ~/.editrc (for libedit) edit on bind ^R em-inc-search-prev bind ^S em-inc-search-next bind ^[[5~ ed-search-prev-history bind ^[[6~ ed-search-next-history to match my # ~/.inputrc (for readline) "\e[5~

'Failed to load interface' error when loading compiled modules in ghci

拥有回忆 提交于 2019-12-04 01:35:18
Hello Haskell community, I'm new to Haskell and ran into a problem when I tried to structure my first bigger project. Here's the minimal example of the problem (I'm using cabal to build). This is the directory structure of a simple module: FooMod1 |- FooMod1.cabal |- Setup.hs |- src |- FooMod1.hs |- FooMod1 |- C1.hs |- T1.hs The source for FooMod1.hs: module FooMod1 ( C1(..) , T1(..) , ) where import FooMod1.C1 import FooMod1.T1 The source for C1.hs: module FooMod1.C1 ( C1(..) ) where class C1 a where c1FooFun :: a -> IO () The source for T1.hs: module FooMod1.T1 ( T1(..) ) where import

Does Travis ci allow ghc versions larger than 7.8?

核能气质少年 提交于 2019-12-04 01:25:55
I just created a Haskell Travis CI project with this .travis.yml : language: haskell ghc: - 7.8 - 7.10 But Travis interprets the second version as 7.1 : https://travis-ci.org/fhaust/dtw/jobs/57648139 The version is only recognized if I enclose it in quotes (though this results in other errors, since 7.10 is not a version available on Travis CI): language: haskell ghc: - 7.8 - "7.10" Is this a bug? Edit 2015-11-22 There is an open issue for GHC 7.10 on travis-ci: https://github.com/travis-ci/travis-ci/issues/3785 It's not a bug, it's a consequence of using YAML files for config: YAML parses 7

GHC version check in code

别说谁变了你拦得住时间么 提交于 2019-12-04 00:48:52
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 is an alias to GHC version 7.6.1 , when I build the cabal package and try it out, the function doesn't

Can I get warnings about overly-restrictive type signatures?

久未见 提交于 2019-12-04 00:37:51
Can GHC or some lint tool tell me when I've provided a type signature for a function that could be more polymorphic? GHC doesn't do this, and a quick search of Hackage turns up nothing. A simple, but possibly quite effective way to implement such a thing would be to load the module in GHCi, use :browse to get all the type signatures, then load a copy without any type signatures, use :browse again, and compare the two outputs; then just print all the lines that differ beyond parentheses, whitespace and alpha-renaming. However, this wouldn't work perfectly, especially if you have definitions

Pattern matching on rank-2 type

半腔热情 提交于 2019-12-03 23:22:54
I'm trying to understand why one version of this code compiles, and one version does not. {-# LANGUAGE RankNTypes, FlexibleContexts #-} module Foo where import Data.Vector.Generic.Mutable as M import Data.Vector.Generic as V import Control.Monad.ST import Control.Monad.Primitive data DimFun v m r = DimFun {dim::Int, func :: v (PrimState m) r -> m ()} runFun1 :: (Vector v r, MVector (Mutable v) r) => (forall m . (PrimMonad m) => DimFun (Mutable v) m r) -> v r -> v r runFun1 (DimFun dim t) x | V.length x == dim = runST $ do y <- thaw x t y unsafeFreeze y runFun2 :: (Vector v r, MVector (Mutable

How do I get the OverloadedStrings language extension working?

半世苍凉 提交于 2019-12-03 22:10:41
I've enabled overloaded strings, but I can't get them to work: $ cat overloadedstrings.hs {-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL lazy :: BL.ByteString lazy = "I'm a lazy ByteString" strict :: B.ByteString strict = "I'm a strict ByteString" $ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :l overloadedstrings.hs [1 of 1] Compiling Main (

Compiling ghc with -fPIC support

99封情书 提交于 2019-12-03 20:37:04
问题 I'm trying to install GHC with -fPIC support in Fedora. I've grabbed a source tarball since it seems no binary one has this. In Build.mk i've changed the quick build type to ifeq "$(BuildFlavour)" "quick" SRC_HC_OPTS = -H64m -O0 -fasm -fPIC GhcStage1HcOpts = -O -fasm -fPIC GhcStage2HcOpts = -O0 -fasm -fPIC GhcLibHcOpts = -O -fasm -fPIC SplitObjs = NO HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO endif unfortunately, when compiling i still get the ld