Created
October 1, 2020 01:12
-
-
Save witt3rd/68f45c90c904dd350a299bc99f94fc91 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| record Foo where | |
| constructor MkFoo | |
| from : Type | |
| to : Type | |
| bar : (a : Foo) -> (x : from a) -> (to a) | |
| -- impl not important | |
| baz : (a : Foo) -> (b : Foo) -> ((to b) = (from a)) => (x: from b) -> (to a) | |
| baz a b x = do | |
| let y = bar b x | |
| -- ?hole | |
| let z = bar a y | |
| z | |
| {- | |
| When checking argument x to Main.bar: | |
| Type mismatch between | |
| to b (Type of y) | |
| and | |
| from a (Expected type) | |
| -} | |
| {- | |
| a : Foo | |
| b : Foo | |
| x : from b | |
| constraint : to b = from a | |
| y : to b | |
| -------------------------------------- | |
| hole : to a | |
| -} |
Author
record Foo where
constructor MkFoo
from : Type
to : Type
bar : (a : Foo) -> (x : from a) -> (to a)
-- impl not important
baz : (a : Foo) -> (b : Foo) -> (prf : Foo.to b = Foo.from a) => (x : from b) => to a
baz a b =
let y = bar b x
in bar a (rewrite sym prf in y)
foo1 : Foo
foo1 = MkFoo Nat String
foo2 : Foo
foo2 = MkFoo String Int
test : Int
test = baz foo2 foo1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Working Version