maybe

package
v0.0.0-...-c2e7105 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Just

func Just(i interface{}) monad.Monad

Just creates a just value

func Nothing

func Nothing() monad.Monad

Nothing creates a Nothing value

Types

type Maybe

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

Maybe provides an implementation of monad.Monad

func (Maybe) AndThen

func (m Maybe) AndThen(f func(interface{}) monad.Monad) monad.Monad

AndThen provides the monadic implementation of AndThen

func (Maybe) FromJust

func (m Maybe) FromJust() interface{}

FromJust gets the just value and panics if it's nothing

func (Maybe) FromMaybe

func (m Maybe) FromMaybe(defaultVal interface{}) interface{}

FromMaybe gets the just value or returns the default

func (Maybe) IsJust

func (m Maybe) IsJust() bool

IsJust returns true if the value is a just value

func (Maybe) LogAndThen

func (m Maybe) LogAndThen(f func(interface{}) monad.Monad, logger func(interface{})) monad.Monad

LogAndThen provides the monadic implementation of LogAndThen

func (Maybe) Return

func (m Maybe) Return(i interface{}) monad.Monad

Return provides the monadic implementation of Return

func (Maybe) String

func (m Maybe) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL