progress
This commit is contained in:
parent
33c156fc5c
commit
afd78c3b3e
5 changed files with 54 additions and 8 deletions
|
|
@ -16,13 +16,14 @@ const squareFnType = makeGeneric(a =>
|
|||
}),
|
||||
}));
|
||||
|
||||
// should be: Int -> Int
|
||||
console.log("should be: Int -> Int");
|
||||
console.log(assign(squareFnType, makeGeneric(() => numDictType(Int))));
|
||||
|
||||
// should be: Double -> Double
|
||||
console.log("should be: Double -> Double");
|
||||
console.log(assign(squareFnType, makeGeneric(() => numDictType(Double))));
|
||||
|
||||
// to call 'square' we need:
|
||||
// - access to a mapping from types to their typeclass instantiation
|
||||
// - to know that our argument is 'Int'
|
||||
console.log("");
|
||||
console.log(square(NumInstances.get(Int))(42n)); // 1764n
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue