question about coercions between primitive types in STG level

2015-12-06 Thread Ömer Sinan Ağacan
Hi all, In my compiler pass(D1559, see ElimUbxSums.hs) I'm doing some unsafe coercions at the STG level. It works fine for lifted types, but for unlifted ones I'm having some problems. What I'm trying to do is given a number of primitive types I'm finding the one with biggest size, and then

Re: Plugins: Accessing unexported bindings

2015-12-06 Thread Edward Z. Yang
If you have control over the Ids for the properties, if you can arrange for them to be marked "local exported" that should solve your problem. Edward Excerpts from Levent Erkok's message of 2015-12-05 23:01:29 -0800: > Hello, > > The mg_binds field of the ModGuts seem to only contain the

Re: Plugins: Accessing unexported bindings

2015-12-06 Thread Ömer Sinan Ağacan
2015-12-06 2:01 GMT-05:00 Levent Erkok : > The mg_binds field of the ModGuts seem to only contain the bindings that are > exported from the module being compiled. This is not true, it contains all the definitions in the module and I'm relying on this all the time. I just tested

Re: Allow ambiguous types (with warning) by default

2015-12-06 Thread Carter Schonwald
That gets into making the whole parser / renamer / type checker a bit more incremental, and while that would be awesome, and an excellent example of that user experience can be seen in the lean theorem prover, its certainly trickier to see how to realize it in Haskell because the order in the

Re: Kinds of type synonym arguments

2015-12-06 Thread Richard Eisenberg
I think this is a consequence of the rule that we never abstract over types of kind #. But I believe this should work with my branch: > type Tuple (a :: TYPE v1) (b :: TYPE v2) = (# a, b #) The user would have to request that the synonym be used over both * and #, but the synonym should work.

Re: Plugins: Accessing unexported bindings

2015-12-06 Thread Levent Erkok
Omer, Eric, Ed: Thanks for the comments. Omer: I think Eric's observation is at play here. We're talking about "dead-code," i.e., a binding that is neither exported, nor used by any binding inside the module. Those seem to be getting dropped by the time user-plugins are run. Unfortunately, this

Kinds of type synonym arguments

2015-12-06 Thread Ömer Sinan Ağacan
In this program: {-# LANGUAGE MagicHash, UnboxedTuples #-} module Main where import GHC.Prim import GHC.Types type Tuple a b = (# a, b #) main = do let -- x :: Tuple Int# Float# x :: (# Int#, Float# #) x = (# 1#, 0.0# #) return () If I

Re: Plugins: Accessing unexported bindings

2015-12-06 Thread Eric Seidel
GHC should only drop un-exported bindings from the ModGuts if they're also unused, ie *dead code*. The only way I know to get around this is to use the bindings somewhere, or just export them. On Sat, Dec 5, 2015, at 23:01, Levent Erkok wrote: > Hello, > > The mg_binds field of the ModGuts seem

Re: How do I use CallStack?

2015-12-06 Thread Levent Erkok
There's a function for that: https://hackage.haskell.org/package/base-4.8.1.0/docs/GHC-Stack.html#v:showCallStack On Sun, Dec 6, 2015 at 8:43 PM, Richard Eisenberg wrote: > Hi devs, > > I wish to use the new CallStack feature to track call sites of a function. > I want my

Re: How do I use CallStack?

2015-12-06 Thread Reid Barton
On Sun, Dec 6, 2015 at 11:56 PM, Richard Eisenberg wrote: > That looks like exactly what I want. Thanks. > > There remain two mysteries: > - I thought that CallStacks were a new feature that would come with GHC > 8.0. Yet it seems the datatype is present in base-4.8.x. Even

Re: How do I use CallStack?

2015-12-06 Thread Richard Eisenberg
That looks like exactly what I want. Thanks. There remain two mysteries: - I thought that CallStacks were a new feature that would come with GHC 8.0. Yet it seems the datatype is present in base-4.8.x. Even though the docs even say (wrongly, evidently) that it's in base since 4.9. - That

Re: How do I use CallStack?

2015-12-06 Thread Evan Laforge
Also, a call stack frame is just a (name, srcloc) pair, so you can format it yourself. I use: show_stack :: CallStack -> String show_stack = maybe "" show_frame . Seq.last . Stack.getCallStack where show_frame (name, srcloc) = SrcLoc.srcLocFile srcloc ++ ":" ++ show

How do I use CallStack?

2015-12-06 Thread Richard Eisenberg
Hi devs, I wish to use the new CallStack feature to track call sites of a function. I want my function to print out where it was called from. I do not want to call `error`. How do I do this? I looked in the release notes. They describe the CallStack feature at an overview, and the docs

Re: How do I use CallStack?

2015-12-06 Thread Eric Seidel
Hi Richard, Sorry for all of the confusion, it seems the docs do indeed need some love! On Sun, Dec 6, 2015, at 20:56, Richard Eisenberg wrote: > That looks like exactly what I want. Thanks. > > There remain two mysteries: > - I thought that CallStacks were a new feature that would come with