Created
July 24, 2020 21:31
-
-
Save donovancrichton/2838abd65c12dbf0dc01806ac8eafb0f to your computer and use it in GitHub Desktop.
Matching on different types error
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
%default total | |
data MyList : Type -> Type where | |
Nil : {a : Type} -> MyList a | |
(::) : {a : Type} -> a -> MyList a -> MyList a | |
F : MyList a -> Maybe Type | |
F [] = Nothing | |
F ((::) {a} x xs) = Just a | |
G : MyList a -> Maybe Type | |
G [] {a} = Just a | |
G (x :: xs) = Nothing | |
data Check : Maybe Type -> Type where | |
Right : (me : MyList a) -> Check (F me) | |
Fight : (me : MyList a) -> Check (G me) | |
switch : Check a -> (b : Maybe Type ** Check b) | |
switch (Right me) = (_ ** Fight me) | |
switch (Fight me) = (_ ** Right me) | |
switch2 : (a : Maybe Type ** Check a) -> (b : Maybe Type ** Check b) | |
switch2 (_ ** Right me) = ?test1 | |
switch2 (_ ** Fight me) = ?test2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment