Skip to content

Instantly share code, notes, and snippets.

@schell
Last active May 18, 2017 16:45
Show Gist options
  • Save schell/38565574641fe994aab3faabf350020e to your computer and use it in GitHub Desktop.
Save schell/38565574641fe994aab3faabf350020e to your computer and use it in GitHub Desktop.
varying in idris
record VaryingT (input : Type) (m : Type -> Type) (output : Type) where
constructor VT
runVarT : input -> m (output, Inf $ VaryingT input m output)
Monad m => Functor (VaryingT a m) where
map f v = assert_total $ VT $ \ x => do
(b, v2) <- runVarT v x
pure (f b, map f v2)
@schell
Copy link
Author

schell commented May 18, 2017

Melvar (irc.freenode.net #idris): The problem is that as you define VT, m could be contravariant or invariant, meaning VT is not strictly positive and thus counts as nontotal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment