View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0000313 | mercury | Bug | public | 2014-01-28 06:08 | 2014-01-28 09:45 | ||||
Reporter | lpimmes | ||||||||
Assigned To | |||||||||
Priority | high | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | OS | osx | OS Version | 10.9.1 | |||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0000313: array module declared, but compiler complains | ||||||||
Description | :- pred main(io, io). :- mode main(di, uo) is det. :- implementation. :- import_module array, int, list, string. :- func rodCut(array, int, int, int) = int. :- mode rodCut(in, in, in, in) = out is det. | ||||||||
Steps To Reproduce | rodcut 495>mmc --make --fully-strict -E -v -O 0 --use-subdirs rodcut rodcut.m:046: In definition of function `rodcut.rodCut'/6: rodcut.m:046: error: undefined type `array'/0. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files |
|
![]() |
|
pbone (administrator) 2014-01-28 09:44 |
The type "array" doesn't exist, at all. The type "array(T)" however does. These types are parametric, they can take another type as a parameter. This can be a type variable such as T, or it can be a concrete type or another parameterised type. My guess is that you want to use the type "int" as array/1's parameter. That would make your "array of integers" type "array(int)". The relevant part of the reference manual may help:http://www.mercurylang.org/information/doc-release/mercury_ref/Types.html#Types and http://www.mercurylang.org/information/doc-release/mercury_ref/Discriminated-unions.html#Discriminated-unions |
juliensf (administrator) 2014-01-28 09:45 |
The compiler is correct, the array module does *not* define the type array/0. It does define the type array/1. Your function declaration should most probably have been: : func rodCut(array(T), int, int, int) = int. where T is whatever the element type of the array (or indeed just a type variable if the function is supposed to be polymorphic. |
pbone (administrator) 2014-01-28 09:45 |
This is not a bug, it's a misunderstanding. |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2014-01-28 06:08 | lpimmes | New Issue | |
2014-01-28 09:44 | pbone | Note Added: 0000615 | |
2014-01-28 09:45 | juliensf | Note Added: 0000616 | |
2014-01-28 09:45 | pbone | Note Added: 0000617 | |
2014-01-28 09:45 | pbone | Status | new => closed |
2014-01-28 09:45 | pbone | Resolution | open => no change required |