Superclass Cycle via Associated Type

2011-07-20 Thread Ryan Trinkle
The following code doesn't compile, but it seems sensible enough to me.  Is
this a limitation of GHC or is there something I'm missing?

class C (A x) = C x where
  type A x :: *
instance C Int where
  type A Int = String
instance C String where
  type A String = Int


The error I get is:


SuperclassCycle.hs:1:1:
Cycle in class declarations (via superclasses):
  SuperclassCycle.hs:(1,1)-(2,15): class C (A x) = C x where {
   type family A x :: *; }



Ryan
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: HEAD doesn't not build on OS X

2011-07-20 Thread Johan Tibell
Still broken, but now for some other reason:

inplace/bin/ghc-stage1 -optc-Wall -optc-Wextra
-optc-Wstrict-prototypes -optc-Wmissing-prototypes
-optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return
-optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs
-optc-Wredundant-decls -optc-Iincludes -optc-Irts -optc-DCOMPILING_RTS
-optc-fno-strict-aliasing -optc-fno-common -optc-Ilibffi/build/include
-optc-DDTRACE -optc-fomit-frame-pointer -optc-DRtsWay=\rts_v\
-H64m -O -fasm -Iincludes -Irts -DCOMPILING_RTS -package-name rts
-dcmm-lint  -Ilibffi/build/include -DDTRACE -i -irts
-irts/dist/build -irts/dist/build/autogen -Irts/dist/build
-Irts/dist/build/autogen   -optc-O2   -c rts/ClosureFlags.c -o
rts/dist/build/ClosureFlags.o
In file included from rts/Schedule.h:15,

 from rts/Capability.c:23:0:
rts/Trace.h: In function ‘traceSparkCounters’:

rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’

rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’

rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’

rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’

rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’

rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’

rts/Trace.h:516:0:
 warning: implicit declaration of function ‘sparkPoolSize’

rts/Trace.h:516:0:
 warning: nested extern declaration of ‘sparkPoolSize’

rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘sparks’
make[1]: *** [rts/dist/build/Capability.o] Error 1
make[1]: *** Waiting for unfinished jobs
make: *** [all] Error 2

On Tue, Jul 19, 2011 at 9:55 PM, Johan Tibell johan.tib...@gmail.com wrote:
 Duncan, could you please take a look.

 On Tue, Jul 19, 2011 at 9:51 PM, Johan Tibell johan.tib...@gmail.com wrote:
 I just unpulled all the new GHC event patches, starting with
 d77df1caad3a5f833aac9275938a0675e1ee6aac, and the build is chugging
 along.

 On Tue, Jul 19, 2011 at 8:38 PM, Johan Tibell johan.tib...@gmail.com wrote:
 While trying to build head (from a maintainer-clean tree) I get the
 following error:

 echo compiler_stage1_depfile_haskell_EXISTS = YES 
 compiler/stage1/build/.depend-v.haskell.tmp
 for dir in compiler/stage1/build/./ compiler/stage1/build/Llvm/
 compiler/stage1/build/LlvmCodeGen/ compiler/stage1/build/PPC/
 compiler/stage1/build/RegAlloc/ compiler/stage1/build/RegAlloc/Graph/
 compiler/stage1/build/RegAlloc/Linear/
 compiler/stage1/build/RegAlloc/Linear/PPC/
 compiler/stage1/build/RegAlloc/Linear/SPARC/
 compiler/stage1/build/RegAlloc/Linear/X86/
 compiler/stage1/build/SPARC/ compiler/stage1/build/SPARC/CodeGen/
 compiler/stage1/build/Vectorise/
 compiler/stage1/build/Vectorise/Builtins/
 compiler/stage1/build/Vectorise/Monad/
 compiler/stage1/build/Vectorise/Type/
 compiler/stage1/build/Vectorise/Utils/ compiler/stage1/build/X86/; do
 if test ! -d $dir; then mkdir -p $dir; fi done
 grep -v ' : [a-zA-Z]:/' compiler/stage1/build/.depend-v.haskell.tmp 
 compiler/stage1/build/.depend-v.haskell
 /usr/sbin/dtrace -Iincludes -Irts -Ilibffi/build/include -C -x
 cpppath=/usr/bin/gcc -h -o rts/dist/build/RtsProbes.h -s
 rts/RtsProbes.d
 . includes/HsFFI.h
 .. includes/ghcconfig.h
 ... includes/ghcautoconf.h
 ... includes/ghcplatform.h
 .. includes/stg/Types.h
 .. /usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h
 .. /usr/lib/gcc/i686-apple-darwin10/4.2.1/include/float.h
 . includes/rts/EventLogFormat.h
 dtrace: failed to compile script rts/RtsProbes.d: line 71: parameter
 is already declared in probe input prototype: StgWord, parameter #6
 make[1]: *** [rts/dist/build/RtsProbes.h] Error 1
 make: *** [all] Error 2




___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Superclass Cycle via Associated Type

2011-07-20 Thread Anupam Jain
On Wed, Jul 20, 2011 at 10:07 PM, Ryan Trinkle ryant5...@gmail.com wrote:

 The following code doesn't compile, but it seems sensible enough to me.  Is
 this a limitation of GHC or is there something I'm missing?

 class C (A x) = C x where
   type A x :: *


Did you mean

class (A x) = C x where
type A x :: *

-- Anupam
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Superclass Cycle via Associated Type

2011-07-20 Thread Dan Doel
This isn't a GHC limitation. The report specifies that the class
hierarchy must be a DAG. So C cannot require itself as a prerequisite,
even if it's on a 'different' type.

Practically, in the implementation strategy that GHC (and doubtless
other compilers) use, the declaration:

class C (A x) = C x ...

means that a C x dictionary contains a C (A x) dictionary, which
contains a C (A (A x)) dictionary And dictionaries are strictly
evaluated, so this sort of infinite definition cannot work.

-- Dan

On Wed, Jul 20, 2011 at 12:37 PM, Ryan Trinkle ryant5...@gmail.com wrote:
 The following code doesn't compile, but it seems sensible enough to me.  Is
 this a limitation of GHC or is there something I'm missing?

 class C (A x) = C x where
   type A x :: *

 instance C Int where
   type A Int = String

 instance C String where
   type A String = Int

 The error I get is:

 SuperclassCycle.hs:1:1:
 Cycle in class declarations (via superclasses):
   SuperclassCycle.hs:(1,1)-(2,15): class C (A x) = C x where {
type family A x :: *; }


 Ryan

 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: HEAD doesn't not build on OS X

2011-07-20 Thread David Peixotto
I've attached a small patch that seems to fix the build. The problem was that 
the `dtraceSparkCounters` function was getting called even when we were not 
compiling for the threaded rts. The patch just moves the call inside the #ifdef 
for the threaded rts.

The call had been placed outside the #ifdef for the
THREADED_RTS symbol which caused a compile error since
the spark_stats field of a capability is only available when
compiling for the threaded rts.



0001-Only-call-dtraceSparkCounters-in-threaded-rts.patch
Description: Binary data


