Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type _ tree =
- | Node : 'a tree * 'a tree -> 'a tree
- | Leaf : [ `good ] tree
- | Taint : [< `good | `bad ] tree -> [ `bad ] tree
- let taint : [< `good | `bad ] tree -> [ `bad ] tree =
- fun tr -> match tr with
- | Taint tr -> Taint tr
- | _ -> Taint tr
- let rec untaint (type t) (tr : t tree) : [ `good ] tree =
- match tr with
- | Taint _ -> failwith "Cannot untaint this tree"
- | Leaf -> Leaf
- | Node (l, r) -> Node (untaint l, untaint r)
- (* ^
- Error: This expression has type t tree
- but an expression was expected of type t tree
- The type constructor t would escape its scope
- *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement