Advertisement
Guest User

Untitled

a guest
Nov 17th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.37 KB | None | 0 0
  1. type ('a, 'b) t =
  2.   | F of ('a -> 'b)
  3.   | O : ('c, 'b) t * ('a, 'c) t -> ('a, 'b) t
  4.  
  5. let (@) g f = fun x -> x |> f |> g
  6.  
  7. let rec compute (f : ('a, 'b) t) : 'a -> 'b = (* ... The type constructor c#29 would escace its scope *)
  8.   match f with
  9.   | F f1 -> f1
  10.   | O (f1, f2) ->
  11.     let f1' : 'c -> 'b = compute f1 in
  12.     let f2' : 'a -> 'c = compute f2 in
  13.     f1' @ f2'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement