[Haskell-cafe] Implementing a new primtype

Paul Monday paul.monday at parsci.com
Tue Oct 11 01:46:42 CEST 2011


No, I've tried with and without the type parameter, it's the same "type" of error leading me to think there is something I'm missing about prim type declarations, here are the variations.


primtype DoubleVec#

primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
   DoubleVec# -> Int# -> Double#

make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
/usr/bin/gcc -E  -undef -traditional -P -Iincludes  -x c compiler/prelude/primops.txt.pp | grep -v '^#pragma GCC' > compiler/prelude/primops.txt
"inplace/bin/genprimopcode" --data-decl          < compiler/prelude/primops.txt > compiler/primop-data-decl.hs-incl
"inplace/bin/genprimopcode" --primop-tag         < compiler/prelude/primops.txt > compiler/primop-tag.hs-incl
"inplace/bin/genprimopcode" --primop-list        < compiler/prelude/primops.txt > compiler/primop-list.hs-incl
"inplace/bin/genprimopcode" --has-side-effects   < compiler/prelude/primops.txt > compiler/primop-has-side-effects.hs-incl
"inplace/bin/genprimopcode" --out-of-line        < compiler/prelude/primops.txt > compiler/primop-out-of-line.hs-incl
"inplace/bin/genprimopcode" --commutable         < compiler/prelude/primops.txt > compiler/primop-commutable.hs-incl
"inplace/bin/genprimopcode" --code-size          < compiler/prelude/primops.txt > compiler/primop-code-size.hs-incl
"inplace/bin/genprimopcode" --can-fail           < compiler/prelude/primops.txt > compiler/primop-can-fail.hs-incl
"inplace/bin/genprimopcode" --strictness         < compiler/prelude/primops.txt > compiler/primop-strictness.hs-incl
"inplace/bin/genprimopcode" --primop-primop-info < compiler/prelude/primops.txt > compiler/primop-primop-info.hs-incl
genprimopcode: ppType: can't handle: TyApp "DoubleVec#" []

make[1]: *** [compiler/primop-primop-info.hs-incl] Error 1
make[1]: *** Deleting file `compiler/primop-primop-info.hs-incl'
make: *** [all] Error 2

And:
primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
   DoubleVec# a -> Int# -> Double#

make -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
/usr/bin/gcc -E  -undef -traditional -P -Iincludes  -x c compiler/prelude/primops.txt.pp | grep -v '^#pragma GCC' > compiler/prelude/primops.txt
"inplace/bin/genprimopcode" --data-decl          < compiler/prelude/primops.txt > compiler/primop-data-decl.hs-incl
"inplace/bin/genprimopcode" --primop-tag         < compiler/prelude/primops.txt > compiler/primop-tag.hs-incl
"inplace/bin/genprimopcode" --primop-list        < compiler/prelude/primops.txt > compiler/primop-list.hs-incl
"inplace/bin/genprimopcode" --has-side-effects   < compiler/prelude/primops.txt > compiler/primop-has-side-effects.hs-incl
"inplace/bin/genprimopcode" --out-of-line        < compiler/prelude/primops.txt > compiler/primop-out-of-line.hs-incl
"inplace/bin/genprimopcode" --commutable         < compiler/prelude/primops.txt > compiler/primop-commutable.hs-incl
"inplace/bin/genprimopcode" --code-size          < compiler/prelude/primops.txt > compiler/primop-code-size.hs-incl
"inplace/bin/genprimopcode" --can-fail           < compiler/prelude/primops.txt > compiler/primop-can-fail.hs-incl
"inplace/bin/genprimopcode" --strictness         < compiler/prelude/primops.txt > compiler/primop-strictness.hs-incl
"inplace/bin/genprimopcode" --primop-primop-info < compiler/prelude/primops.txt > compiler/primop-primop-info.hs-incl
genprimopcode: ppType: can't handle: TyApp "DoubleVec#" [TyVar "a"]

make[1]: *** [compiler/primop-primop-info.hs-incl] Error 1
make[1]: *** Deleting file `compiler/primop-primop-info.hs-incl'
make: *** [all] Error 2

Paul Monday
Parallel Scientific, LLC.
paul.monday at parsci.com




On Oct 10, 2011, at 5:10 PM, Daniel Fischer wrote:

> On Tuesday 11 October 2011, 00:57:39, Paul Monday wrote:
>> There seems to be plenty of documentation around on implementing a new
>> primop, much of it needs some tweaking as files have moved and such.  I
>> can't seem to find any documentation about how to implement primtypes
>> though.
>> 
>> For example, I want to experiment with a new primtype "DV#", my
>> assumption that the type was first declared in the primops.txt.pp seems
>> incorrect.  So I'm trying to backtrack a bit and see where primtypes
>> first appear, I'm hoping someone can at least give me a pointer :-)
>> 
>> For example:
>> ./compiler/prelude/primops.txt.pp
>> 
>> Add the following:
>> primtype DoubleVec# a
> 
> Has a type parameter
> 
>> 
>> Compiles fine
>> 
>> Add a primop on the type:
>> primop ExtractDoubleVecOp "extractDoubleVec#" GenPrimOp
>>   DoubleVec# -> Int# -> Double#
> 
> Used without type parameter
> 
> Might be as simple as that.
> 
>> genprimopcode: ppType: can't handle: TyApp "DoubleVec#" []
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111010/19ee06e6/attachment.htm>


More information about the Haskell-Cafe mailing list