Last active
May 4, 2017 18:46
-
-
Save oleks/a388f125213a7e594cb1115d08261bd3 to your computer and use it in GitHub Desktop.
This file contains 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
module Sample | |
import Data.Vect | |
import Data.SortedMap | |
X : (n : Nat) -> Type | |
X n = Vect n Nat | |
Y : Nat -> Nat -> Type | |
Y m n = Vect m (X n) | |
data State | |
= MkState (SortedMap String (Y m n)) | |
getMaybe : {m : Nat} -> {n: Nat} -> Maybe (Y m n) -> Maybe (m ** n ** Y m n) | |
getMaybe {m} {n} (Just v) = Just (m ** n ** v) | |
getMaybe Nothing = Nothing | |
getFun : String -> State -> Maybe (m ** n ** Y m n) | |
getFun name (MkState st) = getMaybe (Data.SortedMap.lookup name st) | |
{- | |
$ idris -p contrib --check Sample.idr | |
Sample.idr:20:60:When checking right hand side of getFun with expected type | |
Maybe (m : Nat ** n : Nat ** Y m n) | |
When checking an application of function Data.SortedMap.lookup: | |
Type mismatch between | |
SortedMap String (Y m1 n2) (Type of st) | |
and | |
SortedMap String | |
(Y ((\m => (\n => m) n1) m1) | |
((\m => (\n => m) n1) m1)) (Expected type) | |
Specifically: | |
Type mismatch between | |
n | |
and | |
m1 | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this: