Skip to content
Jonathan Potter edited this page Jun 16, 2014 · 7 revisions

addInstance(type, implementation)

Types

type : Type
implementation : Object

Description

Add an instance of a type class. implementation is an object with whose values are functions.

Note: this function has side effects.

getInstance(type)

getInstance : a -> Maybe b

Types

type : Type
return : Maybe

Description

Returns [Just](API Maybe) the implementation associated with type if there is one. Otherwise returns [Nothing](API Maybe).

Note: this function is not referentially transparent. Its output can be changed when tlc.addInstance is called.

getInstanceFunc(type, functionName)

getInstanceFunc : a -> String -> Maybe b

Types

type : Type
functionName : String
return : Maybe

Description

Returns [Just](API Maybe) the function with name functionName from the implementation associated with type. If there is no implementation then it returns [Nothing](API Maybe).

Note: this function is not referentially transparent. Its output can be changed when tlc.addInstance is called.

API

  • [Array](API Array)
  • [Function](API Function)
  • [Maybe](API Maybe)
  • [Object](API Object)
  • [Set](API Set)
  • [Typeclass](API Typeclass)

Guides

  • [Operators](Guide Operators)
  • [Typeclasses](Guide Typeclasses)
  • [Replacing OOP](Guide Replacing Object Oriented Programming)

General

Clone this wiki locally