Created
October 22, 2017 21:46
-
-
Save ctford/aff4e0992e184c7d9ed19f5258a1752c to your computer and use it in GitHub Desktop.
The totality checker thinks `dual` the last case of makes it partial - even though I would have thought the pattern matching shrinks the argument.
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 Channel : (result :Type ) -> Type | |
where | |
Send : a -> Channel a | |
Receive : a -> Channel a | |
Finished : Channel () | |
(>>=) : Channel a -> ((x:a) -> Channel b) -> Channel b | |
dual : Channel a -> Channel a | |
dual (Send x) = (Receive x) | |
dual (Receive x) = (Send x) | |
dual Finished = Finished | |
dual (x >>= f) = (dual x) >>= (dual . f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment