packages feed

alms-0.6.0: examples/ex08-poly-blame-error.alms

(* A Lying Interface *)

let ap : all 'c. ('c -> 'c) -> 'c -> 'c =
  fun (f: 'a -> 'a) ->
    fun (x: 'a) ->
      f (f x)    (* f is used twice here, despite what iap2 claims *)

let iap2 = (ap :> all 'a. ('a -o 'a) -> 'a -o 'a)

let inc : int -> int =
  fun (y: int) ->
    (fun (g: int -o int) ->
       iap2 g y)
    (fun (z: int) -> z + 1)

in print (inc 5)