2 people like it.

Guess what

So I disposed :(

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
open System

type IType = 
    inherit IDisposable
    abstract say : string -> unit
 
let St = {
    new IType with
        member i.say hi     = Console.Write hi
        member i.Dispose()  = Console.Write "So I disposed"
    }
 
let Say1(cmon : IType) =
    using   <| cmon
            <| fun lol -> lol.say
 
Say1 St " :( "
namespace System
type IType =
  interface
    inherit IDisposable
    abstract member say : string -> unit
  end

Full name: Script.IType
type IDisposable =
  member Dispose : unit -> unit

Full name: System.IDisposable
abstract member IType.say : string -> unit

Full name: Script.IType.say
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
val St : IType

Full name: Script.St
val i : IType
abstract member IType.say : string -> unit
val hi : string
type Console =
  static member BackgroundColor : ConsoleColor with get, set
  static member Beep : unit -> unit + 1 overload
  static member BufferHeight : int with get, set
  static member BufferWidth : int with get, set
  static member CapsLock : bool
  static member Clear : unit -> unit
  static member CursorLeft : int with get, set
  static member CursorSize : int with get, set
  static member CursorTop : int with get, set
  static member CursorVisible : bool with get, set
  ...

Full name: System.Console
Console.Write(value: string) : unit
   (+0 other overloads)
Console.Write(value: obj) : unit
   (+0 other overloads)
Console.Write(value: uint64) : unit
   (+0 other overloads)
Console.Write(value: int64) : unit
   (+0 other overloads)
Console.Write(value: uint32) : unit
   (+0 other overloads)
Console.Write(value: int) : unit
   (+0 other overloads)
Console.Write(value: float32) : unit
   (+0 other overloads)
Console.Write(value: decimal) : unit
   (+0 other overloads)
Console.Write(value: float) : unit
   (+0 other overloads)
Console.Write(buffer: char []) : unit
   (+0 other overloads)
IDisposable.Dispose() : unit
val Say1 : cmon:IType -> (string -> unit)

Full name: Script.Say1
val cmon : IType
val using : resource:'T -> action:('T -> 'U) -> 'U (requires 'T :> IDisposable)

Full name: Microsoft.FSharp.Core.Operators.using
val lol : IType
Raw view Test code New version

More information

Link:http://fssnip.net/hT
Posted:10 years ago
Author:Heather
Tags: syntax