Skip to content

Instantly share code, notes, and snippets.

@netogallo
Created July 30, 2013 14:00
Show Gist options
  • Select an option

  • Save netogallo/6113147 to your computer and use it in GitHub Desktop.

Select an option

Save netogallo/6113147 to your computer and use it in GitHub Desktop.
Type things
and FusionType<'a> = {index : int;value : 'a []}
and [<Sealed>] StreamFusion<'a> [<JavaScript>] (s : Stream<'a []>) =
[<JavaScript>]
let mutable lastGood =
match s.Latest with
| Success xs -> Array.map (fun x -> Success x) xs
| Failure msg -> Array.init 1 (fun _ -> Failure msg)
[<JavaScript>]
let fixBounds size =
if size < lastGood.Length then ()
else
let old = Array.map id lastGood
lastGood <- Array.init size (fun i -> if i < old.Length
then old.[i]
else Failure [])
let helperStream : Stream<FusionType<'a>> =
match s.Latest with
| Success v -> BaseStream<FusionType<'a>> ({index=0;value = v} |> Success)
//| Failure msgs -> BaseStream(Failure msgs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment