View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0000323 | mercury | Bug | public | 2014-04-02 22:53 | 2014-04-03 01:21 | ||||||||
Reporter | bwitkowski | ||||||||||||
Assigned To | |||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | new | Resolution | open | ||||||||||
Platform | Linux | OS | Debian | OS Version | wheezy (7.0) | ||||||||
Product Version | |||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0000323: Matching on adts makes and instantiation state subtyping is impossible. | ||||||||||||
Description | Matching on a subtype doesn't carry the information about the inst of the subtype which makes using pattern matching and instantiation state subtyping impossible to use. See the attached file for details. | ||||||||||||
Steps To Reproduce | $ mmc --version Mercury Compiler, version 13.05.2, configured for x86_64-unknown-linux-gnu Copyright (C) 1993-2013 The University of Melbourne $ mmc -E subtyping.m subtyping.m:019: In clause for `use_everything(in, out)': subtyping.m:019: mode error in conjunction. The next 2 error messages subtyping.m:019: indicate possible causes of this error. subtyping.m:019: In clause for `use_everything(in, out)': subtyping.m:019: in argument 1 of call to predicate `subtyping.use_bar'/2: subtyping.m:019: mode error: variable `Bar' has instantiatedness `ground', subtyping.m:019: expected instantiatedness was subtyping.m:019: `bound(subtyping.bar(ground))'. subtyping.m:019: In clause for `use_everything(in, out)': subtyping.m:019: in argument 2 of clause head: subtyping.m:019: mode error in unification of `HeadVar__2' and `String'. subtyping.m:019: Variable `HeadVar__2' has instantiatedness `free', subtyping.m:019: variable `String' has instantiatedness `free'. | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files |
|
Notes | |
juliensf (administrator) 2014-04-03 01:09 |
You can work around the above problem by rewriting the predicate use_everything/2 to use a single clause, for example: use_everything(Foo, String) :- ( Foo = bar(_), use_bar(Foo, String) ; Foo = baz(_), String = "baz" ). |
bwitkowski (reporter) 2014-04-03 01:17 Last edited: 2014-04-03 01:21 |
Interesting, thank you very much! Paul Bone on #mercury irc also suggested deconstructing and reconstructing bar like: use_everything(bar(X), String) :- use_bar(bar(X), String). which works too. Still I think that, ideally, this should also work in pattern matching in multiple clauses(?). |
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2014-04-02 22:53 | bwitkowski | New Issue | |
2014-04-02 22:53 | bwitkowski | File Added: subtyping.m | |
2014-04-03 01:09 | juliensf | Note Added: 0000656 | |
2014-04-03 01:17 | bwitkowski | Note Added: 0000657 | |
2014-04-03 01:21 | bwitkowski | Note Edited: 0000657 | View Revisions |