Documentation ¶
Index ¶
- func Compose(fnList ...func(...interface{}) []interface{}) func(...interface{}) []interface{}
- func Either(value interface{}, patterns ...Pattern) interface{}
- func MatchCompType(compType CompType, value CompData) bool
- func MatchCompTypeRef(compType CompType, value *CompData) bool
- func PtrOf(v interface{}) *interface{}
- func SliceOf(args ...interface{}) []interface{}
- type AtomBool
- type CompData
- type CompType
- type CompTypePatternDef
- type CorDef
- func (corSelf *CorDef) DoNotation(effect func(*CorDef) interface{}) interface{}
- func (corSelf *CorDef) IsDone() bool
- func (corSelf *CorDef) IsStarted() bool
- func (corSelf *CorDef) New(effect func()) *CorDef
- func (corSelf *CorDef) NewAndStart(effect func()) *CorDef
- func (corSelf *CorDef) Start()
- func (corSelf *CorDef) StartWithVal(in interface{})
- func (corSelf *CorDef) Yield() interface{}
- func (corSelf *CorDef) YieldFrom(target *CorDef, in interface{}) interface{}
- func (corSelf *CorDef) YieldFromIO(target *MonadIODef) interface{}
- func (corSelf *CorDef) YieldRef(out interface{}) interface{}
- type CorOp
- type CurryDef
- type EqualPatternDef
- type HandlerDef
- type KindPatternDef
- type MaybeDef
- func (maybeSelf MaybeDef) Clone() MaybeDef
- func (maybeSelf MaybeDef) CloneTo(dest interface{}) MaybeDef
- func (maybeSelf MaybeDef) FlatMap(fn func(interface{}) *MaybeDef) *MaybeDef
- func (maybeSelf MaybeDef) IsKind(t reflect.Kind) bool
- func (maybeSelf MaybeDef) IsNil() bool
- func (maybeSelf MaybeDef) IsPresent() bool
- func (maybeSelf MaybeDef) IsType(t reflect.Type) bool
- func (maybeSelf MaybeDef) IsValid() bool
- func (maybeSelf MaybeDef) Just(in interface{}) MaybeDef
- func (maybeSelf MaybeDef) Kind() reflect.Kind
- func (maybeSelf MaybeDef) Let(fn func())
- func (maybeSelf MaybeDef) Or(or interface{}) interface{}
- func (maybeSelf MaybeDef) ToBool() (bool, error)
- func (maybeSelf MaybeDef) ToFloat32() (float32, error)
- func (maybeSelf MaybeDef) ToFloat64() (float64, error)
- func (maybeSelf MaybeDef) ToInt() (int, error)
- func (maybeSelf MaybeDef) ToInt32() (int32, error)
- func (maybeSelf MaybeDef) ToInt64() (int64, error)
- func (maybeSelf MaybeDef) ToMaybe() MaybeDef
- func (maybeSelf MaybeDef) ToPtr() *interface{}
- func (maybeSelf MaybeDef) ToString() string
- func (maybeSelf MaybeDef) Type() reflect.Type
- func (maybeSelf MaybeDef) Unwrap() interface{}
- type MonadIODef
- func (monadIOSelf *MonadIODef) FlatMap(fn func(interface{}) *MonadIODef) *MonadIODef
- func (monadIOSelf MonadIODef) Just(in interface{}) *MonadIODef
- func (monadIOSelf *MonadIODef) New(effect func() interface{}) *MonadIODef
- func (monadIOSelf *MonadIODef) ObserveOn(h *HandlerDef) *MonadIODef
- func (monadIOSelf *MonadIODef) Subscribe(s Subscription) *Subscription
- func (monadIOSelf *MonadIODef) SubscribeOn(h *HandlerDef) *MonadIODef
- type NilTypeDef
- type OtherwisePatternDef
- type Pattern
- type PatternMatching
- type ProductType
- type PublisherDef
- func (publisherSelf *PublisherDef) Map(fn func(interface{}) interface{}) *PublisherDef
- func (publisherSelf *PublisherDef) New() *PublisherDef
- func (publisherSelf *PublisherDef) Publish(result interface{})
- func (publisherSelf *PublisherDef) Subscribe(sub Subscription) *Subscription
- func (publisherSelf *PublisherDef) SubscribeOn(h *HandlerDef) *PublisherDef
- func (publisherSelf *PublisherDef) Unsubscribe(s *Subscription)
- type RegexPatternDef
- type StreamDef
- func (streamSelf *StreamDef) Append(item interface{}) *StreamDef
- func (streamSelf *StreamDef) Distinct() *StreamDef
- func (streamSelf *StreamDef) Extend(stream *StreamDef) *StreamDef
- func (streamSelf *StreamDef) Filter(fn func(int) bool) *StreamDef
- func (streamSelf *StreamDef) FromArray(list []interface{}) *StreamDef
- func (streamSelf *StreamDef) FromArrayBool(old []bool) *StreamDef
- func (streamSelf *StreamDef) FromArrayFloat32(old []float32) *StreamDef
- func (streamSelf *StreamDef) FromArrayFloat64(old []float64) *StreamDef
- func (streamSelf *StreamDef) FromArrayInt(old []int) *StreamDef
- func (streamSelf *StreamDef) FromArrayInt32(old []int32) *StreamDef
- func (streamSelf *StreamDef) FromArrayInt64(old []int64) *StreamDef
- func (streamSelf *StreamDef) FromArrayMaybe(old []MaybeDef) *StreamDef
- func (streamSelf *StreamDef) FromArrayString(old []string) *StreamDef
- func (streamSelf *StreamDef) Get(i int) interface{}
- func (streamSelf *StreamDef) Len() int
- func (streamSelf *StreamDef) Map(fn func(int) interface{}) *StreamDef
- func (streamSelf *StreamDef) Remove(index int) *StreamDef
- func (streamSelf *StreamDef) Sort(fn func(i, j int) bool) *StreamDef
- func (streamSelf *StreamDef) ToArray() []interface{}
- type Subscription
- type SumType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compose ¶
func Compose(fnList ...func(...interface{}) []interface{}) func(...interface{}) []interface{}
Compose Compose the functions from right to left (Math: f(g(x)) Compose: Compose(f, g)(x))
func Either ¶
func Either(value interface{}, patterns ...Pattern) interface{}
Either Match Pattern list and return the effect() result of the matching Pattern
func MatchCompType ¶
MatchCompType Check does the Composite Data match the given SumType
func MatchCompTypeRef ¶
MatchCompTypeRef Check does the Composite Data match the given SumType
Types ¶
type AtomBool ¶
type AtomBool struct {
// contains filtered or unexported fields
}
AtomBool Atomic Bool
type CompData ¶
type CompData struct {
// contains filtered or unexported fields
}
CompData Composite Data with values & its CompType(SumType)
func NewCompData ¶
NewCompData New SumType Data by its type and composite values
type CompType ¶
type CompType interface {
Matches(value ...interface{}) bool
}
CompType Abstract SumType concept interface
func DefProduct ¶
DefProduct Define the ProductType of a SumType
type CompTypePatternDef ¶
type CompTypePatternDef struct {
// contains filtered or unexported fields
}
CompTypePatternDef Pattern which matching when the SumType matches
func (CompTypePatternDef) Apply ¶
func (patternSelf CompTypePatternDef) Apply(value interface{}) interface{}
Apply Evaluate the result by its given effect function
func (CompTypePatternDef) Matches ¶
func (patternSelf CompTypePatternDef) Matches(value interface{}) bool
Matches Match the given value by the pattern
type CorDef ¶
type CorDef struct {
// contains filtered or unexported fields
}
CorDef Cor Coroutine inspired by Python/Ecmascript/Lua
var Cor CorDef
Cor Cor utils instance
func (*CorDef) DoNotation ¶
DoNotation Do Notation by function (inspired by Haskell one)
func (*CorDef) NewAndStart ¶
NewAndStart New a Cor instance and start it immediately
func (*CorDef) StartWithVal ¶ added in v1.1.0
func (corSelf *CorDef) StartWithVal(in interface{})
StartWithVal Start the Cor with an initial value
func (*CorDef) YieldFromIO ¶
func (corSelf *CorDef) YieldFromIO(target *MonadIODef) interface{}
YieldFromIO Yield from a given MonadIO
type CorOp ¶
type CorOp struct {
// contains filtered or unexported fields
}
CorOp Cor Yield Operation/Delegation/Callback
type CurryDef ¶
type CurryDef struct {
// contains filtered or unexported fields
}
CurryDef Curry inspired by Currying in Java ways
var Curry CurryDef
Curry Curry utils instance
func (*CurryDef) MarkDone ¶
func (currySelf *CurryDef) MarkDone()
MarkDone Mark the currying is done(let others know it)
type EqualPatternDef ¶
type EqualPatternDef struct {
// contains filtered or unexported fields
}
EqualPatternDef Pattern which matching when the given object is equal to predefined one
func (EqualPatternDef) Apply ¶
func (patternSelf EqualPatternDef) Apply(value interface{}) interface{}
Apply Evaluate the result by its given effect function
func (EqualPatternDef) Matches ¶
func (patternSelf EqualPatternDef) Matches(value interface{}) bool
Matches Match the given value by the pattern
type HandlerDef ¶
type HandlerDef struct {
// contains filtered or unexported fields
}
HandlerDef Handler inspired by Android/WebWorker
var Handler HandlerDef
Handler Handler utils instance
func (*HandlerDef) GetDefault ¶
func (handlerSelf *HandlerDef) GetDefault() *HandlerDef
GetDefault Get Default Handler
func (*HandlerDef) NewByCh ¶
func (handlerSelf *HandlerDef) NewByCh(ioCh *chan func()) *HandlerDef
NewByCh New Handler by its Channel
func (*HandlerDef) Post ¶
func (handlerSelf *HandlerDef) Post(fn func())
Post Post a function to execute on the Handler
type KindPatternDef ¶
type KindPatternDef struct {
// contains filtered or unexported fields
}
KindPatternDef Pattern which matching when the kind matches
func (KindPatternDef) Apply ¶
func (patternSelf KindPatternDef) Apply(value interface{}) interface{}
Apply Evaluate the result by its given effect function
func (KindPatternDef) Matches ¶
func (patternSelf KindPatternDef) Matches(value interface{}) bool
Matches Match the given value by the pattern
type MaybeDef ¶
type MaybeDef struct {
// contains filtered or unexported fields
}
MaybeDef Maybe inspired by Rx/Optional/Guava/Haskell
var Maybe MaybeDef
Maybe Maybe utils instance
func (MaybeDef) Let ¶
func (maybeSelf MaybeDef) Let(fn func())
Let If the wrapped value is not nil, then do the given function
func (MaybeDef) Or ¶
func (maybeSelf MaybeDef) Or(or interface{}) interface{}
Or Check the value wrapped by Maybe, if it's nil then return a given fallback value
type MonadIODef ¶
type MonadIODef struct {
// contains filtered or unexported fields
}
MonadIODef MonadIO inspired by Rx/Observable
var MonadIO MonadIODef
MonadIO MonadIO utils instance
func (*MonadIODef) FlatMap ¶
func (monadIOSelf *MonadIODef) FlatMap(fn func(interface{}) *MonadIODef) *MonadIODef
FlatMap FlatMap the MonadIO by function
func (MonadIODef) Just ¶
func (monadIOSelf MonadIODef) Just(in interface{}) *MonadIODef
Just New MonadIO by a given value
func (*MonadIODef) New ¶
func (monadIOSelf *MonadIODef) New(effect func() interface{}) *MonadIODef
New New MonadIO by effect function
func (*MonadIODef) ObserveOn ¶
func (monadIOSelf *MonadIODef) ObserveOn(h *HandlerDef) *MonadIODef
ObserveOn Observe the MonadIO on the specific Handler
func (*MonadIODef) Subscribe ¶
func (monadIOSelf *MonadIODef) Subscribe(s Subscription) *Subscription
Subscribe Subscribe the MonadIO by Subscription
func (*MonadIODef) SubscribeOn ¶
func (monadIOSelf *MonadIODef) SubscribeOn(h *HandlerDef) *MonadIODef
SubscribeOn Subscribe the MonadIO on the specific Handler
type NilTypeDef ¶
type NilTypeDef struct { }
NilTypeDef NilType implemented by Nil determinations
var NilType NilTypeDef
NilType NilType CompType instance
func (NilTypeDef) Matches ¶
func (typeSelf NilTypeDef) Matches(value ...interface{}) bool
Matches Check does it match nil
type OtherwisePatternDef ¶
type OtherwisePatternDef struct {
// contains filtered or unexported fields
}
OtherwisePatternDef Pattern which matching when the others didn't match(finally)
func (OtherwisePatternDef) Apply ¶
func (patternSelf OtherwisePatternDef) Apply(value interface{}) interface{}
Apply Evaluate the result by its given effect function
func (OtherwisePatternDef) Matches ¶
func (patternSelf OtherwisePatternDef) Matches(value interface{}) bool
Matches Match the given value by the pattern
type Pattern ¶
type Pattern interface { Matches(value interface{}) bool Apply(interface{}) interface{} }
Pattern Pattern general interface
func InCaseOfEqual ¶
func InCaseOfEqual(value interface{}, effect fnObj) Pattern
InCaseOfEqual In case of its value is equal to the given one
func InCaseOfKind ¶
InCaseOfKind In case of its Kind matches the given one
func InCaseOfRegex ¶
InCaseOfRegex In case of the given regex rule matches its value
func InCaseOfSumType ¶
InCaseOfSumType In case of its SumType matches the given one
type PatternMatching ¶
type PatternMatching struct {
// contains filtered or unexported fields
}
PatternMatching PatternMatching contains Pattern list
func DefPattern ¶
func DefPattern(patterns ...Pattern) PatternMatching
DefPattern Define the PatternMatching by Pattern list
func (PatternMatching) MatchFor ¶
func (patternMatchingSelf PatternMatching) MatchFor(inValue interface{}) interface{}
MatchFor Check does the given value match anyone of the Pattern list of PatternMatching
type ProductType ¶
type ProductType struct {
// contains filtered or unexported fields
}
ProductType ProductType with a Kind list
func (ProductType) Matches ¶
func (typeSelf ProductType) Matches(value ...interface{}) bool
Matches Check does it match the ProductType
type PublisherDef ¶
type PublisherDef struct {
// contains filtered or unexported fields
}
PublisherDef Publisher inspired by Rx/NotificationCenter/PubSub
var Publisher PublisherDef
Publisher Publisher utils instance
func (*PublisherDef) Map ¶
func (publisherSelf *PublisherDef) Map(fn func(interface{}) interface{}) *PublisherDef
Map Map the Publisher in order to make a broadcasting chain
func (*PublisherDef) New ¶
func (publisherSelf *PublisherDef) New() *PublisherDef
New New a Publisher
func (*PublisherDef) Publish ¶
func (publisherSelf *PublisherDef) Publish(result interface{})
Publish Publish a value to its subscribers or next chains
func (*PublisherDef) Subscribe ¶
func (publisherSelf *PublisherDef) Subscribe(sub Subscription) *Subscription
Subscribe Subscribe the Publisher by Subscription
func (*PublisherDef) SubscribeOn ¶
func (publisherSelf *PublisherDef) SubscribeOn(h *HandlerDef) *PublisherDef
SubscribeOn Subscribe the Publisher on the specific Handler
func (*PublisherDef) Unsubscribe ¶
func (publisherSelf *PublisherDef) Unsubscribe(s *Subscription)
Unsubscribe Unsubscribe the publisher by the Subscription
type RegexPatternDef ¶
type RegexPatternDef struct {
// contains filtered or unexported fields
}
RegexPatternDef Pattern which matching when the regex rule matches the given string
func (RegexPatternDef) Apply ¶
func (patternSelf RegexPatternDef) Apply(value interface{}) interface{}
Apply Evaluate the result by its given effect function
func (RegexPatternDef) Matches ¶
func (patternSelf RegexPatternDef) Matches(value interface{}) bool
Matches Match the given value by the pattern
type StreamDef ¶
type StreamDef struct {
// contains filtered or unexported fields
}
StreamDef Stream inspired by Collection utils
var Stream StreamDef
Stream Stream utils instance
func (*StreamDef) FromArrayBool ¶
FromArrayBool New Stream instance from a bool array
func (*StreamDef) FromArrayFloat32 ¶
FromArrayFloat32 New Stream instance from a float32 array
func (*StreamDef) FromArrayFloat64 ¶
FromArrayFloat64 New Stream instance from a float64 array
func (*StreamDef) FromArrayInt ¶
FromArrayInt New Stream instance from an int array
func (*StreamDef) FromArrayInt32 ¶
FromArrayInt32 New Stream instance from an int32 array
func (*StreamDef) FromArrayInt64 ¶
FromArrayInt64 New Stream instance from an int64 array
func (*StreamDef) FromArrayMaybe ¶
FromArrayMaybe FromArrayMaybe New Stream instance from a Maybe array
func (*StreamDef) FromArrayString ¶
FromArrayString New Stream instance from a string array
type Subscription ¶
type Subscription struct {
OnNext func(interface{})
}
Subscription the delegation/callback of MonadIO/Publisher