ku-fpg / hermit

Haskell Equational Reasoning Model-to-Implementation Tunnel
http://www.ittc.ku.edu/csdl/fpg/Tools/HERMIT
BSD 2-Clause "Simplified" License
49 stars 8 forks source link

let-float-top should not float unboxed RHSs #68

Open xich opened 10 years ago

xich commented 10 years ago

Bindings to unboxed values such as:

x :: Int#
x = 10

are not allowed at the top level. This triggers a Core Lint error:

*** Core Lint errors : in result of Core plugin:  HERMIT0 ***
<no location info>: Warning:
    [RHS of sc_s1by :: GHC.Prim.Int#]
    Recursive or top-level binder has strict demand info: sc_s1by
    Binder's demand info: <L,U>
*** Offending Program ***
...

Modify let-float-top to examine the binder's demand info to prevent floating these.

Sculthorpen commented 10 years ago

I'm not convinced this is a problem. We don't want it to be used in something like "bash", but I think the user should be able to do this let-floating manually, as this could be an intermediate step in a larger transformation that could be valid overall. We could instead just tag it as potentially breaking an invariant.

In general, I don't think we should only provide commands that are type correct, or maintain all GHC invariants.

xich commented 10 years ago

Well in this case, it is used in bash, which is how I ran into the problem...

Maybe we could run core lint upon resume/continue and give the user a chance to fic things? On Nov 21, 2013 10:45 PM, "Sculthorpen" notifications@github.com wrote:

I'm not convinced this is a problem. We don't want it to be used in something like "bash", but I think the user should be able to do this let-floating manually, as this could be an intermediate step in a larger transformation that could be valid overall. We could instead just tag it as potentially breaking an invariant.

In general, I don't think we should only provide commands that are type correct, or maintain all GHC invariants.

— Reply to this email directly or view it on GitHubhttps://github.com/ku-fpg/hermit/issues/68#issuecomment-29048668 .[image: Web Bug from https://github.com/notifications/beacon/rsUqfXy0kuDFF3m6LcsWOunW8ZJ_0YfS5-BVRmsI30ofIUaXnQ1otsdR0VL0Cw28.gif]