2025-05-09 18:58 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000313mercuryBugpublic2014-01-28 09:45
Reporterlpimmes 
Assigned To 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSosxOS Version10.9.1
Product Version 
Target VersionFixed in Version 
Summary0000313: 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 Reproducerodcut 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.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000615

pbone (administrator)

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

~0000616

juliensf (administrator)

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.

~0000617

pbone (administrator)

This is not a bug, it's a misunderstanding.
+Notes

-Issue History
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
+Issue History