ghc

Undefined symbol in a Hackage package `double-conversion`

大憨熊 提交于 2019-12-23 10:26:11
问题 I'm trying to build the double-conversion package from Hackage. It builds OK but ghci can't load it. The complaint is: Loading package double-conversion-0.2.0.0 ... linking ... <interactive>: /home/me/.cabal/lib/double-conversion-0.2.0.0/ghc-7.0.4/HSdouble-conversion-0.2.0.0.o: unknown symbol `_ZNK17double_conversion6Double5valueEv' The nm output shows that the symbol is weak : nm /home/me/.cabal/lib/double-conversion-0.2.0.0/ghc-7.0.4/HSdouble-conversion-0.2.0.0.o \ | grep _ZNK17double

ghc 7.10.2 type families extension doesn't work

倖福魔咒の 提交于 2019-12-23 10:09:23
问题 I'm getting parse error on input ‘where’ when trying the following example in GHC 7.10.2: {-# LANGUAGE TypeFamilies #-} type family F a :: * type instance where F (Maybe Int) = Int F (Maybe Bool) = Bool F (Maybe a) = String Same question was asked two years ago about GHC 7.4.2. I used type families fine with GHC 7.6.* (can't remember last digit) this year. Is it a problem with GHC 7.10.2? According to the User's Guide, type families are available. My GHC 7.10.2 and cabal 1.22.6.0 where

ghc-7.6 class instances for dependent types

自闭症网瘾萝莉.ら 提交于 2019-12-23 09:29:45
问题 Heterogeneous lists are one of the examples given for the new dependent type facility of ghc 7.6: data HList :: [*] -> * where HNil :: HList '[] HCons:: a -> HList t -> HList (a ': t) The example list "li" compiles fine: li = HCons "Int: " (HCons 234 (HCons "Integer: " (HCons 129877645 HNil))) Obviously we would like HList to be in the Show class, but I can only come up with the following working class instantiation that uses mutually recursive constraints (superclasses): instance Show (HList

Haskell: use last reference to a variable to efficiently create a new variable

别说谁变了你拦得住时间么 提交于 2019-12-23 08:53:23
问题 This C code can conceptually be described as creating a new array identical to an input array but with 1 as the first element: int* retire_and_update(int* arr) { arr[0] = 1; return arr; } This is a pure function (wink wink nudge nudge) so long as no further references are made to the input array and its elements. The C type system won't enforce that for us but it seems enforceable in principle. The code that gcc generates is simple and efficient: retire_and_update: movq %rdi, %rax movl $1, (

Type application with ambiguous types

隐身守侯 提交于 2019-12-23 07:59:27
问题 I recently discovered -XTypeApplications , which allows me to write abbreviate my code. Consider the following: {-# LANGUAGE AllowAmbiguousTypes, DataKinds, KindSignatures, RankNTypes, ScopedTypeVariables, TypeApplications #-} import Data.Tagged import Data.Proxy class Foo (a :: Bool) where foo :: Tagged a Int instance Foo 'True where foo = 3 instance Foo 'False where foo = 4 instead of writing proxy foo (Proxy::Proxy 'True) , I can now write untag $ foo @'True , which saves me a lot of Proxy

Dead code and/or how to generate a cross reference from Haskell source

喜你入骨 提交于 2019-12-23 07:57:55
问题 I've got some unused functionality in my codebase, but it's hard to identify. The code has evolved over the last year as I explore its problem space and possible solutions. What I'm needing to do is find that unused code so I can get rid of it. I'm happy if it deals with the problem on an exportable name basis.GHC has warnings that deal with non-exported unused code. Any tools specific to this task would be of interest. However, I'm curious about a comprehensive cross referencing tool. I can

Problem Specifying Source Directory to GHC

那年仲夏 提交于 2019-12-23 07:33:31
问题 This is an embarrassingly simple problem, but its solution yet eludes me. As the title indicates, I simply want to specify to GHC the location of all my source files. This should be simple; the GHC user guide: -i dirs This flag appends a colon-separated list of dirs to the search path. So, I tried the following invocations: ghc -isrc/ -v -outputdir build/ --make -Wall Main.hs ghc -isrc/: -v -outputdir build/ --make -Wall Main.hs ghc -i:src/: -v -outputdir build/ --make -Wall Main.hs ghc -i

Problem Specifying Source Directory to GHC

不想你离开。 提交于 2019-12-23 07:31:28
问题 This is an embarrassingly simple problem, but its solution yet eludes me. As the title indicates, I simply want to specify to GHC the location of all my source files. This should be simple; the GHC user guide: -i dirs This flag appends a colon-separated list of dirs to the search path. So, I tried the following invocations: ghc -isrc/ -v -outputdir build/ --make -Wall Main.hs ghc -isrc/: -v -outputdir build/ --make -Wall Main.hs ghc -i:src/: -v -outputdir build/ --make -Wall Main.hs ghc -i

How to use GADTs in Hugs

帅比萌擦擦* 提交于 2019-12-23 01:40:11
问题 I'd like to write a Haskell program that uses GADTs interactively on a platform not supported by GHCi (namely, GNU/Linux on mipsel). The problem is, the construct that can be used to define a GADT in GHC, for example: data Term a where Lit :: Int -> Term Int Pair :: Term a -> Term b -> Term (a,b) ... doesn't seem working on Hugs. Can't GADTs really be defined in Hugs? My TA at a Haskell class said it was possible in Hugs, but he seemed unsure. If not, can GADT be encoded by using other syntax

Trouble Installing HTF with Cabal

守給你的承諾、 提交于 2019-12-22 09:27:54
问题 I am trying to install HTF. However after I cabal install HTF I get this: Resolving dependencies... Configuring HTF-0.10.0.7... Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package regex-base-0.93.2 requires mtl-2.0.1.0 package aeson-0.6.0.2 requires mtl-2.1.2 package HTF-0.10.0.7 requires mtl-2.1.2 package mtl-2.0.1.0 requires transformers-0.2.2.0 package transformers-base-0.4.1 requires transformers-0.3