You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, kind resolution is exact; that is, given a context that expects a function f: x -> f x, one cannot pass the partially concrete type: g: x -> R x String where R is a type of higher kind than f x.
This makes it so that some interface resolutions that work in a language like Haskell, don't yet work in Carp. For example (pure here is defined the same as it is in Haskell):
(assert-equal test
&(the (Result Int String) (Result.Success0)))
&(pure0)
results in the error
I can’t find any implementation for the interface `pure` of type (Fn [Int] (r132 Int)) at line 43, column 32 in '/Users/scottolsen/dev/typeclass/test/instances/result.carp'.
None of the possibilities have the correct signature:
Result.Applicative.Success.pure : (Fn [a] (Result a b))
Result.Applicative.Error.pure : (Fn [a] (Result b a)) at /Users/scottolsen/dev/carpclone/core/Test.carp:179:7.
Traceback:
(defnmain [] (let [test (ref (Test.State.init00))] (do (s...) at dummy-file:0:0.
(eval (cons-last (cons-last (cons-last (cons-last (cons-last...) at /Users/scottolsen/dev/carpclone/core/Test.carp:178:3.
(deftesttest (assert-equal test (ref (the (Result Int Int) ...) at /Users/scottolsen/dev/typeclass/test/instances/result.carp:20:1.
Given a definition like Fn [a] (R a b) we should assume that b is concrete since it does not appear in the head of the function. That would make this case inferable.
That is, the kind of (R a b) in Fn [a] (R a b) should be unary * -> * and not binary * -> * -> * since b must be inferred outside of the function context and must be assumed to be resolved to some concrete type using other information.
The text was updated successfully, but these errors were encountered:
Right now, kind resolution is exact; that is, given a context that expects a function
f: x -> f x
, one cannot pass the partially concrete type:g: x -> R x String
where R is a type of higher kind thanf x
.This makes it so that some interface resolutions that work in a language like Haskell, don't yet work in Carp. For example (
pure
here is defined the same as it is in Haskell):results in the error
Given a definition like
Fn [a] (R a b)
we should assume that b is concrete since it does not appear in the head of the function. That would make this case inferable.That is, the kind of
(R a b)
inFn [a] (R a b)
should be unary* -> *
and not binary* -> * -> *
sinceb
must be inferred outside of the function context and must be assumed to be resolved to some concrete type using other information.The text was updated successfully, but these errors were encountered: