haskell-suite / haskell-names Goto Github PK
View Code? Open in Web Editor NEWHaskell suite library for name resolution
Haskell suite library for name resolution
Such as
Warning: EModNotFound (ModuleName (SrcSpan {srcSpanFilename = "./GHC/Float/RealFracMethods.hs", srcSpanStartLine = 59, srcSpanStartColumn = 8, srcSpanEndLine = 59, srcSpanEndColumn = 19}) "GHC.Integer")
For some reason, the Monad
class is not in Prelude.names
. Solving #13 would definitely help investigating this.
Since dependency on Prelude is not manifested in module's imports directly, it may be incorrectly sorted topologically in Language.Haskell.Names.Recursive.groupModules
.
We don't add Prelude
to the output of getImports
because it returns [ImportDecl l]
, and we don't have any annotations for the virtual Prelude import. So we should change the type of getImports
somehow.
No two exported entities from the same namespace should have the same unqualified name.
So that users don't have to compile it themselves.
Implement correct scoping rules for arrows, i.e. the distinction between "compile-time" and "run-time" values.
Like in GHC:
Formally speaking, in Haskell 98, an entity (function, type or class) in a program is uniquely identified by the pair of the module name in which it is defined and its name. In GHC, an entity is uniquely defined by a triple: package, module, and name.
Right now we don't resolve/annotate types. Probably need to add another constructor (or several) to NameContext for that.
As suggested at OdHac, we should replace Scoped l
with (NameInfo, l)
.
Since that is what haskell-src-exts returns.
Example:
{-# LANGUAGE TypeFamilies #-}
module DataFamilies (
Vector,
ListLike(..)) where
data family Vector a
class ListLike a where
type I a
h :: a -> I a
Problem: type family I
is not exported.
Consider a type signature
foo :: T
Because foo
is a Name
, not QName
, but is in the ReferenceV
context, we currently do not annotate it. It is not clear how to do it properly — we don't want to do the same for Name
s inside QName
s, so we can't simply add a case for Name
s.
hs-gen-iface currently pretends to be GHC.
To stop this:
I got a travis build error on haskell-names, although the error is cut out (on my machine I have old versions of packages, I could try reproducing if it helps).
Maybe the latest version doesn't work with ghc 7.6?
https://travis-ci.org/emmanueltouzery/cigale-timesheet/builds/41687886
Downloading haskell-names-0.4.1...
Configuring haskell-names-0.4.1...
Building haskell-names-0.4.1...
Failed to install haskell-names-0.4.1
Last 10 lines of the build log ( /home/travis/.cabal/logs/haskell-names-0.4.1.log ):
in
c ParComp <| sc -: l <| scWithAllStmtss -: e
<*> T.sequenceA stmtss'
Proc l pat e
-> let scWithPat = ...
in c Proc <| sc -: l <| sc -: pat <| scWithPat -: e
RecConstr l qn fields
-> let scWc = ...
in c RecConstr <| sc -: l <| sc -: qn <| scWc -: fields
_ -> defaultRtraverse e sc }
The same variable shouldn't be bound:
Anywhere else?
Here is the error log, let me know if I can provide you with any more information:
Unpacking to haskell-names-0.3.1/
Resolving dependencies...
Configuring haskell-names-0.3.1...
Building haskell-names-0.3.1...
Preprocessing library haskell-names-0.3.1...
[ 1 of 20] Compiling Paths_haskell_names ( dist/build/autogen/Paths_haskell_names.hs, dist/build/Paths_haskell_names.o )
[ 2 of 20] Compiling Language.Haskell.Names.GlobalSymbolTable[boot] ( src/Language/Haskell/Names/GlobalSymbolTable.hs-boot, dist/build/Language/Haskell/Names/GlobalSymbolTable.o-boot )
[ 3 of 20] Compiling Language.Haskell.Names.Open.Derived ( src/Language/Haskell/Names/Open/Derived.hs, dist/build/Language/Haskell/Names/Open/Derived.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package hashable-1.1.2.5 ... linking ... done.
Loading package syb-0.3.7 ... linking ... done.
Loading package unordered-containers-0.2.3.3 ... linking ... done.
Loading package uniplate-1.6.11 ... linking ... done.
Loading package type-eq-0.3 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package traverse-with-class-0.1.1 ... linking ... done.
Loading package filepath-1.3.0.0 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package old-time-1.1.0.0 ... linking ... done.
Loading package unix-2.5.1.1 ... linking ... done.
Loading package directory-1.1.0.2 ... linking ... done.
Loading package process-1.1.0.1 ... linking ... done.
Loading package Cabal-1.14.0 ... linking ... done.
Loading package base-unicode-symbols-0.2.2.4 ... linking ... done.
Loading package transformers-base-0.4.1 ... linking ... done.
Loading package monad-control-0.3.2.1 ... linking ... done.
Loading package EitherT-0.2.0 ... linking ... done.
Loading package attoparsec-0.10.4.0 ... linking ... done.
Loading package blaze-builder-0.3.1.1 ... linking ... done.
Loading package dlist-0.5 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package time-1.4 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package aeson-0.6.2.0 ... linking ... done.
Loading package cpphs-1.17.1 ... linking ... done.
Loading package haskell-src-exts-1.14.0 ... linking ... done.
Loading package hse-cpp-0.1 ... linking ... done.
Loading package optparse-applicative-0.5.2.1 ... linking ... done.
Loading package tagged-0.7 ... linking ... done.
Loading package haskell-packages-0.2.3 ... linking ... done.
Loading package nats-0.1.2 ... linking ... done.
Loading package semigroups-0.9.2 ... linking ... done.
Loading package comonad-3.1 ... linking ... done.
Loading package transformers-compat-0.1.1.1 ... linking ... done.
Loading package contravariant-0.4.4 ... linking ... done.
Loading package distributive-0.3.1 ... linking ... done.
Loading package semigroupoids-3.1 ... linking ... done.
Loading package comonad-transformers-3.1 ... linking ... done.
Loading package data-lens-2.10.3 ... linking ... done.
Loading package data-lens-template-2.1.7 ... linking ... done.
[ 4 of 20] Compiling Language.Haskell.Names.Types ( src/Language/Haskell/Names/Types.hs, dist/build/Language/Haskell/Names/Types.o )
src/Language/Haskell/Names/Types.hs:137:1:
Warning: orphan instance: instance Typeable PackageIdentifier
src/Language/Haskell/Names/Types.hs:138:1:
Warning: orphan instance: instance Data PackageIdentifier
src/Language/Haskell/Names/Types.hs:139:1:
Warning: orphan instance: instance Typeable PackageName
src/Language/Haskell/Names/Types.hs:140:1:
Warning: orphan instance: instance Data PackageName
src/Language/Haskell/Names/Types.hs:141:1:
Warning: orphan instance: instance Data Version
[ 5 of 20] Compiling Language.Haskell.Names.Interfaces ( src/Language/Haskell/Names/Interfaces.hs, dist/build/Language/Haskell/Names/Interfaces.o )
[ 6 of 20] Compiling Language.Haskell.Names.SyntaxUtils ( src/Language/Haskell/Names/SyntaxUtils.hs, dist/build/Language/Haskell/Names/SyntaxUtils.o )
[ 7 of 20] Compiling Language.Haskell.Names.GlobalSymbolTable ( src/Language/Haskell/Names/GlobalSymbolTable.hs, dist/build/Language/Haskell/Names/GlobalSymbolTable.o )
[ 8 of 20] Compiling Language.Haskell.Names.ScopeUtils ( src/Language/Haskell/Names/ScopeUtils.hs, dist/build/Language/Haskell/Names/ScopeUtils.o )
[ 9 of 20] Compiling Language.Haskell.Names.LocalSymbolTable ( src/Language/Haskell/Names/LocalSymbolTable.hs, dist/build/Language/Haskell/Names/LocalSymbolTable.o )
[10 of 20] Compiling Language.Haskell.Names.RecordWildcards ( src/Language/Haskell/Names/RecordWildcards.hs, dist/build/Language/Haskell/Names/RecordWildcards.o )
[11 of 20] Compiling Language.Haskell.Names.GetBound ( src/Language/Haskell/Names/GetBound.hs, dist/build/Language/Haskell/Names/GetBound.o )
[12 of 20] Compiling Language.Haskell.Names.Open.Base ( src/Language/Haskell/Names/Open/Base.hs, dist/build/Language/Haskell/Names/Open/Base.o )
[13 of 20] Compiling Language.Haskell.Names.Open.Instances ( src/Language/Haskell/Names/Open/Instances.hs, dist/build/Language/Haskell/Names/Open/Instances.o )
[14 of 20] Compiling Language.Haskell.Names.Open ( src/Language/Haskell/Names/Open.hs, dist/build/Language/Haskell/Names/Open.o )
[15 of 20] Compiling Language.Haskell.Names.Annotated ( src/Language/Haskell/Names/Annotated.hs, dist/build/Language/Haskell/Names/Annotated.o )
[16 of 20] Compiling Language.Haskell.Names.Imports ( src/Language/Haskell/Names/Imports.hs, dist/build/Language/Haskell/Names/Imports.o )
[17 of 20] Compiling Language.Haskell.Names.ModuleSymbols ( src/Language/Haskell/Names/ModuleSymbols.hs, dist/build/Language/Haskell/Names/ModuleSymbols.o )
[18 of 20] Compiling Language.Haskell.Names.Exports ( src/Language/Haskell/Names/Exports.hs, dist/build/Language/Haskell/Names/Exports.o )
[19 of 20] Compiling Language.Haskell.Names.Recursive ( src/Language/Haskell/Names/Recursive.hs, dist/build/Language/Haskell/Names/Recursive.o )
[20 of 20] Compiling Language.Haskell.Names ( src/Language/Haskell/Names.hs, dist/build/Language/Haskell/Names.o )
In-place registering haskell-names-0.3.1...
Preprocessing test suite 'test' for haskell-names-0.3.1...
[1 of 1] Compiling Main ( tests/run.hs, dist/build/test/test-tmp/Main.o )
tests/run.hs:153:28:
Expecting one more argument to `Rec TestAnn'
In an expression type signature: Proxy (Rec TestAnn)
In the expression: Proxy :: Proxy (Rec TestAnn)
In the expression:
let ?c = Proxy :: Proxy (Rec TestAnn) in
let
one :: TestAnn a => a -> String
one a = flip F.foldMap (getAnn a) $ uncurry formatAnn
go :: Rec TestAnn a => a -> String
....
in go
Use the standard functions (getInterfaces
) for that.
$ cabal install 'optparse-applicative == 0.7.*' haskell-packages/ haskell-names/
Resolving dependencies...
In order, the following will be installed:
haskell-packages-0.2.3.1 (reinstall)
haskell-names-0.3.1 (reinstall) changes: data-lens-2.10.3 added,
data-lens-template-2.1.7 added, haskell-packages-0.2.3.1 added, tagged-0.6.1
-> 0.7
Warning: Note that reinstalls are always dangerous. Continuing anyway...
***snip***
Preprocessing library haskell-names-0.3.1...
[ 2 of 20] Compiling Language.Haskell.Names.GlobalSymbolTable[boot] ( src/Language/Haskell/Names/GlobalSymbolTable.hs-boot, dist/build/Language/Haskell/Names/GlobalSymbolTable.o-boot )
[ 3 of 20] Compiling Language.Haskell.Names.Open.Derived ( src/Language/Haskell/Names/Open/Derived.hs, dist/build/Language/Haskell/Names/Open/Derived.o )
***snip***
Loading package haskell-packages-0.2.3.1 ... linking ... ghc:
lookupSymbol failed in relocateSection (relocate external)
`_optparsezmapplicativezm0zi6zi0_OptionsziApplicativeziTypes_OptLong_con_info'
ghc: unable to load package `haskell-packages-0.2.3.1'
Failed to install haskell-names-0.3.1
cabal: Error: some packages failed to install:
haskell-names-0.3.1 failed during the building phase. The exception was:
ExitFailure 1
Note that fixities for both local and global symbols must be supported.
This includes:
NoImplicitPrelude
extensionThere's a strict upper bound of 1.6.2 right now, while version 1.6.7 is available.
I think we should split haskell-names into two packages:
The split is possible since the modules part doesn't really use the names part.
I feel that it'd make the modules easier to understand, use and maintain.
Here's how the modules would be divided between these packages:
Language.Haskell.Modules.Imports
Language.Haskell.Modules.Exports
Language.Haskell.Modules.ModuleSymbols
Language.Haskell.Modules.Recursive
Language.Haskell.Modules.Interfaces
Language.Haskell.Modules.Open
Language.Haskell.Modules.Open.Base
Language.Haskell.Modules.Open.Instances
Language.Haskell.Modules.Open.Derived
Language.Haskell.Modules.Annotated
Language.Haskell.Modules.LocalSymbolTable
Language.Haskell.Modules.GlobalSymbolTable
Language.Haskell.Modules.Types
Language.Haskell.Modules
Language.Haskell.Modules.SyntaxUtils
Language.Haskell.Modules.ScopeUtils
In
foo = ... foo ...
recursive occurrences of foo
are marked as local, because foo
is recorded in the local table.
OTOH in
foo = ... bar ...
bar = ... foo ...
recursive occurrences will be marked as global. It is of course inconsistent, but it's not clear how to resolve this.
type-eq 0.4.2 should work with all cpphs versions. type-eq 0.4.1 is broken for Mavericks users using the binary HP dist so haskell-names-0.2.3.6 is unbuildable for them.
Language.Haskell.Modules.*
-> Language.Haskell.Names.*
, to be consistent with the package name.
It's a bad name both for a haskell package (when it's released to hackage) and for a program.
Not sure how it should be called, though. haskell-names-gen-iface? hs-gen-iface? (where hs stands both for Haskell and Haskell suite)
If these are not fixed in a week's time, I'll have to drop these dependencies.
Look carefully what's not supported, create an issue and add to "known issues"
(haddock)
E.g. duplicate type signatures, infix declarations, value definitions, class or type definitions...
On a clean setup with the patched Cabal
ζ: cabal --version
cabal-install version 1.19.0
using version 1.19.0 of the Cabal library
ζ: ghc-pkg list haskell-names
/var/lib/ghc/package.conf.d
/home/stijn/.ghc/x86_64-linux-7.6.3/package.conf.d
haskell-names-0.3.1
ζ: hs-gen-iface --version
haskell-names 0.2
Based on haskell-packages version 0.2.3.1
I'm trying to generate interfaces. It's failing for array
because "TypeOperators is not enabled". To me, this sounds like a bug in or misuse of haskell-src-exts.
ζ: cabal install --haskell-suite -w hs-gen-iface array
Resolving dependencies...
Configuring array-0.4.0.1...
Building array-0.4.0.1...
Preprocessing library array-0.4.0.1...
Warning: Can't find file "MachDeps.h" in directories
./Data/Array
.
dist/build/autogen
dist/build
include
Asked for by: ./Data/Array/Base.hs at line 76 col 1
hs-gen-iface: ./Data/Array/Base.hs:256:37:
TypeOperators is not enabled
Failed to install array-0.4.0.1
cabal: Error: some packages failed to install:
array-0.4.0.1 failed during the building phase. The exception was:
ExitFailure 1
ζ: ~/.cabal/bin/cabal install primitive --haskell-suite -w hs-gen-iface
Resolving dependencies...
Configuring primitive-0.5.1.0...
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: primitive-memops.h
This problem can usually be solved by
[...]
the error messages.
Failed to install primitive-0.5.1.0
cabal: Error: some packages failed to install:
primitive-0.5.1.0 failed during the configure step. The exception was:
ExitFailure 1
When running with -v3, we see that HsFFI.h
isn't found:
("/usr/bin/gcc",["/tmp/17376.c","-o","/tmp/17376","-D__HASKELL_SUITE__","-Dlinux_HOST_OS=1","-Dx86_64_HOST_ARCH=1","-Idist/build/autogen","-Icbits","-I.","-O3","-ftree-vectorize","-fomit-frame-pointer","-msse2","-I/home/feuerbach/.cabal/lib/i386-linux-haskell-names-0.2/base-4.7.0.0/include","-O3","-ftree-vectorize","-fomit-frame-pointer","-msse2","-L/home/stijn/.cabal/share/x86_64-linux-ghc-7.6.3/haskell-names-0.3.1/libraries/base-4.7.0.0","-L/home/stijn/.cabal/share/x86_64-linux-ghc-7.6.3/haskell-names-0.3.1/libraries/integer-simple-0.1.1.0","-L/home/stijn/.cabal/share/x86_64-linux-ghc-7.6.3/haskell-names-0.3.1/libraries/ghc-prim-0.3.1.0"])
/usr/bin/gcc returned ExitFailure 1 with error message:
In file included from /tmp/17376.c:1:0:
cbits/primitive-memops.h:5:19: fatal error: HsFFI.h: No such file or directory
#include <HsFFI.h>
^
compilation terminated.
This problem doesn't occur during normal use of cabal-install. --extra-include-dirs=/usr/lib/ghc/include
is a quick fix to the problem.
E.g. module not found, identifier not in scope
Probably an oversight but currently it is not exported.
Try to fix as many as possible:
Warning: ./GHC/Exts.hs: 60: 9: not in scope: Constraint
Warning: ./GHC/IP.hs: 6: 16: not in scope: IP
Warning: ./Prelude.hs: 54: 10: not in scope: Integer
Warning: System/CPUTime.hsc: 23: 10: not in scope: getCPUTime
Warning: ./Data/Monoid.hs: 28: 9: ambiguous name Any
It may refer to:
ghc-prim-0.3.1.0:GHC.Prim.Any
Data.Monoid.Any
Warning: ./GHC/IO/FD.hs: 27: 9: ambiguous name FD
It may refer to:
System.Posix.Internals.FD
GHC.IO.FD.FD
Warning: ./Text/Read/Lex.hs: 41: 26: GHC.Num does not export Integer
Warning: ./GHC/Base.lhs: 124: 8: module not found: GHC.Integer
Warning: ./GHC/Enum.lhs: 32: 8: module not found: GHC.Integer
Warning: ./GHC/Float.lhs: 48: 8: module not found: GHC.Integer.Logarithms
Warning: ./GHC/Float.lhs: 49: 8: module not found: GHC.Integer.Logarithms.Internals
Warning: ./GHC/Float/ConversionUtils.hs: 26: 8: module not found: GHC.Integer
Warning: ./GHC/Float/RealFracMethods.hs: 59: 8: module not found: GHC.Integer
Warning: ./GHC/Num.lhs: 23: 8: module not found: GHC.Integer
For that, we need to pass the global symbol table to the resolver.
Resolving dependencies...
Configuring haskell-names-0.5.2...
Building haskell-names-0.5.2...
Preprocessing library haskell-names-0.5.2...
src/Language/Haskell/Names/Annotated.hs:5:27: Warning:
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
src/Language/Haskell/Names/Open/Base.hs:6:104: Warning:
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
[ 1 of 19] Compiling Paths_haskell_names ( dist/build/autogen/Paths_haskell_names.hs, dist/build/Paths_haskell_names.o )
[ 2 of 19] Compiling Language.Haskell.Names.Open.Derived ( src/Language/Haskell/Names/Open/Derived.hs, dist/build/Language/Haskell/Names/Open/Derived.o )
[ 3 of 19] Compiling Language.Haskell.Names.Types ( src/Language/Haskell/Names/Types.hs, dist/build/Language/Haskell/Names/Types.o )
src/Language/Haskell/Names/Types.hs:11:1: Warning:
The import of ‘Data.Traversable’ is redundant
except perhaps to import instances from ‘Data.Traversable’
To import instances alone, use: import Data.Traversable()
[ 4 of 19] Compiling Language.Haskell.Names.LocalSymbolTable ( src/Language/Haskell/Names/LocalSymbolTable.hs, dist/build/Language/Haskell/Names/LocalSymbolTable.o )
src/Language/Haskell/Names/LocalSymbolTable.hs:11:1: Warning:
The import of ‘Data.Monoid’ is redundant
except perhaps to import instances from ‘Data.Monoid’
To import instances alone, use: import Data.Monoid()
[ 5 of 19] Compiling Language.Haskell.Names.SyntaxUtils ( src/Language/Haskell/Names/SyntaxUtils.hs, dist/build/Language/Haskell/Names/SyntaxUtils.o )
[ 6 of 19] Compiling Language.Haskell.Names.GlobalSymbolTable ( src/Language/Haskell/Names/GlobalSymbolTable.hs, dist/build/Language/Haskell/Names/GlobalSymbolTable.o )
[ 7 of 19] Compiling Language.Haskell.Names.RecordWildcards ( src/Language/Haskell/Names/RecordWildcards.hs, dist/build/Language/Haskell/Names/RecordWildcards.o )
[ 8 of 19] Compiling Language.Haskell.Names.GetBound ( src/Language/Haskell/Names/GetBound.hs, dist/build/Language/Haskell/Names/GetBound.o )
[ 9 of 19] Compiling Language.Haskell.Names.Open.Base ( src/Language/Haskell/Names/Open/Base.hs, dist/build/Language/Haskell/Names/Open/Base.o )
src/Language/Haskell/Names/Open/Base.hs:15:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[10 of 19] Compiling Language.Haskell.Names.Open.Instances ( src/Language/Haskell/Names/Open/Instances.hs, dist/build/Language/Haskell/Names/Open/Instances.o )
src/Language/Haskell/Names/Open/Instances.hs:20:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[11 of 19] Compiling Language.Haskell.Names.Open ( src/Language/Haskell/Names/Open.hs, dist/build/Language/Haskell/Names/Open.o )
[12 of 19] Compiling Language.Haskell.Names.Annotated ( src/Language/Haskell/Names/Annotated.hs, dist/build/Language/Haskell/Names/Annotated.o )
src/Language/Haskell/Names/Annotated.hs:26:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[13 of 19] Compiling Language.Haskell.Names.Interfaces ( src/Language/Haskell/Names/Interfaces.hs, dist/build/Language/Haskell/Names/Interfaces.o )
src/Language/Haskell/Names/Interfaces.hs:23:1: Warning:
The import of ‘Data.Monoid’ is redundant
except perhaps to import instances from ‘Data.Monoid’
To import instances alone, use: import Data.Monoid()
src/Language/Haskell/Names/Interfaces.hs:28:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[14 of 19] Compiling Language.Haskell.Names.ScopeUtils ( src/Language/Haskell/Names/ScopeUtils.hs, dist/build/Language/Haskell/Names/ScopeUtils.o )
src/Language/Haskell/Names/ScopeUtils.hs:3:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[15 of 19] Compiling Language.Haskell.Names.Imports ( src/Language/Haskell/Names/Imports.hs, dist/build/Language/Haskell/Names/Imports.o )
src/Language/Haskell/Names/Imports.hs:14:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[16 of 19] Compiling Language.Haskell.Names.ModuleSymbols ( src/Language/Haskell/Names/ModuleSymbols.hs, dist/build/Language/Haskell/Names/ModuleSymbols.o )
[17 of 19] Compiling Language.Haskell.Names.Exports ( src/Language/Haskell/Names/Exports.hs, dist/build/Language/Haskell/Names/Exports.o )
src/Language/Haskell/Names/Exports.hs:6:1: Warning:
The import of ‘Control.Applicative’ is redundant
except perhaps to import instances from ‘Control.Applicative’
To import instances alone, use: import Control.Applicative()
[18 of 19] Compiling Language.Haskell.Names.Recursive ( src/Language/Haskell/Names/Recursive.hs, dist/build/Language/Haskell/Names/Recursive.o )
[19 of 19] Compiling Language.Haskell.Names ( src/Language/Haskell/Names.hs, dist/build/Language/Haskell/Names.o )
In-place registering haskell-names-0.5.2...
Preprocessing test suite 'test' for haskell-names-0.5.2...
tests/run.hs:2:33: Warning:
-XOverlappingInstances is deprecated: instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS
[1 of 1] Compiling Main ( tests/run.hs, dist/build/test/test-tmp/Main.o )
tests/run.hs:176:1:
Illegal equational constraint ModuleInfo m ~ [Symbol]
(Use GADTs or TypeFamilies to permit this)
When checking that ‘getAnnotated’ has the inferred type
getAnnotated :: forall (m :: * -> *).
(MonadIO m, MonadModule m, ModuleInfo m ~ [Symbol]) =>
FilePath -> m (Module (Scoped SrcSpan))
tests/run.hs:184:18:
No instance for (GTraversable (Rec TestAnn) (a0 (Scoped SrcSpan)))
arising from a use of ‘annotationTest’
The type variable ‘a0’ is ambiguous
Relevant bindings include
filesAndMods :: [(FilePath, a0 (Scoped SrcSpan))]
(bound at tests/run.hs:182:3)
Note: there are several potential instances:
instance (c0 a0, c0 b0) => GTraversable c0 (Either a0 b0)
-- Defined in ‘traverse-with-class-0.2.0.3:Data.Generics.Traversable.Instances’
instance c0 a0 => GTraversable c0 (Maybe a0)
-- Defined in ‘traverse-with-class-0.2.0.3:Data.Generics.Traversable.Instances’
instance GTraversable c (GHC.Real.Ratio n)
-- Defined in ‘traverse-with-class-0.2.0.3:Data.Generics.Traversable.Instances’
...plus 72 others
In the first argument of ‘uncurry’, namely ‘annotationTest’
In the first argument of ‘map’, namely ‘(uncurry annotationTest)’
In the second argument of ‘($)’, namely
‘map (uncurry annotationTest) filesAndMods’
Verified that Fay still works on both with awesome --allow-newer
. (I usually allow the odd numbered versions since they are never published)
Suppose, I have a very big haskell source tree that is not organized in packages and I want to do name resolution for the complete source tree "on the fly" (i.e., without relying on the .names
interface files, etc.). The obvious solution would then be something like this:
buildScopes :: [Module SrcSpanInfo] -> ModuleT [Symbol] IO [Module (Scoped SrcSpanInfo)]
buildScopes asts = do
void $ computeInterfaces Haskell2010 [] asts
mapM (annotateModule Haskell2010 []) asts
However, suppose this solution is too slow due to the haskell source tree (and its corresponding abstract syntax tree list) being very big. Is there any way in haskell-names (or maybe even haskell-suite) to make name resolution more efficient, e.g., by leveraging multiple CPU cores? Would (e.g.) haskell-names benefit from using the async and/or parallel packages to make computeInterfaces
and annotateModule
faster?
Or is this approach just completely wrong and I should perform name resolution only once and then store the resolved names in .names
files?
I'm not sure if this is the right place to ask, but I felt that asking the most knowledgeable people would make sense.
Esp. regarding imports/exports and annotations.
E.g. the class and methods aren't properly annotated atm
On a clean setup with the patched Cabal
ζ: cabal --version
cabal-install version 1.19.0
using version 1.19.0 of the Cabal library
ζ: ghc-pkg list haskell-names
/var/lib/ghc/package.conf.d
/home/stijn/.ghc/x86_64-linux-7.6.3/package.conf.d
haskell-names-0.3.1
ζ: hs-gen-iface --version
haskell-names 0.2
Based on haskell-packages version 0.2.3.1
I'm trying to generate interfaces.
ζ: cabal install --haskell-suite -w hs-gen-iface transformers
Resolving dependencies...
Configuring transformers-0.3.0.0...
Building transformers-0.3.0.0...
Preprocessing library transformers-0.3.0.0...
hs-gen-iface: BadInterface "/home/stijn/.cabal/share/x86_64-linux-ghc-7.6.3/haskell-names-0.3.1/libraries/base-4.7.0.0/Control/Applicative.names" "mzero"
Failed to install transformers-0.3.0.0
cabal: Error: some packages failed to install:
transformers-0.3.0.0 failed during the building phase. The exception was:
ExitFailure 1
I've found the same problem when using haskell-names
in my own project. I've tracked the mzero
down to the instance FromJSON name => FromJSON (SymTypeInfo name)
, where entity
turns out to be "selector"
.
The external JSON should be easy to read, which is currently not given, as the default JSON encoding of tuples results in arrays.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.