Facebook
From Queen Tortoise, 1 Year ago, written in F#.
Embed
  1. module Utils =
  2.         // (...)
  3.         type MaybeBuilder() =
  4.         member this.Bind(x,f) = Option.bind f x
  5.         member this.Return(x) = Some x
  6.     let maybe = new MaybeBuilder()
  7.  
  8. // inny moduł
  9. type FileViewModel =
  10.         // (...)
  11.     member this.OriginalNumSamples
  12.         with get() = Utils.maybe {
  13.             let! f = file
  14.             return Signal.length f.spectrogram.samples
  15.        
  16. // alternatywą by było
  17. type FileViewModel =
  18.         // (...)
  19.     member this.OriginalNumSamples
  20.         with get() = Option.map ( fun (f: File.Raw) -> Signal.length f.spectrogram.samples ) file

Replies to Untitled rss

Title Name Language When
Re: Untitled Silly Human fsharp 1 Year ago.