PreviousUpNext

10.10.7  Function Types

Mythryl functions take some input type and return some result type. Their type is written as the two types, separated by an infix arrow:

    Int_Fun     = Int -> Int;
    Float_Fun   = Float -> Float;
    String_Fun  = String -> String;
    Complex_Fun = (Int, Float, String) -> (String, Float, Int);

For obvious reasons, such types are often called arrow types.

A curried function is actually a function which returns another function. A curried function which takes two strings and returns another thus has type:

    Curried_Fun = String -> (String -> String);

The arrow type operator is defined to associate to the right, so usually such types are simply written as:

    Curried_Fun = String -> String -> String;

Comments and suggestions to: bugs@mythryl.org

PreviousUpNext