Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modular type classes are defined by elaboration
using IntOrd
(* `Heap` elaborates to `Heap(IntOrd)`,
* so `val xs : Heap(IntOrd).t` *)
val xs = Heap.fromList [1,2,3];
(* shadows previous `using` declaration *)
using Backwards(IntOrd)
(* `Heap` elaborates to `Heap(Backwards(IntOrd))`,
* so `val ys : Heap(Backwards(IntOrd)).t` *)
val ys = Heap.fromList [1,2,3];
(* type error: can't unify `xs`'s type `Heap(IntOrd).t`
* with expected type `Heap(Backwards(IntOrd)).t` *)
val zs = Heap.merge (xs, ys)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.