Re: ByteArray# as a foreign import argument?

2019-10-10 Thread Shao, Cheng
Yes, and specifically, the lifted ByteArray type as described in the
comments, not the unlifted ByteArray# type.

On Fri, Oct 11, 2019 at 4:00 AM Csaba Hruska  wrote:
>
> Sorry, maybe I got it wrong. Are you asking if is there any package that 
> passes ByteArrays via FFI?
>
> On Thu, Oct 10, 2019 at 8:54 PM Csaba Hruska  wrote:
>>
>> It's a primitive type.
>> https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/prelude/primops.txt.pp#L1388
>> https://gitlab.haskell.org/ghc/ghc/wikis/commentary/prim-ops
>>
>> Cheers,
>> Csaba
>>
>> On Thu, Oct 10, 2019 at 8:16 PM Shao, Cheng  wrote:
>>>
>>> Hello devs,
>>>
>>> I've been trying to figure out how to pass lifted types as foreign
>>> types, then encountered the following code in the `DsCCall` module
>>> (https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/deSugar/DsCCall.hs#L172):
>>>
>>> ```
>>>   -- Byte-arrays, both mutable and otherwise; hack warning
>>>   -- We're looking for values of type ByteArray, MutableByteArray
>>>   --data ByteArray  ix = ByteArrayix ix ByteArray#
>>>   --data MutableByteArray s ix = MutableByteArray ix ix
>>> (MutableByteArray# s)
>>>   | is_product_type &&
>>> data_con_arity == 3 &&
>>> isJust maybe_arg3_tycon &&
>>> (arg3_tycon ==  byteArrayPrimTyCon ||
>>>  arg3_tycon ==  mutableByteArrayPrimTyCon)
>>>   = do case_bndr <- newSysLocalDs arg_ty
>>>vars@[_l_var, _r_var, arr_cts_var] <- newSysLocalsDs data_con_arg_tys
>>>return (Var arr_cts_var,
>>>\ body -> Case arg case_bndr (exprType body) [(DataAlt
>>> data_con,vars,body)]
>>>   )
>>> ```
>>>
>>> It seems we allow a "ByteArray" type as a foreign import argument, if
>>> the third field of the datacon is a ByteArray# or MutableByteArray#.
>>> But I can't find such a ByteArray type definition in today's common
>>> packages. What's the rationale for this piece of code?
>>>
>>> Cheers,
>>> Cheng
>>> ___
>>> ghc-devs mailing list
>>> ghc-devs@haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: ByteArray# as a foreign import argument?

2019-10-10 Thread Csaba Hruska
Sorry, maybe I got it wrong. Are you asking if is there any package that
passes ByteArrays via FFI?

On Thu, Oct 10, 2019 at 8:54 PM Csaba Hruska  wrote:

> It's a primitive type.
>
> https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/prelude/primops.txt.pp#L1388
> https://gitlab.haskell.org/ghc/ghc/wikis/commentary/prim-ops
>
> Cheers,
> Csaba
>
> On Thu, Oct 10, 2019 at 8:16 PM Shao, Cheng  wrote:
>
>> Hello devs,
>>
>> I've been trying to figure out how to pass lifted types as foreign
>> types, then encountered the following code in the `DsCCall` module
>> (
>> https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/deSugar/DsCCall.hs#L172
>> ):
>>
>> ```
>>   -- Byte-arrays, both mutable and otherwise; hack warning
>>   -- We're looking for values of type ByteArray, MutableByteArray
>>   --data ByteArray  ix = ByteArrayix ix ByteArray#
>>   --data MutableByteArray s ix = MutableByteArray ix ix
>> (MutableByteArray# s)
>>   | is_product_type &&
>> data_con_arity == 3 &&
>> isJust maybe_arg3_tycon &&
>> (arg3_tycon ==  byteArrayPrimTyCon ||
>>  arg3_tycon ==  mutableByteArrayPrimTyCon)
>>   = do case_bndr <- newSysLocalDs arg_ty
>>vars@[_l_var, _r_var, arr_cts_var] <- newSysLocalsDs
>> data_con_arg_tys
>>return (Var arr_cts_var,
>>\ body -> Case arg case_bndr (exprType body) [(DataAlt
>> data_con,vars,body)]
>>   )
>> ```
>>
>> It seems we allow a "ByteArray" type as a foreign import argument, if
>> the third field of the datacon is a ByteArray# or MutableByteArray#.
>> But I can't find such a ByteArray type definition in today's common
>> packages. What's the rationale for this piece of code?
>>
>> Cheers,
>> Cheng
>> ___
>> ghc-devs mailing list
>> ghc-devs@haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>>
>
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: ByteArray# as a foreign import argument?

2019-10-10 Thread Csaba Hruska
It's a primitive type.
https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/prelude/primops.txt.pp#L1388
https://gitlab.haskell.org/ghc/ghc/wikis/commentary/prim-ops

Cheers,
Csaba

On Thu, Oct 10, 2019 at 8:16 PM Shao, Cheng  wrote:

> Hello devs,
>
> I've been trying to figure out how to pass lifted types as foreign
> types, then encountered the following code in the `DsCCall` module
> (
> https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/deSugar/DsCCall.hs#L172
> ):
>
> ```
>   -- Byte-arrays, both mutable and otherwise; hack warning
>   -- We're looking for values of type ByteArray, MutableByteArray
>   --data ByteArray  ix = ByteArrayix ix ByteArray#
>   --data MutableByteArray s ix = MutableByteArray ix ix
> (MutableByteArray# s)
>   | is_product_type &&
> data_con_arity == 3 &&
> isJust maybe_arg3_tycon &&
> (arg3_tycon ==  byteArrayPrimTyCon ||
>  arg3_tycon ==  mutableByteArrayPrimTyCon)
>   = do case_bndr <- newSysLocalDs arg_ty
>vars@[_l_var, _r_var, arr_cts_var] <- newSysLocalsDs
> data_con_arg_tys
>return (Var arr_cts_var,
>\ body -> Case arg case_bndr (exprType body) [(DataAlt
> data_con,vars,body)]
>   )
> ```
>
> It seems we allow a "ByteArray" type as a foreign import argument, if
> the third field of the datacon is a ByteArray# or MutableByteArray#.
> But I can't find such a ByteArray type definition in today's common
> packages. What's the rationale for this piece of code?
>
> Cheers,
> Cheng
> ___
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


ByteArray# as a foreign import argument?

2019-10-10 Thread Shao, Cheng
Hello devs,

I've been trying to figure out how to pass lifted types as foreign
types, then encountered the following code in the `DsCCall` module
(https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/deSugar/DsCCall.hs#L172):

```
  -- Byte-arrays, both mutable and otherwise; hack warning
  -- We're looking for values of type ByteArray, MutableByteArray
  --data ByteArray  ix = ByteArrayix ix ByteArray#
  --data MutableByteArray s ix = MutableByteArray ix ix
(MutableByteArray# s)
  | is_product_type &&
data_con_arity == 3 &&
isJust maybe_arg3_tycon &&
(arg3_tycon ==  byteArrayPrimTyCon ||
 arg3_tycon ==  mutableByteArrayPrimTyCon)
  = do case_bndr <- newSysLocalDs arg_ty
   vars@[_l_var, _r_var, arr_cts_var] <- newSysLocalsDs data_con_arg_tys
   return (Var arr_cts_var,
   \ body -> Case arg case_bndr (exprType body) [(DataAlt
data_con,vars,body)]
  )
```

It seems we allow a "ByteArray" type as a foreign import argument, if
the third field of the datacon is a ByteArray# or MutableByteArray#.
But I can't find such a ByteArray type definition in today's common
packages. What's the rationale for this piece of code?

Cheers,
Cheng
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: GHC_STAGE

2019-10-10 Thread Shayne Fletcher via ghc-devs
Well, I thought I had but must have got into a funny state since I can't
reproduce today. Sorry for the noise!

On Thu, Oct 10, 2019 at 12:46 PM Stefan Schulze Frielinghaus 
wrote:

> Hi Shayne,
>
> does commit 35cc5eff fix your problem?
>
> Cheers,
> Stefan
>
> On Thu, Oct 10, 2019 at 07:41:47AM -0400, Shayne Fletcher via ghc-devs
> wrote:
> > Hi Ben,
> >
> > I observed warnings of this kind in a couple of places building head
> > yesterday:
> > ```
> > compiler/utils/FastString.hs:336:5: error:
> >  warning: 'GHC_STAGE' is not defined, evaluates to 0 [-Wundef]
> > |
> > 336 | #if GHC_STAGE < 2
> > | ^
> > #if GHC_STAGE < 2
> > ^
> > ```
> >
> > ```
> > compiler/main/DynFlags.hs:323:5: error:
> >  warning: 'GHC_STAGE' is not defined, evaluates to 0 [-Wundef]
> > |
> > 323 | #if GHC_STAGE >= 2
> > | ^
> > #if GHC_STAGE >= 2
> > ^
> > ```
> > I was using the `hadrian/build.stack.sh` approach. Figured you'd want to
> > know!
> >
> > --
> > *Shayne Fletcher*
> > Language Engineer */* +1 917 699 7663
> > *Digital Asset* , creators of *DAML
> > *
> >
> > --
> > This message, and any attachments, is for the intended recipient(s)
> only,
> > may contain information that is privileged, confidential and/or
> proprietary
> > and subject to important terms and conditions available at
> > http://www.digitalasset.com/emaildisclaimer.html
> > . If you are not the
> > intended recipient, please delete this message.
>
> > ___
> > ghc-devs mailing list
> > ghc-devs@haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
>

-- 
*Shayne Fletcher*
Language Engineer */* +1 917 699 7663
*Digital Asset* , creators of *DAML
*

-- 
This message, and any attachments, is for the intended recipient(s) only, 
may contain information that is privileged, confidential and/or proprietary 
and subject to important terms and conditions available at 
http://www.digitalasset.com/emaildisclaimer.html 
. If you are not the 
intended recipient, please delete this message.
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: GHC_STAGE

2019-10-10 Thread Stefan Schulze Frielinghaus
Hi Shayne,

does commit 35cc5eff fix your problem?

Cheers,
Stefan

On Thu, Oct 10, 2019 at 07:41:47AM -0400, Shayne Fletcher via ghc-devs wrote:
> Hi Ben,
> 
> I observed warnings of this kind in a couple of places building head
> yesterday:
> ```
> compiler/utils/FastString.hs:336:5: error:
>  warning: 'GHC_STAGE' is not defined, evaluates to 0 [-Wundef]
> |
> 336 | #if GHC_STAGE < 2
> | ^
> #if GHC_STAGE < 2
> ^
> ```
> 
> ```
> compiler/main/DynFlags.hs:323:5: error:
>  warning: 'GHC_STAGE' is not defined, evaluates to 0 [-Wundef]
> |
> 323 | #if GHC_STAGE >= 2
> | ^
> #if GHC_STAGE >= 2
> ^
> ```
> I was using the `hadrian/build.stack.sh` approach. Figured you'd want to
> know!
> 
> -- 
> *Shayne Fletcher*
> Language Engineer */* +1 917 699 7663
> *Digital Asset* , creators of *DAML
> *
> 
> -- 
> This message, and any attachments, is for the intended recipient(s) only, 
> may contain information that is privileged, confidential and/or proprietary 
> and subject to important terms and conditions available at 
> http://www.digitalasset.com/emaildisclaimer.html 
> . If you are not the 
> intended recipient, please delete this message.

> ___
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Unsquashed merge requests

2019-10-10 Thread Andreas Klebinger

Hello devs,

I've recently seen a few MR's make it into master with commits
which rather obviously were meant to be squashed.

Please look out for this when assigning MRs to marge.

Cheers
Andreas
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


GHC_STAGE

2019-10-10 Thread Shayne Fletcher via ghc-devs
Hi Ben,

I observed warnings of this kind in a couple of places building head
yesterday:
```
compiler/utils/FastString.hs:336:5: error:
 warning: 'GHC_STAGE' is not defined, evaluates to 0 [-Wundef]
|
336 | #if GHC_STAGE < 2
| ^
#if GHC_STAGE < 2
^
```

```
compiler/main/DynFlags.hs:323:5: error:
 warning: 'GHC_STAGE' is not defined, evaluates to 0 [-Wundef]
|
323 | #if GHC_STAGE >= 2
| ^
#if GHC_STAGE >= 2
^
```
I was using the `hadrian/build.stack.sh` approach. Figured you'd want to
know!

-- 
*Shayne Fletcher*
Language Engineer */* +1 917 699 7663
*Digital Asset* , creators of *DAML
*

-- 
This message, and any attachments, is for the intended recipient(s) only, 
may contain information that is privileged, confidential and/or proprietary 
and subject to important terms and conditions available at 
http://www.digitalasset.com/emaildisclaimer.html 
. If you are not the 
intended recipient, please delete this message.
___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs