Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456 Modules
Modules
Cayenne modules are simply named expressions that live in a global name
space. Module names are distiguished by having a $ in the name.
The module name space could be viewed a hierarchical with
$ as the name separator (like UNIX path names use /).
A module definition looks like a simple definition except that it
is preceeded by the keyword module.
module ::= module [concrete] modid :: type = expr ;
The type is not necessary and it can be left out.
module ::= module [concrete] modid = expr ;
The concrete modifier plays the same role here as for records, i.e. you can
make the value of a module know instead of just its type.
Example
Some sample modules:
module foo$bar = 42;
module foo$baz =
open System$Int use Int, (+) in
struct {
inc :: Int -> Int;
inc x = x+1;
dec :: Int -> Int;
dec x = x-1;
};
#include
Most programs need values from the System modules. To get easy access
to the entities defined in a module it is normally opened. This means
that most modules will start out with a number of open constructs.
To alleviate this problem there are some predefined set of texts that
can be included in a module. These texts are inserted by simple
text insertion with an #include.
#include Prelude
includes the following text
open System$String use * in
open System$List use * in
open System$Bool use * in
open System$Char use * in
open System$Int use * in
open System$Error use * in
open System$IO use * in
open System$Tuples use * in
open System$HO use * in