Package frege.j.Lang

Compiled: Wed Dec 05 00:07:43 PST 2012 from source file: frege/j/Lang.fr

Package Documentation

Here live all classes and interfaces from java.lang except those already introduced in the Prelude.

Naming Conventions

These conventions hold for all packages below frege.j.

A java class hierarchy

 class C1 { ... }
 class C2 extends C1 { ... }
 class C3 extends C2 { ... }

is modeled with frege classes

 class IsC1 a where ...
 class IsC2 IsC1 b => b where ...
 class IsC3 IsC2 c => c where ...

that define the operations available in the class. The type variable resembles the whole type in case it is a pure type, otherwise the type constructor.

A concrete frege type for java class Foo can then be obtained by:

 type Foo = FooT RealWorld          // for IO only types
 type Foo = FooT                    // for pure types
 type Foo = FooT Immutable          // for ST s types that have pure operations
 data FooT s = native java.Foo      // for mutable tyes
 data FooT = pure native java.Foo   // for immutable ones
 instance IsFoo FooT                // make Foo operations available

In each IsFoo frege class, there shall be a downcast operator

  pure native asFoo "(java.Foo)" :: c s -> Foo s

and for each instance method meth that takes non-trivial types as arguments, like in:

 public Baz meth(Bar arg)

there be two frege functions: a native one that uses the exact types and a non native one that applies the appropriate asXXX downcasts to the arguments and calls the native one. One can assume, though, that the receiver is of the correct type and does not need conversion.

 native methBar meth :: Foo s -> Bar s -> ST s (Baz s)
 meth foo bar = methBar foo bar.asBar

Overloaded functions can be disambiguated by

Such renaming shall follow the principle of least surprise, and the documentation shall state clearly which java method will be called in the end.

Table of Content

Imports

Type Aliases

type Runnable = Runnable

shorthand for runnables in the IO monad

Classes

class IsRunnable r

Operations of a java.lang.Runnable

Known Instances

RunnableT

Member Functions

asRunnable :: IsRunnable r => r s -> RunnableT s
pure native (java.lang.Runnable)

downcast conforming types to java.lang.Runnable

run :: IsRunnable r => r s -> ST s ()
native run

perform the ST action that is associated with this runnable.

Instances

instance IsRunnable RunnableT

Member Functions

asRunnable :: RunnableT α -> RunnableT α
pure native (java.lang.Runnable)

inherited from IsRunnable.asRunnable

run :: RunnableT α -> ST α ()
native run

inherited from IsRunnable.run

Data Types

data RunnableT s = native java.lang.Runnable

A java.lang.Runnable, can be created from IO or ST actions

Member Functions

new :: ST s () -> Mutable RunnableT s
native frege.rt.SwingSupport.runnable

Create a java Runnable from a ST s ().

When the run method is called from java code, the ST action will be performed.

Functions and Values by Type

ST s () -> Mutable RunnableT s

RunnableT.new

RunnableT α -> ST α ()

IsRunnable_RunnableT.run

RunnableT α -> RunnableT α

IsRunnable_RunnableT.asRunnable

IsRunnable r => r s -> ST s ()

IsRunnable.run

IsRunnable r => r s -> RunnableT s

IsRunnable.asRunnable

Valid HTML 4.01 Strict