mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-18 10:21:39 +03:00
e6121e0935
This is the result of running the command: $ find . -name '*.idr' -type f -exec sed -i -E 's/\s+$//' {} + I confirmed before running it that this would not affect any markdown formatting in documentation comments.
21 lines
538 B
Idris
21 lines
538 B
Idris
parameters (eq : a -> a -> Bool)
|
|
lookup : a -> List (a, b) -> Maybe b
|
|
lookup x [] = Nothing
|
|
lookup x ((k, v) :: ys)
|
|
= if eq x k
|
|
then Just v
|
|
else lookup x ys
|
|
|
|
data Dict : Type -> Type where
|
|
MkDict : List (a, b) -> Dict b
|
|
|
|
lookupK : a -> Dict b -> Maybe b
|
|
lookupK k (MkDict xs) = lookup k xs
|
|
|
|
testDict : Dict {a=Int} (==) String
|
|
testDict = MkDict _ [(0, "foo"), (1, "bar")]
|
|
|
|
parameters (y : ?) -- test that the type of 'y' can be inferred
|
|
foo : (x : Int) -> x = y -> Int
|
|
foo x@_ Refl = 42
|