Digging through the source code of core.typed I found a namespace that guided me through successfully type checking the following:
(t/cf (t/defalias MonadLB
(t/TFn [[x :variance :covariant]] t/Nothing)))
(t/cf (t/defprotocol [[M :variance :covariant,
:> MonadLB
:< Monad]]
Monad
([a] return [mv :- (M a) v :- a] :- (M a))
([a b] bind [mv :- (M a) f :- [a -> (M b)]] :- (M b))))
Which seems reasonable. However, when I then try to type check a function that depends on this information, I get the error:
"Type Error: Internal Error: Lower-bound MonadLB is not below upper-bound Monad"
The offending function definition and annotation are as follows:
(t/cf (ann for-all-m (All [[f :< Monad] a]
[(f Boolean)
[a -> (f Boolean)]
(Option a)
-> (f Boolean)])))
(t/cf (defn for-all-m [ctx p o]
((inst return f Boolean) ctx false)))
Thoughts?
Cheers