Thanks to everyone who helped me on this project! I've released the
final result on github at
https://github.com/mikeizbicki/HerbiePlugin#herbie-ghc-plugin
On Mon, Sep 7, 2015 at 1:26 PM, Mike Izbicki wrote:
> I have another question :) This one relates to Andrew Farmer's
I have another question :) This one relates to Andrew Farmer's answer
a while back on how to build dictionaries given a Concrete type.
Everything I have works when I use my own numeric hierarchy, but when
I use the Prelude's numeric hierarchy, GHC can't find the `Num Float`
instance (or any other
Hi Mike,
I'll try to hack an example for you some time tomorrow(I'm returning from ICFP
and have some long flights ahead of me).
But in the meantime, here's a working Core code, generated by GHC:
f_rjH :: forall a_alz. Ord a_alz => a_alz -> Bool
f_rjH =
\ (@ a_aCH) ($dOrd_aCI ::
Typo: "You're parsing your code" I mean "You're passing your code"
2015-09-05 0:16 GMT-04:00 Ömer Sinan Ağacan :
> Hi Mike,
>
> I'll try to hack an example for you some time tomorrow(I'm returning from ICFP
> and have some long flights ahead of me).
>
> But in the meantime,
I'm still having trouble creating Core code that can extract
superclass dictionaries from a given dictionary. I suspect the
problem is that I don't actually understand what the Core code to do
this is supposed to look like. I keep getting the errors mentioned
above when I try what I think should
It seems like in your App syntax you're having a non-function in function
position. You can see this by looking at what failing function
(splitFunTy_maybe) is doing:
splitFunTy_maybe :: Type - Maybe (Type, Type)
-- ^ Attempts to extract the argument and result types from a type
...
The purpose of the plugin is to automatically improve the numerical
stability of Haskell code. It is supposed to identify numeric
expressions, then use Herbie (https://github.com/uwplse/herbie) to
generate a numerically stable version, then rewrite the numerically
stable version back into the
I'm not positive, but I believe each dictionary has a field for its
superclass dictionary. So if you have a dictionary for `Floating
Float`, one of the fields will be the `Num Float` dictionary.
How to get the projector function for the field... I'm not sure. But
perhaps you can find it by type?
I have a new question: I'm working on supporting literals now. I'm having
trouble creating something that looks like `(App (Var F#) (Lit 1.0))` because
I don't know how to create a variable that corresponds to the `F#`
constructor. The mkWiredInName function looks promising, but overly
Ahh... I get it now! Thanks for your patience :)
I have a new question: I'm working on supporting literals now. I'm
having trouble creating something that looks like `(App (Var F#) (Lit
1.0))` because I don't know how to create a variable that corresponds
to the `F#` constructor. The
The `buildDictionary` function takes a Var with a dictionary type, and
builds the expression which implements that dictionary.
For instance, you might create a new Var:
x :: Num Float
and pass that to buildDictionary. It will return:
(x, [NonRec x $fNumFloat])
which you could blindly turn
I'm pretty sure the `buildDictionary` function doesn't do what I need.
AFAICT, you pass it a `Var` which contains a dictionary, and it tells
you what is in that dictionary. What I need is a function with type
`Var - Var` where the first `Var` contains a function, and the output
`Var` is the
I'm not sure how either of those two functions can help me. The
problem is that given an operator (e.g. `+`), I don't know the name of
the dictionary that needs to be passed in as the first argument to the
operator. I could probably hard code these names, but then the plugin
wouldn't be able to
HERMIT has some code for building dictionaries for a given predicate
type (by invoking the typechecker functions that do this):
https://github.com/ku-fpg/hermit/blob/master/src/HERMIT/Dictionary/GHC.hs#L223
The functions to run TcM computations inside CoreM are here:
Hello Mike,
Give importDecl from LoadIface a try, or maybe tcLookupGlobal if
you're in TcM.
Edward
Excerpts from Mike Izbicki's message of 2015-08-07 15:40:30 -0700:
I'm trying to write a GHC plugin. The purpose of the plugin is to
provide Haskell bindings to Herbie. Herbie
I've figured out a hack that partially works. If the Name of the
function I'm trying to call is stored in `name`, then the following
code puts its type in `t`:
```
hscenv - getHscEnv
t - liftIO $ do
eps - hscEPS hscenv
let i = fromJust $ lookupNameEnv (eps_PTE eps) name
return varType
16 matches
Mail list logo