generic

package
Version: v0.0.0-...-c877a14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2014 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Either_ = either{}
)
View Source
var (
	IO_ = io{}
)
View Source
var (
	List_ = list{}
)
View Source
var (
	Option_ = option{}
)
View Source
var (
	Promise_ = promise{}
)
View Source
var (
	StateT_ = stateT{}
)
View Source
var (
	Tree_ = tree{}
)
View Source
var (
	Walker_ = walker{}
)
View Source
var (
	Writer_ = writer{}
)

Functions

func Compose

func Compose(f func(x Any) Any) func(func(Any) Any) func(Any) Any

func Constant

func Constant(x Any) func() Any

func Constant1

func Constant1(x Any) func(Any) Any

func Cont

func Cont(thunk func() Result) cont

func Get

func Get() func(Any) StateT

func Identity

func Identity() func(Any) Any

func Merge

func Merge(a StateT) func(Any) StateT

Types

type Any

type Any interface{}

func Trampoline

func Trampoline(bounce Result) Any

type Cofree

type Cofree struct {
	// contains filtered or unexported fields
}

func (Cofree) Extend

func (c Cofree) Extend(f func(Cofree) Any) Cofree

func (Cofree) Extract

func (c Cofree) Extract() Any

func (Cofree) Map

func (c Cofree) Map(f func(Any) Any) Cofree

func (Cofree) Traverse

func (c Cofree) Traverse(g func(Any) Option) Option

type Cons

type Cons struct {
	// contains filtered or unexported fields
}

func NewCons

func NewCons(x Any, y List) Cons

func (Cons) Chain

func (x Cons) Chain(f func(Any) List) List

func (Cons) Concat

func (x Cons) Concat(y List) List

func (Cons) Filter

func (x Cons) Filter(f func(Any) bool) List

func (Cons) Find

func (x Cons) Find(f func(Any) bool) Option

func (Cons) FoldLeft

func (x Cons) FoldLeft(v Any, f func(Any, Any) Any) Any

func (Cons) GroupBy

func (x Cons) GroupBy(f func(Any) Any) List

func (Cons) Head

func (x Cons) Head() Option

func (Cons) Index

func (x Cons) Index(index uint) Option

func (Cons) Last

func (x Cons) Last() Option

func (Cons) Map

func (x Cons) Map(f func(Any) Any) List

func (Cons) Partition

func (x Cons) Partition(f func(Any) bool) Tuple2

func (Cons) ReduceLeft

func (x Cons) ReduceLeft(f func(Any, Any) Any) Option

func (Cons) Reverse

func (x Cons) Reverse() List

func (Cons) Size

func (x Cons) Size() int

func (Cons) Tail

func (x Cons) Tail() List

func (Cons) Zip

func (x Cons) Zip(y List) List

type Either

type Either interface {
	Chain(f func(v Any) Either) Either
	Map(f func(v Any) Any) Either
	Bimap(f func(v Any) Any, g func(v Any) Any) Either
	Fold(f func(v Any) Any, g func(v Any) Any) Any
}

func AsEither

func AsEither(x Any) Either

type Empty

type Empty struct{}

type IO

type IO struct {
	UnsafePerform func() Any
}

func AsIO

func AsIO(x Any) IO

func NewIO

func NewIO(unsafe func() Any) IO

func (IO) Chain

func (x IO) Chain(f func(x Any) IO) IO

func (IO) Map

func (x IO) Map(f func(x Any) Any) IO

type Left

type Left struct {
	// contains filtered or unexported fields
}

func NewLeft

func NewLeft(x Any) Left

func (Left) Bimap

func (x Left) Bimap(f func(v Any) Any, g func(v Any) Any) Either

func (Left) Chain

func (x Left) Chain(f func(v Any) Either) Either

func (Left) Fold

func (x Left) Fold(f func(v Any) Any, g func(v Any) Any) Any

func (Left) Map

func (x Left) Map(f func(v Any) Any) Either

type List

type List interface {
	Head() Option
	Last() Option
	Tail() List
	Chain(func(Any) List) List
	Map(func(Any) Any) List
	Concat(List) List
	Filter(func(Any) bool) List
	Find(func(Any) bool) Option
	FoldLeft(Any, func(Any, Any) Any) Any
	GroupBy(func(Any) Any) List
	Index(uint) Option
	Partition(func(Any) bool) Tuple2
	ReduceLeft(func(Any, Any) Any) Option
	Reverse() List
	Size() int
	Zip(List) List
}

func AsList

func AsList(x Any) List

type Nil

type Nil struct{}

func NewNil

func NewNil() Nil

func (Nil) Chain

func (x Nil) Chain(f func(Any) List) List

func (Nil) Concat

func (x Nil) Concat(y List) List

func (Nil) Filter

func (x Nil) Filter(func(Any) bool) List

func (Nil) Find

func (x Nil) Find(f func(Any) bool) Option

func (Nil) FoldLeft

func (x Nil) FoldLeft(v Any, f func(Any, Any) Any) Any

func (Nil) GroupBy

func (x Nil) GroupBy(f func(Any) Any) List

func (Nil) Head

func (x Nil) Head() Option

func (Nil) Index

func (x Nil) Index(index uint) Option

func (Nil) Last

func (x Nil) Last() Option

func (Nil) Map

func (x Nil) Map(f func(Any) Any) List

func (Nil) Partition

func (x Nil) Partition(f func(Any) bool) Tuple2

func (Nil) ReduceLeft

func (x Nil) ReduceLeft(f func(Any, Any) Any) Option

func (Nil) Reverse

func (x Nil) Reverse() List

func (Nil) Size

func (x Nil) Size() int

func (Nil) Tail

func (x Nil) Tail() List

func (Nil) Zip

