Created
August 17, 2017 22:24
-
-
Save andrevidela/c9d12421034591da8883be07b1e3f1e4 to your computer and use it in GitHub Desktop.
Can't infer explicit argument to tryGenOp, Can't infer explicit argument to S, Can't infer explicit argument to doAdd
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
| mutual | |
| tryGenOp : StackCmd () pre (S _) -> StackIO h | |
| tryGenOp x {pre} {h} = case decEq pre h of | |
| (Yes Refl) => do x | |
| res <- Top | |
| PutStr (show res ++ "\n") | |
| stackCalc | |
| (No contra) => do PutStr $ "not enough item on the stack, expected " ++ | |
| (show pre) ++ | |
| ", got " ++ | |
| (show h) ++ "\n" | |
| stackCalc | |
| stackCalc : StackIO height | |
| stackCalc = do PutStr "> " | |
| input <- GetStr | |
| case strToInput input of | |
| Nothing => do PutStr "Invalid Input\n" | |
| stackCalc | |
| Just (Number x) => do Push x | |
| stackCalc | |
| Just (Add) => tryGenOp doAdd | |
| Just (Sub) => tryGenOp doSubtract | |
| Just (Neg) => ?negation |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ex_13_1_2.idr:112:28:
Can't infer explicit argument to tryGenOp,
Can't infer explicit argument to S,
Can't infer explicit argument to doAdd