Skip to content

Instantly share code, notes, and snippets.

@maliqq
maliqq / StateMonad.scala
Created December 2, 2016 02:42 — forked from channingwalton/StateMonad.scala
State Monad and Validation with Scalaz
import scalaz._
import Scalaz._
/**
* Use the state monad to 'process a trade' and store the new trade.
* As well as processing the trade, handle validation errors.
*/
object StateMonad extends App {
case class Trade(info: String)
package main
import "bytes"
import "io"
import "os"
import "strings"
import "strconv"
import "fmt"
import "flag"
import "net/http"
// Copyright (C) 2012 Benoit Sigoure
// Copyright (C) 2012 StumbleUpon, Inc.
// This library is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or (at your
// option) any later version. This program is distributed in the hope that it
// will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
// General Public License for more details. You should have received a copy
// of the GNU Lesser General Public License along with this program. If not,
{
"situation":"open_raise",
"position":null,
"upload_hands_item_id":"526ed331ce34de6612a66390",
"created_at":"2013-10-29T01:12:17.178Z",
"updated_at":"2013-10-29T01:12:17.178Z",
"upload_hands_item_date":"2013-10-29T01:12:17.178Z",
"columns":[
{
"aposteriori_share":"0.33282",
{
"header":{
"showdown":{
"freewalk":"show",
"SERGO LAVROV":"show"
},
"currency":"USD",
"bb_player":"lucylooose",
"table":{
"button":5,
{
"header":{
"showdown":{
},
"currency":"USD",
"bb_player":"krondix",
"table":{
"button":2,
"name":"Sita III",
{
"header":{
"showdown":{
"lucylooose":"show",
"freewalk":"show",
"SERGO LAVROV":"show"
},
"currency":"USD",
"bb_player":"SERGO LAVROV",
"table":{
{
"header":{
"showdown":{
"krondix":"show",
"Liza_plus_EV":"muck",
"Ithfen":"show",
"Ludvig100602":"muck",
"BIG2BOSS":"muck"
},
"currency":"USD",
{
"buckets_count":10,
"status":"done",
"user_id":2,
"created_at":"2013-12-08 01:00:50.540000",
"updated_at":"2013-12-08 01:01:47.394000",
"player":null,
"upload_hands_item_id":"52a32f6ace34de6ad64767eb",
"situation":"facing_unopened",
"position":null,
{
"status":"done",
"user_id":4,
"user_hands_uploaded_at":null,
"coach_id":3,
"recommendations":{
"facing_3bet_after_open_raise":[
{
"column_name":"AA",
"user_original_hands_count":32,