Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. type _ tree =
  2. | Node : 'a tree * 'a tree -> 'a tree
  3. | Leaf : [ `good ] tree
  4. | Taint : [< `good | `bad ] tree -> [ `bad ] tree
  5.  
  6. let rec untaint : 'a. 'a tree -> [ `good ] tree =
  7. fun tr -> match tr with
  8. | Taint _ -> failwith "Cannot untaint this tree"
  9. | Leaf -> Leaf
  10. (* ^^^^
  11. Error: This pattern matches values of type [ `good ] tree
  12. but a pattern was expected which matches values of type [ `bad ] tree
  13. *)
  14. | Node (l, r) -> Node (untaint l, untaint r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement