8000 Unlifted values are not consumed linearly · Issue #179 · tweag/ghc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unlifted values are not consumed linearly #179
Open
@andrewthad

Description

@andrewthad

The proposal indicates that any pattern match on a value of type Int#, Char#, etc. should be considered linear consumption. Presumably, this would include wildcard matches with an underscore as well. So, this should typecheck:

foo :: Int ->. Bool
foo (I# _) = True

This doesn't currently work, and it causes me to reach for unsafeCoerce more than I otherwise would. It would be nice if the wrappers over also had the same (or similar behavior). This would let me simplify the above example to:

foo :: Int ->. Bool
foo !_ = True

I think the bang pattern is important here. Without it, we don't force the primitive Int# value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0