func (x Nil) Zip(a List) List

type None

type None struct{}

func NewNone

func NewNone() None

func (None) Ap

func (x None) Ap(v Any) Option

func (None) Chain

func (x None) Chain(f func(v Any) Option) Option

func (None) Fold

func (x None) Fold(f func(v Any) Any, g func() Any) Any

func (None) GetOrElse

func (x None) GetOrElse(v func() Any) Any

func (None) Map

func (x None) Map(f func(v Any) Any) Option

func (None) Traverse

func (x None) Traverse(f func(Any) Any) Option

type Option

type Option interface {
	Chain(func(Any) Option) Option
	Map(func(Any) Any) Option
	Fold(func(Any) Any, func() Any) Any
	Ap(Any) Option
	Traverse(func(Any) Any) Option
	GetOrElse(func() Any) Any
}

func AsOption

func AsOption(x Any) Option

func ToOption

func ToOption(x Any) Option

type Promise

type Promise struct {
	Fork func(func(Any) Any) Any
}

func NewPromise

func NewPromise(f func(func(Any) Any) Any) Promise

func (Promise) Chain

func (x Promise) Chain(f func(v Any) Promise) Promise

func (Promise) Extend

func (x Promise) Extend(f func(Promise) Any) Promise

func (Promise) Extract

func (x Promise) Extract() Any

func (Promise) Map

func (x Promise) Map(f func(Any) Any) Promise

type Result

type Result interface {
	IsDone() bool
}

func Done

func Done(result Any) Result
type Right struct {
	// contains filtered or unexported fields
}

func NewRight

func NewRight(x Any) Right

func (Right) Bimap

func (x Right) Bimap(f func(v Any) Any, g func(v Any) Any) Either

func (Right) Chain

func (x Right) Chain(f func(v Any) Either) Either

func (Right) Fold

func (x Right) Fold(f func(v Any) Any, g func(v Any) Any) Any

func (Right) Map

func (x Right) Map(f func(v Any) Any) Either

type Some

type Some struct {
	// contains filtered or unexported fields
}

func NewSome

func NewSome(x Any) Some

func (Some) Ap

func (x Some) Ap(v Any) Option

func (Some) Chain

func (x Some) Chain(f func(v Any) Option) Option

func (Some) Fold

func (x Some) Fold(f func(v Any) Any, g func() Any) Any

func (Some) GetOrElse

func (x Some) GetOrElse(v func() Any) Any

func (Some) Map

func (x Some) Map(f func(v Any) Any) Option

func (Some) Traverse

func (x Some) Traverse(f func(Any) Any) Option

type StateT

type StateT struct {
	Run func(Any) Either
}

func AsStateT

func AsStateT(x Any) StateT

func NewStateT

func NewStateT(either Either) StateT

func (StateT) Chain

func (s StateT) Chain(f func(Any) StateT) StateT

func (StateT) EvalState

func (s StateT) EvalState(a Any) Any

func (StateT) ExecState

func (s StateT) ExecState(a Any) Any

func (StateT) Map

func (s StateT) Map(f func(Any) Any) StateT

type Tree

type Tree interface {
	Children() Option
	Chain(func(Any) Tree) Tree
	Map(func(Any) Any) Tree
	FoldLeft(Any, func(Any, Any) Any) Any
}

func AsTree

func AsTree(x Any) Tree

type TreeNil

type TreeNil struct {
}

func NewTreeNil

func NewTreeNil() TreeNil

func (TreeNil) Chain

func (t TreeNil) Chain(f func(Any) Tree) Tree

func (TreeNil) Children

func (t TreeNil) Children() Option

func (TreeNil) FoldLeft

func (t TreeNil) FoldLeft(x Any, f func(Any, Any) Any) Any

func (TreeNil) Map

func (t TreeNil) Map(f func(Any) Any) Tree

type TreeNode

type TreeNode struct {
	// contains filtered or unexported fields
}

func NewTreeNode

func NewTreeNode(x Any, y List) TreeNode

func (TreeNode) Chain

func (t TreeNode) Chain(f func(Any) Tree) Tree

func (TreeNode) Children

func (t TreeNode) Children() Option

func (TreeNode) FoldLeft

func (t TreeNode) FoldLeft(x Any, f func(Any, Any) Any) Any

func (TreeNode) Map

func (t TreeNode) Map(f func(Any) Any) Tree

type Tuple2

type Tuple2 struct {
	// contains filtered or unexported fields
}

func AsTuple2

func AsTuple2(x Any) Tuple2

func NewTuple2

func NewTuple2(a, b Any) Tuple2

func (Tuple2) Fst

func (t Tuple2) Fst() Any

func (Tuple2) Slice

func (t Tuple2) Slice() []Any

func (Tuple2) Snd

func (t Tuple2) Snd() Any

type Tuple3

type Tuple3 struct {
	// contains filtered or unexported fields
}

func AsTuple3

func AsTuple3(x Any) Tuple3

func NewTuple3

func NewTuple3(a, b, c Any) Tuple3

func (Tuple3) Fst

func (t Tuple3) Fst() Any

func (Tuple3) Slice

func (t Tuple3) Slice() []Any

func (Tuple3) Snd

func (t Tuple3) Snd() Any

func (Tuple3) Trd

func (t Tuple3) Trd() Any

type Writer

type Writer struct {
	Run func() (Any, []Any)
}

func AsWriter

func AsWriter(x Any) Writer

func NewWriter

func NewWriter(x Any, y []Any) Writer

func (Writer) Chain

func (w Writer) Chain(f func(Any) Writer) Writer

func (Writer) Map

func (w Writer) Map(f func(Any) Any) Writer

func (Writer) Tell

func (w Writer) Tell(x Any) Writer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL