mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-13 12:53:53 +00:00
Estimated hours taken: 0.1 library/enum.m: library/sparse_bitset.m: Change the copyright notices so that these files are LGPL'd rather than GPL'd.
32 lines
1.1 KiB
Mathematica
32 lines
1.1 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2000 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU Library General
|
|
% Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
%-----------------------------------------------------------------------------%
|
|
% File: enum.m.
|
|
% Author: stayl.
|
|
% Stability: very low.
|
|
%
|
|
% This module provides the typeclass `enum', which describes
|
|
% types which can be converted to and from integers without loss
|
|
% of information.
|
|
%
|
|
% The interface of this module is likely to change.
|
|
% At the moment it is probably best to only use the `enum'
|
|
% type class for types to be stored in `sparse_bitset's.
|
|
%
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
:- module enum.
|
|
|
|
:- interface.
|
|
|
|
% For all instances the following must hold:
|
|
% all [X, Int] (X = from_int(to_int(X)))
|
|
:- typeclass enum(T) where [
|
|
func to_int(T) = int,
|
|
func from_int(int) = T is semidet
|
|
].
|
|
|
|
%-----------------------------------------------------------------------------%
|