Open roboguy13 opened 7 years ago
It occurs to me that Iter
is a newtype
for a function type, which is probably relevant here (and probably where the coercions are coming from).
Yeah, the rightward triangle is a cast (casts are pairs of expression and coercion that proves the cast is type-safe). There should be a cast-float-app rewrite:
https://github.com/ku-fpg/hermit/blob/master/src/HERMIT/Dictionary/Local/Cast.hs#L40
(there are a few other rewrites for casts in that module, but we really have nothing systematic. Finding a paper or description of coercions in GHC and fleshing out an algebra for moving them around would be a super valuable addition for working with real code in HERMIT)
And yes, newtypes become casts in Core. Type functions and GADTs are the other two big sources.
I have part of an expression that looks like this in HERMIT pretty-printed Core:
If I try to beta reduce this, however, HERMIT says that this is not in the appropriate form.
Setting it to show coercions, I have this
and if I further enable detailed type information I see this
I'm not sure if this reduction is fundamentally unsound, or if this is enough information to determine what's going on, but I thought I'd ask just in case something about this pops out.