Idris2/tests/idris2/basic013/Implicits.idr
Edwin Brady 04a0f5001f Correct multiplicities when checking Pi binders
We've always just used 0, which isn't correct if the function is going
to be used in a runtime pattern match. Now calculate correctly so that
we're explicit about which type level variables are used at runtime.

This might cause some programs to fail to compile, if they use functions
that calculate Pi types. The solution is to make those functions
explicitly 0 multiplicity. If that doesn't work, you may have been
accidentally trying to use compile-time only data at run time!

Fixes #1163
2021-03-09 17:23:05 +00:00

17 lines
512 B
Idris

public export
interface Do (0 m : Type) where
0 Next : m -> Type
bind : (x : m) -> Next x
-- Test that the implicits don't turn into as patterns on the LHS - they
-- shouldn't, because the elaborator hasn't got that far yet
foom : Int -> {a, b : Type} -> (a -> b) -> a -> b
foom = ?thurlingdrome
-- Similarly, for bind (we can't just implement it as >>= because of where
-- the implicits end up...)
public export
Monad m => Do (m a) where
Next x = {b : Type} -> (a -> m b) -> m b
bind = ?oops -- (>>=)