mostlyadequate

package
v1.0.45 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

Mostly Adequate: fp-go Companion Guide

This resource is meant to serve as a go "companion" resource to Professor Frisby's Mostly Adequate Guide.

It is a port of the mostly-adequate-fp-ts book.

Documentation

Overview

Package mostlyadequate is meant to serve as a go "companion" resource to Professor Frisby's Mostly Adequate Guide.

Example (Application)
Output:

true
Example (Dasherize)
Output:

the-world-is-a-vampire
Example (Flock)
Output:

32
Example (GetAge)
Output:

Right[<nil>, float64](6472)
Left[*time.ParseError, float64](parsing time "July 4, 2001" as "2006-01-02": cannot parse "July 4, 2001" as "2006")
If you survive, you will be 6837
Example (Greeting)
Output:

Hi times
Hi times
Example (Pipe)
Output:

SEND IN THE CLOWNS!
Example (RenderPage)
Output:

Right[<nil>, string](<div>Destinations: [qui est esse], Events: [ea molestias quasi exercitationem repellat qui ipsa sit aut]</div>)
Example (Shout)
Output:

SEND IN THE CLOWNS!
Example (Solution04A)
Output:

[Jingle bells Batman smells]
Example (Solution04B)
Output:

[quick quarry quails]
Example (Solution04C)
Output:

5234
Example (Solution05A)
Output:

Some[bool](true)
Some[bool](false)
Example (Solution05B)
Output:

790700
Example (Solution05C)
Output:

Some[string](Aston Martin One-77 is the fastest)
Example (Solution08A)
Output:

3
Example (Solution08B)
Output:

Some[int32](65)
Example (Solution08C)
Output:

Left[*errors.errorString, string](Your account is not active)
Right[<nil>, string](Welcome Theresa)
Example (Solution08D)
Output:

Right[<nil>, string](Gary)
Left[*errors.errorString, <nil>](Your name Yi is larger than 3 characters)
Right[<nil>, string](Welcome Albert)
Left[*errors.errorString, string](Your name Yi is larger than 3 characters)
Example (Solution09A)
Output:

Some[string](Walnut St)
None[string]
None[string]
Example (Solution09B)
Output:

ch09.md
Example (Solution09C)
Output:

Right[<nil>, string](sleepy@grandpa.net)
Left[*errors.errorString, string](email notanemail is invalid)
Example (Solution10A)
Output:

Some[int](5)
None[int]
None[int]
Example (Solution10B)
Output:

Some[int](5)
None[int]
None[int]
Example (Solution10C)
Output:

Some[string](Albert vs Theresa)
Some[string](Albert vs Theresa)
Example (Solution11A)
Output:

Some[string](one eyed willy)
None[string]
Example (Solution11B)
Output:

Right[<nil>, string](Albert)
Right[<nil>, string](Gary)
Right[<nil>, string](Theresa)
Left[*errors.errorString, string](user 4 not found)
Example (Solution11C)
Output:

emorst
Example (Solution12A)
Output:

Right[<nil>, map[string]string](map[/:json for / /about:json for /about])
Example (Solution12B)
Output:

Right[<nil>, string](Game started)
Left[*errors.errorString, string](player 4 must have a name)
Example (Solution12C)
Output:

Right[<nil>, option.Option[string]](Some[string](content of file1 (utf-8)))
Example (Street)
Output:

Some[mostlyadequate.Street]({Mulburry 8402})
Example (Widthdraw)
Output:

Your balance is $180.00
You're broke!

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	Cars = A.From(Car{
		Name:        "Ferrari FF",
		Horsepower:  660,
		DollarValue: 700000,
		InStock:     true,
	}, Car{
		Name:        "Spyker C12 Zagato",
		Horsepower:  650,
		DollarValue: 648000,
		InStock:     false,
	}, Car{
		Name:        "Jaguar XKR-S",
		Horsepower:  550,
		DollarValue: 132000,
		InStock:     true,
	}, Car{
		Name:        "Audi R8",
		Horsepower:  525,
		DollarValue: 114200,
		InStock:     false,
	}, Car{
		Name:        "Aston Martin One-77",
		Horsepower:  750,
		DollarValue: 1850000,
		InStock:     true,
	}, Car{
		Name:        "Pagani Huayra",
		Horsepower:  700,
		DollarValue: 1300000,
		InStock:     false,
	})
)

Functions

This section is empty.

Types

type Car

type Car struct {
	Name        string
	Horsepower  int
	DollarValue float32
	InStock     bool
}

Jump to

Keyboard shortcuts

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