Guest User

Untitled

a guest
Feb 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. signature BLAH =
  2. sig
  3.  
  4. type t (* abstract data type *)
  5. val getX : t -> int
  6. val getBunny : t -> bunny
  7.  
  8. end
  9.  
  10. structure Blah :> BLAH =
  11. (* the implementation may choose it's own way of implementing getX and getBunny *)
  12. struct
  13.  
  14. open Susp (* lazy evaluation library *)
  15.  
  16. type t = {x : int, b : bunny susp} (* for implementor's convenience or just on a whim we take t to be a record. Bunny is computed lazily (don't ask) *)
  17.  
  18. val getX = x (* I'm not sure if this compiles in SML, but it should *)
  19. val getBunny = force bunny (* same provision as above *)
  20.  
  21. end
Add Comment
Please, Sign In to add comment