Re: Unlifted primop types

2018-08-23 Thread Ben Gamari
David Feuer writes: > The problem is that this also accepts things that aren't pointers at all! > We could fix that *for primops* by changing RuntimeRep to something like > > data RuntimeRep > = PtrRep Liftedness >| ... > > But that would only work for primops (at least for now) so it may n

Re: Unlifted primop types

2018-08-23 Thread David Feuer
gt;> >> Simon >> >> >> >> *From:* David Feuer >> *Sent:* 22 August 2018 14:59 >> *To:* Ben Gamari >> *Cc:* Simon Peyton Jones ; David Feuer < >> da...@well-typed.com>; ghc-devs >> *Subject:* Re: Unlifted primop types >>

Re: Unlifted primop types

2018-08-23 Thread David Feuer
> > *From:* David Feuer > *Sent:* 22 August 2018 14:59 > *To:* Ben Gamari > *Cc:* Simon Peyton Jones ; David Feuer < > da...@well-typed.com>; ghc-devs > *Subject:* Re: Unlifted primop types > > > > The problem is that this also accepts things that are

RE: Unlifted primop types

2018-08-23 Thread Simon Peyton Jones via ghc-devs
feels dodgy to me. Simon From: David Feuer Sent: 22 August 2018 14:59 To: Ben Gamari Cc: Simon Peyton Jones ; David Feuer ; ghc-devs Subject: Re: Unlifted primop types The problem is that this also accepts things that aren't pointers at all! We could fix that *for primops* by cha

Re: Unlifted primop types

2018-08-22 Thread David Feuer
The problem is that this also accepts things that aren't pointers at all! We could fix that *for primops* by changing RuntimeRep to something like data RuntimeRep = PtrRep Liftedness | ... But that would only work for primops (at least for now) so it may not be worth the breakage. On Wed, A

RE: Unlifted primop types

2018-08-22 Thread Ben Gamari
Simon Peyton Jones writes: > | Huh! It looks like what we currently do for some primops is just use a > | totally bogus kind. For example, mkWeak# will happily accept an Int# as > | its first argument. > > Well, I see > primop MkWeakOp "mkWeak#" GenPrimOp > o -> b -> (State# RealWorld

RE: Unlifted primop types

2018-08-22 Thread Simon Peyton Jones via ghc-devs
| Huh! It looks like what we currently do for some primops is just use a | totally bogus kind. For example, mkWeak# will happily accept an Int# as | its first argument. Well, I see primop MkWeakOp "mkWeak#" GenPrimOp o -> b -> (State# RealWorld -> (# State# RealWorld, c #)) and I belie

Re: Unlifted primop types

2018-08-21 Thread David Feuer
Huh! It looks like what we currently do for some primops is just use a totally bogus kind. For example, mkWeak# will happily accept an Int# as its first argument. So we *could* follow that precedent and generalize reallyUnsafePtrEquality#, makeStableName#, etc., to accept anything, whether it m

Re: Unlifted primop types

2018-08-21 Thread David Feuer
I see the definition, but I don't understand it, so I don't know how to adapt it to the less-polymorphic version I need. On Tue, Aug 21, 2018, 4:14 PM Ben Gamari wrote: > David Feuer writes: > > > But how do I have to build something like "openAlphaTyVar" for TYPE > > 'UnliftedRep in the primit

Re: Unlifted primop types

2018-08-21 Thread Ben Gamari
David Feuer writes: > But how do I have to build something like "openAlphaTyVar" for TYPE > 'UnliftedRep in the primitive space? I don't understand the toolkit. > I'm not sure I understand the question. openAlphaTyVar is defined in TysPrim. Perhaps looking there will clear up the confusion. Chee

Re: Unlifted primop types

2018-08-21 Thread David Feuer
But how do I have to build something like "openAlphaTyVar" for TYPE 'UnliftedRep in the primitive space? I don't understand the toolkit. On Tue, Aug 21, 2018, 11:07 AM Ben Gamari wrote: > David Feuer writes: > > > On Monday, August 20, 2018 12:11:14 PM EDT Simon Peyton Jones via > ghc-devs wrot

Re: Unlifted primop types

2018-08-21 Thread Ben Gamari
David Feuer writes: > On Monday, August 20, 2018 12:11:14 PM EDT Simon Peyton Jones via ghc-devs > wrote: >> I don’t quite know how primops.txt.pp is processed, but perhaps by >> utils/genprimopcode. You may need to update the syntax a bit? > > The whole thing is a mystery to me. Whatever it'

Re: Unlifted primop types

2018-08-20 Thread David Feuer
On Monday, August 20, 2018 12:11:14 PM EDT Simon Peyton Jones via ghc-devs wrote: > I don’t quite know how primops.txt.pp is processed, but perhaps by > utils/genprimopcode. You may need to update the syntax a bit? The whole thing is a mystery to me. Whatever it's doing seems to generate code

RE: Unlifted primop types

2018-08-20 Thread Simon Peyton Jones via ghc-devs
I don’t quite know how primops.txt.pp is processed, but perhaps by utils/genprimopcode. You may need to update the syntax a bit? Simon From: ghc-devs On Behalf Of David Feuer Sent: 19 August 2018 19:07 To: ghc-devs Subject: Unlifted primop types I'm trying to implement a single prim

Unlifted primop types

2018-08-19 Thread David Feuer
I'm trying to implement a single primop to replace sameMutVar#, sameMutableArray#, etc. The primop should have type unliftedPtrEquality# :: forall (a :: TYPE 'UnliftedRep). a -> a -> Int# Unfortunately, I don't see a way to express this type in primops.pp.txt. Is it possible? If not, what'