() -> (() -> a)
- sequence (IEnumerable)
with arrows reversed:
(a -> ()) -> ()
- observable (IObservable)
Everything is fine and we have duality between pull and push. In particular, () -> a
is dual to a -> ()
.
#load "HyperF.fsx" | |
open HyperF | |
open Route | |
let service = | |
[ | |
Get("/resource/:id") => fun (req,ri) -> "hello world!" |> HttpRes.plainText |
type Event = { | |
name : string | |
date : DateTime | |
code : int | |
} | |
let randEvent : Rand<Event> = | |
let name = Rand.String (Rand.IntRange 10 15) | |
let date = Rand.DateTime (DateTime(2014, 3, 26)) (DateTime(2015, 3, 26)) | |
let code = Rand.IntRange 1000 9999 |
type MerchantSkuImported with | |
static member Zero = { MerchantSkuImported.id = null ; merchant_id = null ; merchant_sku = null ; upc = null ; manufacturer = null ; brand = null ; part_no = null ; title = null ; description = null ; bullets = List.empty ; category = 0 ; category_path = List.empty ; multi_pack_quantity = None ; shipping_weight = None ; package_length = None ; package_width = None ; package_height = None ; main_image_url = None ; other_image_url = None ; price = None ; quantity = None ; start_selling_date = None } | |
static member MerchantSku = (fun (x:MerchantSkuImported) -> x.merchant_sku) |> Lens.create <| fun v x -> { x with merchant_sku = v } | |
static member UPC = (fun (x:MerchantSkuImported) -> x.upc) |> Lens.create <| fun v x -> { x with upc = v } | |
static member Title = (fun (x:MerchantSkuImported) -> x.title) |> Lens.create <| fun v x -> { x with title = v } | |
static member Brand = (fun (x:MerchantSkuImported) -> x.brand) |> Lens.create <| fun v x -> { x with brand = v } | |
s |
type JsonPath = | |
| Top /// The root of the JsonValue. | |
| Node of i:int * parent:JsonValue * path:JsonPath /// A node within a JsonValue: a record property or an array item. | |
type JsonZipper = JsonZipper of current:JsonValue * path:JsonPath | |
module JsonCursor = | |
let private expectRecord() = failwith "Invalid cursor state: JsonValue.Record expected!" |
type Stream = string | |
type EventType = string | |
type ExpectedVersion = int | |
type EventData = byte[] | |
type EventMetadata = byte[] | |
type ResolveLinks = bool | |
type From = int | |
type BatchSize = int | |
type BufferSize = int | |
type CheckpointStore = (unit -> Async<int option>) * (int -> Async<unit>) |
type MerchantSku = { | |
name : string | |
price : decimal | |
} with | |
static member Name = Lens.create (fun x -> x.name) (fun v x -> { x with name = v}) | |
static member Price = Lens.create (fun x -> x.price) (fun v x -> { x with price = v}) | |
let sku = { name = "Shaving Cream" ; price = 10m } |
let jsonStr = """ | |
{ | |
"itemSize": { | |
"width": "hello" | |
}, | |
"tags": ["foo","bar"] | |
} | |
""" | |
let json = JsonValue.Parse jsonStr |
namespace Marvel.Hopac | |
open System | |
open Hopac | |
open Hopac.Extra | |
open Hopac.Job.Infixes | |
/// An effectful observer. | |
type RxObs<'a> = 'a option -> Job<unit> |
namespace Marvel.Hopac | |
open Hopac | |
open Hopac.Extra | |
open Hopac.Job.Infixes | |
open Hopac.Alt.Infixes | |
/// Different representation of EagerSeq<'a> | |
type HopacSeq<'a> = Job<HopacSeqStep<'a>> |