On Jul 20, 2011, at 1:29 PM, Johan Tibell wrote:

 Still broken, but now for some other reason:
 
 inplace/bin/ghc-stage1 -optc-Wall -optc-Wextra
 -optc-Wstrict-prototypes -optc-Wmissing-prototypes
 -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return
 -optc-Wpointer-arith -optc-Wmissing-noreturn -optc-Wnested-externs
 -optc-Wredundant-decls -optc-Iincludes -optc-Irts -optc-DCOMPILING_RTS
 -optc-fno-strict-aliasing -optc-fno-common -optc-Ilibffi/build/include
 -optc-DDTRACE -optc-fomit-frame-pointer -optc-DRtsWay=\rts_v\
 -H64m -O -fasm -Iincludes -Irts -DCOMPILING_RTS -package-name rts
 -dcmm-lint  -Ilibffi/build/include -DDTRACE -i -irts
 -irts/dist/build -irts/dist/build/autogen -Irts/dist/build
 -Irts/dist/build/autogen   -optc-O2   -c rts/ClosureFlags.c -o
 rts/dist/build/ClosureFlags.o
 In file included from rts/Schedule.h:15,
 
 from rts/Capability.c:23:0:
 rts/Trace.h: In function ‘traceSparkCounters’:
 
 rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’
 
 rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’
 
 rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’
 
 rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’
 
 rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’
 
 rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘spark_stats’
 
 rts/Trace.h:516:0:
 warning: implicit declaration of function ‘sparkPoolSize’
 
 rts/Trace.h:516:0:
 warning: nested extern declaration of ‘sparkPoolSize’
 
 rts/Trace.h:516:0:
 error: ‘Capability’ has no member named ‘sparks’
 make[1]: *** [rts/dist/build/Capability.o] Error 1
 make[1]: *** Waiting for unfinished jobs
 make: *** [all] Error 2
 
 On Tue, Jul 19, 2011 at 9:55 PM, Johan Tibell johan.tib...@gmail.com wrote:
 Duncan, could you please take a look.
 
 On Tue, Jul 19, 2011 at 9:51 PM, Johan Tibell johan.tib...@gmail.com wrote:
 I just unpulled all the new GHC event patches, starting with
 d77df1caad3a5f833aac9275938a0675e1ee6aac, and the build is chugging
 along.
 
 On Tue, Jul 19, 2011 at 8:38 PM, Johan Tibell johan.tib...@gmail.com 
 wrote:
 While trying to build head (from a maintainer-clean tree) I get the
 following error:
 
 echo compiler_stage1_depfile_haskell_EXISTS = YES 
 compiler/stage1/build/.depend-v.haskell.tmp
 for dir in compiler/stage1/build/./ compiler/stage1/build/Llvm/
 compiler/stage1/build/LlvmCodeGen/ compiler/stage1/build/PPC/
 compiler/stage1/build/RegAlloc/ compiler/stage1/build/RegAlloc/Graph/
 compiler/stage1/build/RegAlloc/Linear/
 compiler/stage1/build/RegAlloc/Linear/PPC/
 compiler/stage1/build/RegAlloc/Linear/SPARC/
 compiler/stage1/build/RegAlloc/Linear/X86/
 compiler/stage1/build/SPARC/ compiler/stage1/build/SPARC/CodeGen/
 compiler/stage1/build/Vectorise/
 compiler/stage1/build/Vectorise/Builtins/
 compiler/stage1/build/Vectorise/Monad/
 compiler/stage1/build/Vectorise/Type/
 compiler/stage1/build/Vectorise/Utils/ compiler/stage1/build/X86/; do
 if test ! -d $dir; then mkdir -p $dir; fi done
 grep -v ' : [a-zA-Z]:/' compiler/stage1/build/.depend-v.haskell.tmp 
 compiler/stage1/build/.depend-v.haskell
 /usr/sbin/dtrace -Iincludes -Irts -Ilibffi/build/include -C -x
 cpppath=/usr/bin/gcc -h -o rts/dist/build/RtsProbes.h -s
 rts/RtsProbes.d
 . includes/HsFFI.h
 .. includes/ghcconfig.h
 ... includes/ghcautoconf.h
 ... includes/ghcplatform.h
 .. includes/stg/Types.h
 .. /usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdint.h
 .. /usr/lib/gcc/i686-apple-darwin10/4.2.1/include/float.h
 . includes/rts/EventLogFormat.h
 dtrace: failed to compile script rts/RtsProbes.d: line 71: parameter
 is already declared in probe input prototype: StgWord, parameter #6
 make[1]: *** [rts/dist/build/RtsProbes.h] Error 1
 make: *** [all] Error 2
 
 
 
 
 ___
 Glasgow-haskell-users mailing list
 Glasgow-haskell-users@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
 

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users