Created
July 11, 2016 16:11
-
-
Save eduardoleon/f9289748c5d1fde76afb773d225d2ae2 to your computer and use it in GitHub Desktop.
Modular type classes are defined by elaboration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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