Guest User

Untitled

a guest
Jun 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. (* implementing an interface on a discriminated union in F# *)
  2.  
  3. type IMiddle =
  4. abstract Middle : String with get
  5.  
  6. type Either<'a, 'b> =
  7. | Left of 'a
  8. | Right of 'b
  9.  
  10. interface IMiddle with
  11. member this.Middle = "middle!"
  12.  
  13. let x = Left 110
  14.  
  15. let mdl = (x :> IMiddle).Middle
Add Comment
Please, Sign In to add comment